@gameroom/cli
Version:
A command line tool for Gameroom
28 lines (26 loc) • 644 B
JavaScript
const { google_product_categories, google_store_codes } = require('../../refs'),
{ componentString, extractHTMLText } = require('../../helpers')
module.exports = class Inventory {
constructor(data) {
if (!data) data = {}
const {
id,
price,
quantity,
store_code
} = data
this.id = id
this.price = price
this.quantity = quantity
this.store_code = store_code
}
static fromUnitExtended(unit) {
const price = `${(unit.amount * .01).toFixed(2)} USD`
return new Inventory({
id: unit.id,
price,
quantity: unit.quantity,
store_code: unit.store_id
})
}
}