Manual Reference Source Test

src/models/reminder/Rule.js

/**
 * Model representing an Rule.
 */
class RuleModel {
  /**
   * @param {Object}  response                - JSON formatted response of an rule.
   * @param {Number}  response.id             - The rule id value
   * @param {String}  response.created_at     - Date in which the rule was created
   * @param {String}  response.label          - Label for the rule
   * @param {String}  response.permanent_link - Permanent Link
   * @param {String}  response.updated_at     - Date in which the rule was updated
   */
  constructor(response = {}) {
    const _response = response.data || response; // if json api is passed in directly
    const attributes = _response.attributes || _response; // if json api is passed in directly

    if (_response.id) {
      /** @type {Number} */
      this.id = parseInt(_response.id, 10);
    }

    /** @type {String} */
    this.createdAt = attributes.created_at;

    /** @type {String} */
    this.label = attributes.label;

    /** @type {String} */
    this.permanentLink = attributes.permanent_link;

    /** @type {String} */
    this.updatedAt = attributes.updated_at;
  }
}

export default RuleModel;