cimpress-fulfiller-identity
Version:
Thin client library for Cimpress' Fulfiller Identity service
186 lines (159 loc) • 4.68 kB
JavaScript
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Objects of fulfiller class are either required or returned by the methods of the FulfillerIdentityClient.
*/
var Fulfiller = function () {
function Fulfiller(fulfillerId, internalFulfillerId, name, email, phone, language, links) {
var archived = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
_classCallCheck(this, Fulfiller);
this._fulfillerId = fulfillerId;
this._internalFulfillerId = internalFulfillerId;
this._name = name;
this._email = email;
this._phone = phone;
this._language = language;
this._archived = archived || false;
this._links = links;
}
/**
* Returns the fulfiller id.
* @returns {*}
*/
_createClass(Fulfiller, [{
key: "getSecurityGroupUrl",
value: function getSecurityGroupUrl() {
return this._links && this._links.fulfillerCoamAdminGroup ? this._links.fulfillerCoamAdminGroup.href : null;
}
}, {
key: "getLogoUrl",
value: function getLogoUrl() {
return this._links && this._links.fulfillerLogo ? this._links.fulfillerLogo.href : null;
}
}, {
key: "getFulfillerContactsUrl",
value: function getFulfillerContactsUrl() {
return this._links && this._links.fulfillerContacts ? this._links.fulfillerContacts.href : null;
}
}, {
key: "getFulfillerFulfillmentLocationsUrl",
value: function getFulfillerFulfillmentLocationsUrl() {
return this._links && this._links.fulfillmentLocations ? this._links.fulfillmentLocations.href : null;
}
}, {
key: "toJSON",
value: function toJSON() {
return {
fulfillerId: this.fulfillerId,
internalFulfillerId: this.internalFulfillerId,
name: this.name,
email: this.email,
phone: this.phone,
language: this.language,
archived: this.archived
};
}
}, {
key: "fulfillerId",
get: function get() {
return this._fulfillerId;
}
/**
* Returns the internal fulfiller id.
* @returns {*}
*/
}, {
key: "internalFulfillerId",
get: function get() {
return this._internalFulfillerId;
}
/**
* Returns the name of the fulfiller.
* @returns {*}
*/
}, {
key: "name",
get: function get() {
return this._name;
}
/**
* Changes the name of the fulfiller in the object.
* @param value
*/
,
set: function set(value) {
this._name = value;
}
/**
* Returns the fufliller contact point email address.
* @returns {*}
*/
}, {
key: "email",
get: function get() {
return this._email;
}
/**
* Sets the fuliller contact point email address in the object.
* @param value
*/
,
set: function set(value) {
this._email = value;
}
/**
* Gets the fulfiller contact point phone number.
* @returns {*}
*/
}, {
key: "phone",
get: function get() {
return this._phone;
}
/**
* Sets the fulfiller contact point phone number in the object.
* @param value
*/
,
set: function set(value) {
this._phone = value;
}
/***
* Gets the fulfiller perferred language
* @returns {*}
*/
}, {
key: "language",
get: function get() {
return this._language;
}
/**
* Sets the fulfiller preferred language in the object.
* @param value
*/
,
set: function set(value) {
this._language = value;
}
/**
* Gets the flag indicating whether the fulfiller is archived.
* @returns {boolean|*}
*/
}, {
key: "archived",
get: function get() {
return this._archived;
}
/**
* Sets the fulfiller as archived in the object.
* @param {boolean|*} value
*/
,
set: function set(value) {
this._archived = value;
}
}]);
return Fulfiller;
}();
module.exports = Fulfiller;