UNPKG

@gameroom/cli

Version:

A command line tool for Gameroom

49 lines (48 loc) 2.29 kB
module.exports = class Update { constructor(data) { if (!data) data = {} // product this.product_name = data.product_name || '' this.product_subname = data.product_subname || '' this.product_id = data.product_id || '' this.product_identifier = data.product_identifier || '' this.auto_priced = data.auto_priced || 'false' // price charting this.pcid = data.pcid || '' // game_plus this.game_plus_id = data.game_plus_id || '' this.game_plus_update = data.game_plus_update || 'false' this.old_game_plus_amount = data.old_game_plus_amount || '0.00' this.new_game_plus_amount = data.new_game_plus_amount || '0.00' this.game_plus_difference = data.game_plus_difference || '0.00' // game_only this.game_only_id = data.game_only_id || '' this.game_only_update = data.game_only_update || 'false' this.old_game_only_amount = data.old_game_only_amount || '0.00' this.new_game_only_amount = data.new_game_only_amount || '0.00' this.game_only_difference = data.game_only_difference || '0.00' // buy_in_game_plus this.buy_in_game_plus_id = data.buy_in_game_plus_id || '' this.buy_in_game_plus_update = data.buy_in_game_plus_update || 'false' this.old_buy_in_game_plus_amount = data.old_buy_in_game_plus_amount || '0.00' this.new_buy_in_game_plus_amount = data.new_buy_in_game_plus_amount || '0.00' this.buy_in_game_plus_difference = data.buy_in_game_plus_difference || '0.00' // buy_in_game_only this.buy_in_game_only_id = data.buy_in_game_only_id || '' this.buy_in_game_only_update = data.buy_in_game_only_update || 'false' this.old_buy_in_game_only_amount = data.old_buy_in_game_only_amount || '0.00' this.new_buy_in_game_only_amount = data.new_buy_in_game_only_amount || '0.00' this.buy_in_game_only_difference = data.buy_in_game_only_difference || '0.00' // prices this.gamestop_price = data.gamestop_price || '0.00' this.gamestop_trade_price = data.gamestop_trade_price || '0.00' // notes this.product_update = data.product_update || 'false' this.notes = data.notes || '' } update(data) { if (!data) data = {} for (const key of Object.keys(data)) if (Object.keys(this).includes(key)) this[key] = data[key] return this } }