summaryrefslogtreecommitdiff
path: root/iridescence/src/models/product.js
blob: ded54344996b65f0111520bec1c8bba2c7f99714 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
export default class Product {
  constructor(json) {
    if (json) {
      this.id = json.id ? json.id : null;
      this.name = json.name ? json.name : null;
      this.description = json.description ? json.description : null;
      this.cents = Number.isFinite(json.cents) ? json.cents : null;
      this.quantity = Number.isFinite(json.quantity) ? json.quantity : null;
      this.featured = json.featured ? json.featured : false;
      this.category = json.category ? json.category : null;
      this.photo_base = json.photo_base ? json.photo_base : null;
      this.photo_thumbnail = json.photo_thumbnail ? json.photo_thumbnail : null;
      this.photo_fullsize = json.photo_fullsize ? json.photo_fullsize : null;
    }
  }
}