cimpress-fulfiller-identity
Advanced tools
Comparing version 0.1.10 to 0.2.0
@@ -158,3 +158,3 @@ 'use strict'; | ||
return parsedBody.map(function (f) { | ||
return new FulfillerContact(f.id, f.createdAt, f.createdBy, f.defaultContact, f.email, f.language, f.name, f.phone, f.technicalContact, f.links); | ||
return new FulfillerContact(f.id, f.createdAt, f.createdBy, f.defaultContact, f.email, f.language, f.name, f.phone, f.technicalContact, f.businessContact, f.operationalSupportContact, f.links); | ||
}); | ||
@@ -161,0 +161,0 @@ }).catch(function (err) { |
@@ -11,3 +11,3 @@ "use strict"; | ||
var FulfillerContact = function () { | ||
function FulfillerContact(id, createdAt, createdBy, defaultContact, email, language, name, phone, technicalContact, links) { | ||
function FulfillerContact(id, createdAt, createdBy, defaultContact, email, language, name, phone, technicalContact, businessContact, operationalSupportContact, links) { | ||
_classCallCheck(this, FulfillerContact); | ||
@@ -24,2 +24,4 @@ | ||
this._technicalContact = technicalContact; | ||
this._operationalSupportContact = operationalSupportContact; | ||
this._businessContact = businessContact; | ||
this._links = links; | ||
@@ -56,3 +58,5 @@ } | ||
phone: this._phone, | ||
technicalContact: this._technicalContact | ||
technicalContact: this._technicalContact, | ||
businessContact: this._businessContact, | ||
operationalSupportContact: this._operationalSupportContact | ||
}; | ||
@@ -120,6 +124,12 @@ } | ||
/** | ||
* Returns if the contact is business or not | ||
* @returns {*} | ||
*/ | ||
, | ||
/** | ||
* Changes if the contact is technical or not | ||
* @param value | ||
*/ | ||
, | ||
set: function set(value) { | ||
@@ -135,2 +145,18 @@ this._technicalContact = value; | ||
}, { | ||
key: "businessContact", | ||
get: function get() { | ||
return this._businessContact; | ||
} | ||
/** | ||
* Returns if the contact is operational support or not | ||
* @returns {*} | ||
*/ | ||
}, { | ||
key: "operationalSupportContact", | ||
get: function get() { | ||
return this._operationalSupportContact; | ||
} | ||
}, { | ||
key: "name", | ||
@@ -191,3 +217,3 @@ get: function get() { | ||
/*** | ||
* Gets the fulfiller perferred language | ||
* Gets the fulfiller preferred language | ||
* @returns {*} | ||
@@ -194,0 +220,0 @@ */ |
{ | ||
"name": "cimpress-fulfiller-identity", | ||
"version": "0.1.10", | ||
"version": "0.2.0", | ||
"description": "Thin client library for Cimpress' Fulfiller Identity service", | ||
@@ -49,5 +49,4 @@ "main": "./lib/index.js", | ||
"mock-require": "^2.0.2", | ||
"nock": "^9.0.13", | ||
"sinon": "^2.3.5" | ||
"nock": "^10.0.2" | ||
} | ||
} |
@@ -115,2 +115,4 @@ # Cimpress Fulfiller Identity client | ||
console.log(fulfillerContact.technicalContact) | ||
console.log(fulfillerContact.businessContact) | ||
console.log(fulfillerContact.operationalSupportContact) | ||
console.log(fulfillerContact.getContactUrl()) | ||
@@ -117,0 +119,0 @@ console.log(fulfillerContact.getFulfillerUrl()) |
@@ -32,3 +32,3 @@ const axios = require('axios'); | ||
this.xrayPRoxy = new XRayProxy(this.authorizer, awsXRay); | ||
axiosRetry(axios, { | ||
@@ -136,3 +136,3 @@ retries: retries >= 0 ? retries : 3, | ||
}) | ||
.then(parsedBody => parsedBody.map(f => new FulfillerContact(f.id, f.createdAt, f.createdBy, f.defaultContact, f.email, f.language, f.name, f.phone, f.technicalContact, f.links))) | ||
.then(parsedBody => parsedBody.map(f => new FulfillerContact(f.id, f.createdAt, f.createdBy, f.defaultContact, f.email, f.language, f.name, f.phone, f.technicalContact, f.businessContact, f.operationalSupportContact, f.links))) | ||
.catch((err) => Promise.reject(err.response && err.response.status === 404 ? | ||
@@ -139,0 +139,0 @@ new FulfillerNotFoundError(`Fulfiller ${fulfillerId} does not exits`) : |
@@ -5,3 +5,3 @@ /** | ||
class FulfillerContact { | ||
constructor(id, createdAt, createdBy, defaultContact, email, language, name, phone, technicalContact, links) { | ||
constructor(id, createdAt, createdBy, defaultContact, email, language, name, phone, technicalContact, businessContact, operationalSupportContact, links) { | ||
this._id = id; | ||
@@ -16,2 +16,4 @@ this._createdAt = createdAt; | ||
this._technicalContact = technicalContact; | ||
this._operationalSupportContact = operationalSupportContact; | ||
this._businessContact = businessContact; | ||
this._links = links; | ||
@@ -69,2 +71,18 @@ } | ||
/** | ||
* Returns if the contact is business or not | ||
* @returns {*} | ||
*/ | ||
get businessContact() { | ||
return this._businessContact; | ||
} | ||
/** | ||
* Returns if the contact is operational support or not | ||
* @returns {*} | ||
*/ | ||
get operationalSupportContact() { | ||
return this._operationalSupportContact; | ||
} | ||
/** | ||
* Changes if the contact is technical or not | ||
@@ -127,3 +145,3 @@ * @param value | ||
/*** | ||
* Gets the fulfiller perferred language | ||
* Gets the fulfiller preferred language | ||
* @returns {*} | ||
@@ -143,3 +161,2 @@ */ | ||
getContactUrl() { | ||
@@ -152,3 +169,3 @@ return this._links && this._links.self ? this._links.self.href : null; | ||
} | ||
toJSON() { | ||
@@ -164,3 +181,5 @@ return { | ||
phone: this._phone, | ||
technicalContact: this._technicalContact | ||
technicalContact: this._technicalContact, | ||
businessContact: this._businessContact, | ||
operationalSupportContact: this._operationalSupportContact | ||
}; | ||
@@ -170,2 +189,2 @@ } | ||
module.exports = FulfillerContact; | ||
module.exports = FulfillerContact; |
56902
16
1122
135