Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Get and create images for a specific product #42

Merged
merged 1 commit into from

3 participants

@SebastianSzturo

Added 2 methods to get and create images for a specific product.

GET /products/id/images.json
POST /products/id/images.json

The problem is the naming of the method "get_product_images" and "create_product_images" aren't quite right because all product resources are named plural. But I don't really know how to name them.

This should be added for every product specific resource like videos or discount rules.

@maetl

Those methods are named correctly—it should be plural for a collection resource (ie: /products), and singular for an entity resource (ie: /products/1).

@maetl maetl merged commit 3bd68d0 into bigcommerce:master

1 check passed

Details default The Travis build passed
@pedelman pedelman added the v0.x label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/bigcommerce/api.rb
View
8 lib/bigcommerce/api.rb
@@ -281,6 +281,14 @@ def get_products_customfield(product_id, custom_field_id)
@connection.get("/products/#{product_id}/customfields/#{custom_field_id}", {})
end
+ def get_product_images(product_id, options={})
+ @connection.get("/products/#{product_id}/images", options)
+ end
+
+ def create_product_images(product_id, options={})
+ @connection.post("/products/#{product_id}/images", options)
+ end
+
def get_products_images(options={})
@connection.get("/products/images", options)
end
Something went wrong with that request. Please try again.