UNPKG

@gameroom/cli

Version:

A command line tool for Gameroom

30 lines (28 loc) 1.01 kB
const axios = require('axios'), cosmetic = require('cosmetic'), { tryRepeatedly } = require('../../helpers'), { shopify, spinner } = require('../../refs') module.exports = class Location { constructor(data) { if (!data) data = {} this.active = data.active this.address1 = data.address1 this.address2 = data.address2 this.city = data.city this.country = data.country this.country_code = data.country_code this.created_at = data.created_at this.id = data.id this.legacy = data.legacy this.name = data.name this.phone = data.phone this.province = data.province this.province_code = data.province_code this.updated_at = data.updated_at this.zip = data.zip } static async get() { const result = await tryRepeatedly(() => shopify.get('/locations.json'), (err) => spinner.warn(`error getting ${cosmetic.green('shopify locations')} ${err}`)) return result && result.data && result.data.locations ? result.data.locations : [] } }