cimpress-fulfiller-identity
Version:
Thin client library for Cimpress' Fulfiller Identity service
235 lines (200 loc) • 5.45 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 FulfillerContact = function () {
function FulfillerContact(id, createdAt, createdBy, defaultContact, email, language, name, phone, technicalContact, businessContact, operationalSupportContact, links) {
_classCallCheck(this, FulfillerContact);
this._id = id;
this._createdAt = createdAt;
this._createdBy = createdBy;
this._defaultContact = defaultContact;
this._email = email;
this._language = language;
this._name = name;
this._phone = phone;
this._technicalContact = technicalContact;
this._operationalSupportContact = operationalSupportContact;
this._businessContact = businessContact;
this._links = links;
}
/**
* Returns the contact id.
* @returns {*}
*/
_createClass(FulfillerContact, [{
key: "getContactUrl",
value: function getContactUrl() {
return this._links && this._links.self ? this._links.self.href : null;
}
}, {
key: "getFulfillerUrl",
value: function getFulfillerUrl() {
return this._links && this._links.fulfiller ? this._links.fulfiller.href : null;
}
}, {
key: "toJSON",
value: function toJSON() {
return {
id: this._id,
createdAt: this._createdAt,
createdBy: this._createdBy,
defaultContact: this._defaultContact,
email: this._email,
language: this._language,
name: this._name,
phone: this._phone,
technicalContact: this._technicalContact,
businessContact: this._businessContact,
operationalSupportContact: this._operationalSupportContact
};
}
}, {
key: "id",
get: function get() {
return this._id;
}
/**
* Returns when the contact was created
* @returns {*}
*/
}, {
key: "createdAt",
get: function get() {
return this._createdAt;
}
/**
* Returns the name of the creator of the contact
* @returns {*}
*/
}, {
key: "createdBy",
get: function get() {
return this._createdBy;
}
/**
* Returns if the contact is default or not
* @returns {*}
*/
}, {
key: "defaultContact",
get: function get() {
return this._defaultContact;
}
/**
* Changes the defaultContact to true or false.
* @param value
*/
,
set: function set(value) {
this._defaultContact = value;
}
/**
* Returns if the contact is technical or not
* @returns {*}
*/
}, {
key: "technicalContact",
get: function get() {
return this._technicalContact;
}
/**
* Returns if the contact is business or not
* @returns {*}
*/
,
/**
* Changes if the contact is technical or not
* @param value
*/
set: function set(value) {
this._technicalContact = value;
}
/**
* Returns the name of the fulfiller.
* @returns {*}
*/
}, {
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",
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 preferred 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;
}
}]);
return FulfillerContact;
}();
module.exports = FulfillerContact;