bigcommerce 0.10.0 → 1.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.rubocop.yml +620 -0
- data/.travis.yml +15 -0
- data/CHANGELOG.md +11 -0
- data/CONTRIBUTING.md +119 -0
- data/DEPENDENCIES.md +7 -0
- data/Gemfile +15 -0
- data/Guardfile +22 -0
- data/LICENSE +15 -15
- data/README.md +61 -70
- data/RELEASING.md +64 -0
- data/Rakefile +8 -6
- data/bigcommerce.gemspec +22 -53
- data/examples/README.md +148 -0
- data/examples/configuration/legacy_auth.rb +12 -0
- data/examples/configuration/oauth.rb +9 -0
- data/examples/content/blog_post.rb +39 -0
- data/examples/content/blog_tag.rb +10 -0
- data/examples/content/redirect.rb +43 -0
- data/examples/customers/customer.rb +36 -0
- data/examples/customers/customer_address.rb +50 -0
- data/examples/customers/customer_group.rb +35 -0
- data/examples/exception_handling.rb +50 -0
- data/examples/geography/country.rb +16 -0
- data/examples/geography/state.rb +19 -0
- data/examples/marketing/coupon.rb +44 -0
- data/examples/orders/order.rb +53 -0
- data/examples/orders/order_coupon.rb +17 -0
- data/examples/orders/order_message.rb +17 -0
- data/examples/orders/order_product.rb +23 -0
- data/examples/orders/order_shipping_address.rb +23 -0
- data/examples/orders/order_status.rb +15 -0
- data/examples/orders/order_tax.rb +17 -0
- data/examples/orders/shipment.rb +57 -0
- data/examples/payments/payment_method.rb +10 -0
- data/examples/products/brand.rb +36 -0
- data/examples/products/bulk_pricing_rule.rb +47 -0
- data/examples/products/category.rb +37 -0
- data/examples/products/configurable_field.rb +29 -0
- data/examples/products/custom_field.rb +44 -0
- data/examples/products/google_product_search_mapping.rb +12 -0
- data/examples/products/option.rb +37 -0
- data/examples/products/option_set.rb +35 -0
- data/examples/products/option_set_option.rb +50 -0
- data/examples/products/option_value.rb +43 -0
- data/examples/products/product.rb +44 -0
- data/examples/products/product_image.rb +42 -0
- data/examples/products/product_option.rb +17 -0
- data/examples/products/product_review.rb +12 -0
- data/examples/products/product_rule.rb +54 -0
- data/examples/products/product_video.rb +45 -0
- data/examples/products/sku.rb +48 -0
- data/examples/shipping/shipping_method.rb +13 -0
- data/examples/store/store_info.rb +10 -0
- data/examples/system/time.rb +10 -0
- data/examples/tax/tax_class.rb +13 -0
- data/examples/webhooks/webhook.rb +29 -0
- data/lib/bigcommerce.rb +50 -8
- data/lib/bigcommerce/exception.rb +51 -0
- data/lib/bigcommerce/middleware/auth.rb +16 -0
- data/lib/bigcommerce/middleware/http_exception.rb +14 -0
- data/lib/bigcommerce/request.rb +89 -0
- data/lib/bigcommerce/resource_actions.rb +51 -0
- data/lib/bigcommerce/resources/content/blog_post.rb +31 -0
- data/lib/bigcommerce/resources/content/blog_tag.rb +17 -0
- data/lib/bigcommerce/resources/content/redirect.rb +21 -0
- data/lib/bigcommerce/resources/customers/customer.rb +30 -0
- data/lib/bigcommerce/resources/customers/customer_address.rb +34 -0
- data/lib/bigcommerce/resources/customers/customer_group.rb +21 -0
- data/lib/bigcommerce/resources/geography/country.rb +22 -0
- data/lib/bigcommerce/resources/geography/state.rb +25 -0
- data/lib/bigcommerce/resources/marketing/coupon.rb +30 -0
- data/lib/bigcommerce/resources/orders/order.rb +73 -0
- data/lib/bigcommerce/resources/orders/order_coupon.rb +20 -0
- data/lib/bigcommerce/resources/orders/order_message.rb +23 -0
- data/lib/bigcommerce/resources/orders/order_product.rb +64 -0
- data/lib/bigcommerce/resources/orders/order_shipping_address.rb +50 -0
- data/lib/bigcommerce/resources/orders/order_status.rb +16 -0
- data/lib/bigcommerce/resources/orders/order_tax.rb +23 -0
- data/lib/bigcommerce/resources/orders/shipment.rb +30 -0
- data/lib/bigcommerce/resources/payments/payment_method.rb +17 -0
- data/lib/bigcommerce/resources/products/brand.rb +23 -0
- data/lib/bigcommerce/resources/products/bulk_pricing_rule.rb +26 -0
- data/lib/bigcommerce/resources/products/category.rb +29 -0
- data/lib/bigcommerce/resources/products/configurable_field.rb +30 -0
- data/lib/bigcommerce/resources/products/custom_field.rb +24 -0
- data/lib/bigcommerce/resources/products/google_product_search_mapping.rb +26 -0
- data/lib/bigcommerce/resources/products/option.rb +20 -0
- data/lib/bigcommerce/resources/products/option_set.rb +18 -0
- data/lib/bigcommerce/resources/products/option_set_option.rb +19 -0
- data/lib/bigcommerce/resources/products/option_value.rb +15 -0
- data/lib/bigcommerce/resources/products/product.rb +97 -0
- data/lib/bigcommerce/resources/products/product_image.rb +31 -0
- data/lib/bigcommerce/resources/products/product_option.rb +17 -0
- data/lib/bigcommerce/resources/products/product_review.rb +22 -0
- data/lib/bigcommerce/resources/products/product_rule.rb +31 -0
- data/lib/bigcommerce/resources/products/product_video.rb +24 -0
- data/lib/bigcommerce/resources/products/sku.rb +29 -0
- data/lib/bigcommerce/resources/resource.rb +10 -0
- data/lib/bigcommerce/resources/shipping/shipping_method.rb +15 -0
- data/lib/bigcommerce/resources/store/store_information.rb +37 -0
- data/lib/bigcommerce/resources/system/time.rb +15 -0
- data/lib/bigcommerce/resources/tax/tax_class.rb +15 -0
- data/lib/bigcommerce/resources/webhooks/webhook.rb +22 -0
- data/lib/bigcommerce/subresource_actions.rb +43 -0
- data/lib/bigcommerce/version.rb +1 -4
- data/spec/bigcommerce/bigcommerce_spec.rb +76 -0
- data/spec/bigcommerce/unit/actions_spec.rb +151 -0
- data/spec/bigcommerce/unit/exception_spec.rb +53 -0
- data/spec/bigcommerce/unit/middleware/auth_spec.rb +18 -0
- data/spec/bigcommerce/unit/middleware/http_exception_spec.rb +40 -0
- data/spec/bigcommerce/unit/request_spec.rb +180 -0
- data/spec/bigcommerce/unit/resources/content/blog_post_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/content/blog_tag_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/content/redirect_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/customers/customer_address_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/customers/customer_group_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/customers/customer_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/geography/country_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/geography/state_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/marketing/coupon_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/orders/order_product_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/orders/order_shipping_address_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/orders/order_spec.rb +13 -0
- data/spec/bigcommerce/unit/resources/orders/shipment_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/payments/payment_method_spec.rb +23 -0
- data/spec/bigcommerce/unit/resources/products/brand_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/products/bulk_pricing_rule_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/category_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/products/configurable_field_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/custom_field_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/google_product_search_mapping_spec.rb +14 -0
- data/spec/bigcommerce/unit/resources/products/option_set_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/products/option_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/products/product_image_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/product_review_spec.rb +14 -0
- data/spec/bigcommerce/unit/resources/products/product_rule_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/product_spec.rb +13 -0
- data/spec/bigcommerce/unit/resources/products/product_video_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/sku_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/resource_spec.rb +4 -0
- data/spec/bigcommerce/unit/resources/store_info/store_information_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/system/time_spec.rb +12 -0
- data/spec/bigcommerce/unit/version_spec.rb +7 -0
- data/spec/spec_helper.rb +9 -25
- metadata +203 -127
- data/lib/big_commerce.rb +0 -1
- data/lib/bigcommerce/api.rb +0 -473
- data/lib/bigcommerce/connection.rb +0 -171
- data/lib/bigcommerce/product.rb +0 -13
- data/lib/bigcommerce/resource.rb +0 -50
- data/spec/big_commerce_spec.rb +0 -9
- data/spec/integration/orders_spec.rb +0 -18
- data/spec/support/integration_context.rb +0 -13
- data/spec/support/mock_api_context.rb +0 -10
- data/spec/unit/api_request_spec.rb +0 -34
- data/spec/unit/api_spec.rb +0 -49
- data/spec/unit/connection_spec.rb +0 -23
- data/spec/unit/date_time_spec.rb +0 -31
- data/spec/unit/version_spec.rb +0 -13
data/lib/big_commerce.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
raise "'big_commerce' (BigCommerce::Api) is no longer supported. Please require 'bigcommerce' (Bigcommerce::Api)"
|
data/lib/bigcommerce/api.rb
DELETED
@@ -1,473 +0,0 @@
|
|
1
|
-
require 'date'
|
2
|
-
require 'ostruct'
|
3
|
-
|
4
|
-
module Bigcommerce
|
5
|
-
class Api
|
6
|
-
|
7
|
-
attr_reader :page
|
8
|
-
|
9
|
-
def initialize(configuration={})
|
10
|
-
@connection = Connection.new(configuration)
|
11
|
-
end
|
12
|
-
|
13
|
-
def connection
|
14
|
-
@connection
|
15
|
-
end
|
16
|
-
|
17
|
-
def store_url=(store_url)
|
18
|
-
@connection.store_url = store_url
|
19
|
-
end
|
20
|
-
|
21
|
-
def username=(username)
|
22
|
-
@connection.username = username
|
23
|
-
end
|
24
|
-
|
25
|
-
def api_key=(api_key)
|
26
|
-
@connection.api_key = api_key
|
27
|
-
end
|
28
|
-
|
29
|
-
def verify_ssl=(verify)
|
30
|
-
@connection.verify_ssl = verify
|
31
|
-
end
|
32
|
-
|
33
|
-
def ca_file=(path)
|
34
|
-
@connection.ca_file = path
|
35
|
-
end
|
36
|
-
|
37
|
-
def to_rfc2822(datetime)
|
38
|
-
datetime.strftime("%a, %d %b %Y %H:%M:%S %z")
|
39
|
-
end
|
40
|
-
|
41
|
-
def time
|
42
|
-
@connection.get '/time'
|
43
|
-
end
|
44
|
-
|
45
|
-
def store_information
|
46
|
-
@connection.get '/store'
|
47
|
-
end
|
48
|
-
|
49
|
-
def brands(options={})
|
50
|
-
@connection.get("/brands", options)
|
51
|
-
end
|
52
|
-
|
53
|
-
def brands_count
|
54
|
-
@connection.get '/brands/count'
|
55
|
-
end
|
56
|
-
|
57
|
-
def brand(id)
|
58
|
-
@connection.get("/brands/#{id}", {})
|
59
|
-
end
|
60
|
-
|
61
|
-
def create_brands(options={})
|
62
|
-
@connection.post("/brands", options)
|
63
|
-
end
|
64
|
-
|
65
|
-
def update_brand(id, options={})
|
66
|
-
@connection.put("/brands/#{id}", options)
|
67
|
-
end
|
68
|
-
|
69
|
-
def delete_brand(id)
|
70
|
-
@connection.delete("/brands/#{id}")
|
71
|
-
end
|
72
|
-
|
73
|
-
def coupons(options={})
|
74
|
-
@connection.get("/coupons", options)
|
75
|
-
end
|
76
|
-
|
77
|
-
def create_coupons(options={})
|
78
|
-
@connection.post("/coupons", options)
|
79
|
-
end
|
80
|
-
|
81
|
-
def update_coupon(id, options={})
|
82
|
-
@connection.put("/coupons/#{id}", options)
|
83
|
-
end
|
84
|
-
|
85
|
-
def categories(options={})
|
86
|
-
@connection.get("/categories", options)
|
87
|
-
end
|
88
|
-
|
89
|
-
def categories_count
|
90
|
-
@connection.get '/categories/count'
|
91
|
-
end
|
92
|
-
|
93
|
-
def category(id)
|
94
|
-
@connection.get("/categories/#{id}", {})
|
95
|
-
end
|
96
|
-
|
97
|
-
def create_categories(options={})
|
98
|
-
@connection.post("/categories", options)
|
99
|
-
end
|
100
|
-
|
101
|
-
def update_category(id, options={})
|
102
|
-
@connection.put("/categories/#{id}", options)
|
103
|
-
end
|
104
|
-
|
105
|
-
def delete_category(id)
|
106
|
-
@connection.delete("/categories/#{id}")
|
107
|
-
end
|
108
|
-
|
109
|
-
def countries(options={})
|
110
|
-
@connection.get("/countries", options)
|
111
|
-
end
|
112
|
-
|
113
|
-
def country(id)
|
114
|
-
@connection.get("/countries/#{id}", {})
|
115
|
-
end
|
116
|
-
|
117
|
-
def countries_states(options={})
|
118
|
-
@connection.get("/countries/states", options)
|
119
|
-
end
|
120
|
-
|
121
|
-
def countries_state(id, options={})
|
122
|
-
@connection.get("/countries/#{id}/states", {})
|
123
|
-
end
|
124
|
-
|
125
|
-
def customers(options = {})
|
126
|
-
@connection.get("/customers", options)
|
127
|
-
end
|
128
|
-
|
129
|
-
def customer(id)
|
130
|
-
@connection.get('/customers/' + id.to_s, {})
|
131
|
-
end
|
132
|
-
|
133
|
-
def customer_addresses(id, options = {})
|
134
|
-
@connection.get("/customers/#{id}/addresses", options)
|
135
|
-
end
|
136
|
-
|
137
|
-
def customer_address(customer_id, address_id)
|
138
|
-
@connection.get("/customers/#{customer_id}/addresses/#{address_id}",{})
|
139
|
-
end
|
140
|
-
|
141
|
-
def options(options={})
|
142
|
-
@connection.get("/options", options)
|
143
|
-
end
|
144
|
-
|
145
|
-
def options_count
|
146
|
-
@connection.get '/options/count'
|
147
|
-
end
|
148
|
-
|
149
|
-
def option(id)
|
150
|
-
@connection.get("/options/#{id}",{})
|
151
|
-
end
|
152
|
-
|
153
|
-
def create_option(options={})
|
154
|
-
@connection.post("/options", options)
|
155
|
-
end
|
156
|
-
|
157
|
-
def update_option(id, options={})
|
158
|
-
@connection.put("/options/#{id}", options)
|
159
|
-
end
|
160
|
-
|
161
|
-
def delete_option(id)
|
162
|
-
@connection.delete("/options/#{id}")
|
163
|
-
end
|
164
|
-
|
165
|
-
def options_values(options={})
|
166
|
-
@connection.get("/options/values", options)
|
167
|
-
end
|
168
|
-
|
169
|
-
def options_value(id, options={})
|
170
|
-
@connection.get("/options/#{id}/values", options)
|
171
|
-
end
|
172
|
-
|
173
|
-
def create_options_values(options_id, options={})
|
174
|
-
@connection.post("/options/#{options_id}/values", options)
|
175
|
-
end
|
176
|
-
|
177
|
-
def update_options_value(options_id, values_id, options={})
|
178
|
-
@connection.put("/options/#{options_id}/values/#{values_id}", options)
|
179
|
-
end
|
180
|
-
|
181
|
-
def optionsets(options={})
|
182
|
-
@connection.get("/optionsets", options)
|
183
|
-
end
|
184
|
-
|
185
|
-
def optionsets_count
|
186
|
-
@connection.get '/optionsets/count'
|
187
|
-
end
|
188
|
-
|
189
|
-
def optionset(id)
|
190
|
-
@connection.get("/optionsets/#{id}", {})
|
191
|
-
end
|
192
|
-
|
193
|
-
def create_optionset(options={})
|
194
|
-
@connection.post("/optionsets", options)
|
195
|
-
end
|
196
|
-
|
197
|
-
def update_optionset(id, options={})
|
198
|
-
@connection.put("/optionsets/#{id}", options)
|
199
|
-
end
|
200
|
-
|
201
|
-
def delete_optionset(id)
|
202
|
-
@connection.delete("/optionsets/#{id}")
|
203
|
-
end
|
204
|
-
|
205
|
-
def optionsets_options(options={})
|
206
|
-
@connection.get("/optionsets/options", options)
|
207
|
-
end
|
208
|
-
|
209
|
-
def optionset_options(id)
|
210
|
-
@connection.get("/optionsets/#{id}/options", {})
|
211
|
-
end
|
212
|
-
|
213
|
-
def optionsets_option(id)
|
214
|
-
@connection.get("/optionsets/options/#{id}", {})
|
215
|
-
end
|
216
|
-
|
217
|
-
def create_optionset_option(id, options={})
|
218
|
-
@connection.post("/optionsets/#{id}/options", options)
|
219
|
-
end
|
220
|
-
|
221
|
-
def update_optionset_option(optionset_id, option_id, options={})
|
222
|
-
@connection.put("/optionsets/#{optionset_id}/options/#{option_id}", options)
|
223
|
-
end
|
224
|
-
|
225
|
-
def orders(options={})
|
226
|
-
@connection.get("/orders", options)
|
227
|
-
end
|
228
|
-
|
229
|
-
def orders_by_date(date, options={})
|
230
|
-
if date.is_a?(String)
|
231
|
-
date = DateTime.parse(date)
|
232
|
-
end
|
233
|
-
@connection.get('/orders', options.merge!(:min_date_created => to_rfc2822(date)))
|
234
|
-
end
|
235
|
-
|
236
|
-
def orders_modified_since(date)
|
237
|
-
@connection.get('/orders', {}, {'If-Modified-Since' => to_rfc2822(date)})
|
238
|
-
end
|
239
|
-
|
240
|
-
def order(id,options={})
|
241
|
-
@connection.get("/orders/#{id}", options)
|
242
|
-
end
|
243
|
-
|
244
|
-
def update_order(id,options={})
|
245
|
-
@connection.put("/orders/#{id}", options)
|
246
|
-
end
|
247
|
-
|
248
|
-
def orders_coupons(id,options={})
|
249
|
-
@connection.get("/orders/#{id}/coupons", options)
|
250
|
-
end
|
251
|
-
|
252
|
-
def orders_coupon(order_id,coupon_id,options={})
|
253
|
-
@connection.get("/orders/#{order_id}/coupons/#{coupon_id}", options)
|
254
|
-
end
|
255
|
-
|
256
|
-
def orders_products(id,options={})
|
257
|
-
@connection.get("/orders/#{id}/products", options)
|
258
|
-
end
|
259
|
-
|
260
|
-
def orders_product(order_id,product_id,options={})
|
261
|
-
@connection.get("/orders/#{order_id}/products/#{product_id}", options)
|
262
|
-
end
|
263
|
-
|
264
|
-
def orders_shipments(id,options={})
|
265
|
-
@connection.get("/orders/#{id}/shipments", options)
|
266
|
-
end
|
267
|
-
|
268
|
-
def create_orders_shipments(id, options={})
|
269
|
-
@connection.post("/orders/#{id}/shipments", options)
|
270
|
-
end
|
271
|
-
|
272
|
-
def orders_shipment(order_id,shipment_id,options={})
|
273
|
-
@connection.get("/orders/#{order_id}/shipments/#{shipment_id}", options)
|
274
|
-
end
|
275
|
-
|
276
|
-
def update_orders_shipment(order_id,shipment_id,options={})
|
277
|
-
@connection.put("/orders/#{order_id}/shipments/#{shipment_id}", options)
|
278
|
-
end
|
279
|
-
|
280
|
-
def orders_shippingaddresses(id,options={})
|
281
|
-
@connection.get("/orders/#{id}/shippingaddresses", options)
|
282
|
-
end
|
283
|
-
|
284
|
-
def orders_shippingaddress(order_id,shippingaddress_id,options={})
|
285
|
-
@connection.get("/orders/#{order_id}/shippingaddresses/#{shippingaddress_id}", options)
|
286
|
-
end
|
287
|
-
|
288
|
-
def orderstatuses(options={})
|
289
|
-
@connection.get("/orderstatuses", options)
|
290
|
-
end
|
291
|
-
|
292
|
-
def orderstatus(id,options={})
|
293
|
-
@connection.get("/orderstatuses/#{id}", options)
|
294
|
-
end
|
295
|
-
|
296
|
-
def products(options={})
|
297
|
-
@connection.get("/products", options)
|
298
|
-
end
|
299
|
-
|
300
|
-
def products_count
|
301
|
-
@connection.get '/products/count'
|
302
|
-
end
|
303
|
-
|
304
|
-
def product(id,options={})
|
305
|
-
@connection.get("/products/#{id}", options)
|
306
|
-
end
|
307
|
-
|
308
|
-
def create_products(options={})
|
309
|
-
@connection.post('/products', options)
|
310
|
-
end
|
311
|
-
|
312
|
-
def update_products(id, options={})
|
313
|
-
@connection.put("/products/#{id}", options)
|
314
|
-
end
|
315
|
-
|
316
|
-
def delete_products(id)
|
317
|
-
@connection.delete("/products/#{id}")
|
318
|
-
end
|
319
|
-
|
320
|
-
def products_discountrules(options={})
|
321
|
-
@connection.get("/products/discountrules", options)
|
322
|
-
end
|
323
|
-
|
324
|
-
def product_discountrules(product_id, options={})
|
325
|
-
@connection.get("/products/#{product_id}/discountrules", options)
|
326
|
-
end
|
327
|
-
|
328
|
-
def products_discountrule(product_id, discountrule_id,options={})
|
329
|
-
@connection.get("/products/#{product_id}/discountrules/#{discountrule_id}", options)
|
330
|
-
end
|
331
|
-
|
332
|
-
def products_configurablefields(options={})
|
333
|
-
@connection.get("/products/configurablefields", options)
|
334
|
-
end
|
335
|
-
|
336
|
-
def product_configurablefields(product_id, options={})
|
337
|
-
@connection.get("/products/#{product_id}/configurablefields", options)
|
338
|
-
end
|
339
|
-
|
340
|
-
def products_configurablefield(product_id, configurable_field_id, options={})
|
341
|
-
@connection.get("/products/#{product_id}/configurablefields/#{configurable_field_id}", options)
|
342
|
-
end
|
343
|
-
|
344
|
-
def products_customfields(options={})
|
345
|
-
@connection.get("/products/customfields", options)
|
346
|
-
end
|
347
|
-
|
348
|
-
def product_customfields(product_id, options={})
|
349
|
-
@connection.get("/products/#{product_id}/customfields", options)
|
350
|
-
end
|
351
|
-
|
352
|
-
def create_product_customfield(product_id, options={})
|
353
|
-
@connection.post("/products/#{product_id}/customfields", options)
|
354
|
-
end
|
355
|
-
|
356
|
-
def update_product_customfield(product_id, custom_field_id, options={})
|
357
|
-
@connection.put("/products/#{product_id}/customfields/#{custom_field_id}", options)
|
358
|
-
end
|
359
|
-
|
360
|
-
def delete_product_customfield(product_id, custom_field_id)
|
361
|
-
@connection.delete("/products/#{product_id}/customfields/#{custom_field_id}")
|
362
|
-
end
|
363
|
-
|
364
|
-
def delete_product_customfields(product_id)
|
365
|
-
@connection.delete("/products/#{product_id}/customfields")
|
366
|
-
end
|
367
|
-
|
368
|
-
def products_customfield(product_id, custom_field_id, options={})
|
369
|
-
@connection.get("/products/#{product_id}/customfields/#{custom_field_id}", options)
|
370
|
-
end
|
371
|
-
|
372
|
-
def product_images(product_id, options={})
|
373
|
-
@connection.get("/products/#{product_id}/images", options)
|
374
|
-
end
|
375
|
-
|
376
|
-
def create_product_images(product_id, options={})
|
377
|
-
@connection.post("/products/#{product_id}/images", options)
|
378
|
-
end
|
379
|
-
|
380
|
-
def create_products_images(options={})
|
381
|
-
@connection.post("/products/images", options)
|
382
|
-
end
|
383
|
-
|
384
|
-
def products_image(product_id, image_id, options={})
|
385
|
-
@connection.get("/products/#{product_id}/images/#{image_id}", options)
|
386
|
-
end
|
387
|
-
|
388
|
-
def update_products_image(product_id,image_id,options={})
|
389
|
-
@connection.put("/products/#{product_id}/images/#{image_id}", options)
|
390
|
-
end
|
391
|
-
|
392
|
-
def product_options(product_id, options={})
|
393
|
-
@connection.get("/products/#{product_id}/options", options)
|
394
|
-
end
|
395
|
-
|
396
|
-
def products_option(product_id,option_id, options={})
|
397
|
-
@connection.get("/products/#{product_id}/options/#{option_id}", options)
|
398
|
-
end
|
399
|
-
|
400
|
-
def product_rules(product_id, options={})
|
401
|
-
@connection.get("/products/#{product_id}/rules", options)
|
402
|
-
end
|
403
|
-
|
404
|
-
def create_products_rules(options={})
|
405
|
-
@connection.post("/products/rules", options)
|
406
|
-
end
|
407
|
-
|
408
|
-
def products_rule(product_id,rule_id,options={})
|
409
|
-
@connection.get("/products/#{product_id}/rules/#{rule_id}", options)
|
410
|
-
end
|
411
|
-
|
412
|
-
def update_products_rule(product_id, rule_id, options={})
|
413
|
-
@connection.put("/products/#{product_id}/rules/#{rule_id}", options)
|
414
|
-
end
|
415
|
-
|
416
|
-
def product_skus(product_id, options={})
|
417
|
-
@connection.get("/products/#{product_id}/skus", options)
|
418
|
-
end
|
419
|
-
|
420
|
-
def create_products_skus(options={})
|
421
|
-
@connection.post("/products/skus", options)
|
422
|
-
end
|
423
|
-
|
424
|
-
def products_sku(product_id, sku_id, options={})
|
425
|
-
@connection.get("/products/#{product_id}/skus/#{sku_id}", options)
|
426
|
-
end
|
427
|
-
|
428
|
-
def update_products_sku(product_id, sku_id, options={})
|
429
|
-
@connection.put("/products/#{product_id}/skus/#{sku_id}", options)
|
430
|
-
end
|
431
|
-
|
432
|
-
def product_videos(product_id, options={})
|
433
|
-
@connection.get("/products/#{product_id}/videos", options)
|
434
|
-
end
|
435
|
-
|
436
|
-
def products_video(product_id, video_id, options={})
|
437
|
-
@connection.get("/products/#{product_id}/videos/#{video_id}", options)
|
438
|
-
end
|
439
|
-
|
440
|
-
def count(result)
|
441
|
-
result["count"]
|
442
|
-
end
|
443
|
-
|
444
|
-
def collection(resource_path, options={})
|
445
|
-
if (options["resource_class"])
|
446
|
-
klass = options["resource_class"]
|
447
|
-
else
|
448
|
-
klass = Resource
|
449
|
-
end
|
450
|
-
Enumerator.new do |yielder|
|
451
|
-
count = -1
|
452
|
-
if options[:starting_page]
|
453
|
-
@page = options[:starting_page]
|
454
|
-
else
|
455
|
-
@page = 1
|
456
|
-
end
|
457
|
-
until count == 0
|
458
|
-
buffer = @connection.get(resource_path, {page: page})
|
459
|
-
count = buffer.count
|
460
|
-
buffer.each do |item|
|
461
|
-
yielder << klass.new(item, @connection)
|
462
|
-
p @connection.remaining_rate_limit
|
463
|
-
end
|
464
|
-
@page += 1
|
465
|
-
end
|
466
|
-
end
|
467
|
-
end
|
468
|
-
|
469
|
-
def resource(result)
|
470
|
-
result
|
471
|
-
end
|
472
|
-
end
|
473
|
-
end
|