Skip to content

Conversation

@bparise
Copy link
Contributor

@bparise bparise commented Nov 16, 2017

This change adds in PUT (via create) and DELETE for productListings endpoint

This change adds in PUT (via create) and DELETE for productListings endpoint
@coveralls
Copy link

coveralls commented Nov 16, 2017

Coverage Status

Coverage decreased (-0.8%) to 99.199% when pulling abc5dc0 on bparise:patch-1 into 48c3f94 on MONEI:master.

@bparise
Copy link
Contributor Author

bparise commented Nov 16, 2017

Dope. Forgot test cases to cover this pull request... will do shortly

}

assign(ProductListing.prototype, omit(base, [
'create',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this as we are adding a custom version below.

*/
ProductListing.prototype.create = function addProductId(productId) {
const url = this.buildUrl(`${productId}`);
return this.shopify.request(url, 'PUT', undefined, {})
Copy link
Collaborator

@lpinca lpinca Nov 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example does not use an empty body. Can we do something like this?

/**
 * Creates a product listing.
 *
 * @param {Number} productId The ID of the product to publish
 * @param {Object} [params] Body parameters
 * @return {Promise} Promise that resolves with the result
 * @public
 */
ProductListing.prototype.create = function create(productId, params) {
  params || (params = { product_id: productId });
  const url = this.buildUrl(productId);
  return this.shopify.request(url, 'PUT', this.key, params);
};

* @return {Promise} Promise that resolves with the result
* @public
*/
ProductListing.prototype.delete = function deleteProductId(productId) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this as the default implementation

delete(id) {
const url = this.buildUrl(id);
return this.shopify.request(url, 'DELETE');
},
should work.

@lpinca
Copy link
Collaborator

lpinca commented Nov 17, 2017

We also need to update the documentation.

@coveralls
Copy link

coveralls commented Nov 30, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 4668493 on bparise:patch-1 into 48c3f94 on MONEI:master.

@lpinca lpinca merged commit 122cd12 into MONEI:master Nov 30, 2017
@lpinca
Copy link
Collaborator

lpinca commented Nov 30, 2017

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants