Skip to content

Commit

Permalink
added latitude & longitude getters on StoreLocation resource, added a…
Browse files Browse the repository at this point in the history
…bility to pull network tags and store locations
  • Loading branch information
roncodes committed Jan 7, 2022
1 parent e8a5082 commit fd21172
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/@fleetbase/storefront.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/@fleetbase/storefront.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cjs/storefront.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cjs/storefront.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/esm/storefront.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/esm/storefront.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fleetbase/storefront",
"version": "1.1.1",
"version": "1.1.2",
"description": "Fleetbase Storefront JS & Node SDK",
"main": "dist/cjs/storefront.js",
"module": "dist/esm/storefront.js",
Expand Down
12 changes: 12 additions & 0 deletions src/resources/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,25 @@ export default class Network extends Resource {
super(attributes, adapter, 'network', options);
}

getTags(params = {}) {
return this.adapter.get('tags', params);
}

getStores(params = {}) {
return this.adapter.get('stores', params).then((stores) => {
return new Collection(stores.map(attributes => {
return new Store(attributes, this.adapter);
}));
});
}

getStoreLocations(params = {}) {
return this.adapter.get('store-locations', params).then((locations) => {
return new Collection(locations.map(attributes => {
return new StoreLocation(attributes, this.adapter);
}));
});
}

getPaymentGateways() {
return this.adapter.get('gateways').then((gateways) => {
Expand Down
8 changes: 8 additions & 0 deletions src/resources/store-location.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ export default class StoreLocation extends Resource {
super(attributes, adapter, 'store-location', options);
}

get latitude() {
return this.getAttribute('place.location.coordinates.1');
}

get longitude() {
return this.getAttribute('place.location.coordinates.0');
}

get hours() {
return new Collection(this.getAttribute('hours').map(attributes => new StoreHour(attributes)));
}
Expand Down

0 comments on commit fd21172

Please sign in to comment.