Manual Reference Source Test

src/models/Timezone.js

/**
 * Model representing a timezone.
 */
class TimezoneModel {
  /**
   * @param {Object} response               - JSON formatted response of a Timezone
   * @param {String} response.id            - The id value of the Timezone
   * @param {String} response.type          - The type value of the Timezone
   * @param {String} response.name          - Name of the Timezone
   * @param {Number} response.offset        - Value for sorting returned timezones
   * @param {String} response.region        - Region of timezone
   */
  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 {String} */
      this.id = _response.id;
    }

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

    /** @type {Number} */
    this.offset = attributes.offset;

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

export default TimezoneModel;