mozu-node-sdk
Version:
Mozu JavaScript SDK for Node.js and Arc.js environments
22 lines (19 loc) • 1.06 kB
JavaScript
;
/**
* The authentication ticket used to authenticate anything.
* @class AuthTicket
* @property {string} accessToken The token that stores an encrypted list of the application's configured behaviors and authenticates the application.
* @property {Date} accessTokenExpiration Date and time the access token expires. After the access token expires, refresh the authentication ticket using the refresh token.
* @property {string} refreshToken The token that refreshes the application's authentication ticket.
* @property {Date} refreshTokenExpiration Date and time the refresh token expires. After the refresh token expires, generate a new authentication ticket.
*/
function AuthTicket(json) {
var self = this;
if (!(this instanceof AuthTicket)) return new AuthTicket(json);
for (var p in json) {
if (Object.prototype.hasOwnProperty.call(json, p)) {
self[p] = p.indexOf('Expiration') !== -1 ? new Date(json[p]) : json[p]; // dateify the dates, this'll break if the prop name changes
}
}
}
module.exports = AuthTicket;