MONEI / Shopify-api-node

Node Shopify connector sponsored by MONEI
https://monei.com/shopify-payment-gateway/
MIT License
952 stars 280 forks source link

Getting assets/asset #125

Closed BarryCarlyon closed 7 years ago

BarryCarlyon commented 7 years ago

https://help.shopify.com/api/reference/asset

Getting a single asset works fine as asset.js line 20 sets the key to asset

But the call to "Receive a list of all assets", uses the key assets, so the call fails/module returns no response.

Asset.prototype.get = function get(themeId, params) {
  const url = this.buildUrl(themeId, undefined, params);
  return this.shopify.request(url, 'GET', this.key);
};

Something like, (before the return)

if (!params) {
    this.key = 'assets';
}

But not sure is this is the right fix

lpinca commented 7 years ago

It should work as expected, see https://github.com/MONEI/Shopify-api-node/blob/d287b218734c2e68216581ef159013eb0133bbfd/mixins/base-child.js#L76-L79.

This is also tested: https://github.com/MONEI/Shopify-api-node/blob/d287b218734c2e68216581ef159013eb0133bbfd/test/asset.test.js#L15-L24.

BarryCarlyon commented 7 years ago

Ah I need to call the list function instead of the get function

I didn't make a conncetion from Shopify docs to Module docs