Class: BigcommerceTest::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/bigcommerce_test/api.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration = {}) ⇒ Api

Returns a new instance of Api.



4
5
6
# File 'lib/bigcommerce_test/api.rb', line 4

def initialize(configuration={})
  @connection = Connection.new(configuration)
end

Instance Method Details

#api_key=(api_key) ⇒ Object



20
21
22
# File 'lib/bigcommerce_test/api.rb', line 20

def api_key=(api_key)
  @connection.api_key = api_key
end

#ca_file=(path) ⇒ Object



28
29
30
# File 'lib/bigcommerce_test/api.rb', line 28

def ca_file=(path)
  @connection.ca_file = path
end

#connectionObject



8
9
10
# File 'lib/bigcommerce_test/api.rb', line 8

def connection
  @connection
end

#create_brands(options = {}) ⇒ Object



52
53
54
# File 'lib/bigcommerce_test/api.rb', line 52

def create_brands(options={})
   @connection.post("/brands", options)
end

#create_categories(options = {}) ⇒ Object



92
93
94
# File 'lib/bigcommerce_test/api.rb', line 92

def create_categories(options={})
   @connection.post("/categories", options)
end

#create_coupons(options = {}) ⇒ Object



72
73
74
# File 'lib/bigcommerce_test/api.rb', line 72

def create_coupons(options={})
   @connection.post("/coupons", options)
end

#create_option(options = {}) ⇒ Object



152
153
154
# File 'lib/bigcommerce_test/api.rb', line 152

def create_option(options={})
  @connection.post("/options", options)
end

#create_options_values(options_id, options = {}) ⇒ Object



172
173
174
# File 'lib/bigcommerce_test/api.rb', line 172

def create_options_values(options_id, options={})
  @connection.post("/options/#{options_id}/values", options)
end

#create_optionset(options = {}) ⇒ Object



192
193
194
# File 'lib/bigcommerce_test/api.rb', line 192

def create_optionset(options={})
  @connection.post("/optionsets", options)
end

#create_optionset_option(id, options = {}) ⇒ Object



216
217
218
# File 'lib/bigcommerce_test/api.rb', line 216

def create_optionset_option(id, options={})
  @connection.post("/optionsets/#{id}/options", options)
end

#create_orders_shipments(id) ⇒ Object



267
268
269
# File 'lib/bigcommerce_test/api.rb', line 267

def create_orders_shipments(id)
  @connection.post("/orders/#{id}/shipments", {})
end

#create_product_images(product_id, options = {}) ⇒ Object



359
360
361
# File 'lib/bigcommerce_test/api.rb', line 359

def create_product_images(product_id, options={})
  @connection.post("/products/#{product_id}/images", options)
end

#create_products(options = {}) ⇒ Object



307
308
309
# File 'lib/bigcommerce_test/api.rb', line 307

def create_products(options={})
  @connection.post('/products', options)
end

#create_products_images(options = {}) ⇒ Object



367
368
369
# File 'lib/bigcommerce_test/api.rb', line 367

def create_products_images(options={})
  @connection.post("/products/images", options)
end

#create_products_rules(options = {}) ⇒ Object



399
400
401
# File 'lib/bigcommerce_test/api.rb', line 399

def create_products_rules(options={})
  @connection.post("/products/rules", options)
end

#create_products_skus(options = {}) ⇒ Object



419
420
421
# File 'lib/bigcommerce_test/api.rb', line 419

def create_products_skus(options={})
  @connection.post("/products/skus", options)
end

#delete_brand(id) ⇒ Object



60
61
62
# File 'lib/bigcommerce_test/api.rb', line 60

def delete_brand(id)
   @connection.delete("/brands/#{id}")
end

#delete_brandsObject



64
65
66
# File 'lib/bigcommerce_test/api.rb', line 64

def delete_brands()
   @connection.delete("/brands")
end

#delete_categoriesObject



104
105
106
# File 'lib/bigcommerce_test/api.rb', line 104

def delete_categories()
   @connection.delete("/categories")
end

#delete_category(id) ⇒ Object



100
101
102
# File 'lib/bigcommerce_test/api.rb', line 100

def delete_category(id)
   @connection.delete("/categories/#{id}")
end

#delete_option(id) ⇒ Object



160
161
162
# File 'lib/bigcommerce_test/api.rb', line 160

def delete_option(id)
  @connection.delete("/options/#{id}")
end

#delete_optionset(id) ⇒ Object



200
201
202
# File 'lib/bigcommerce_test/api.rb', line 200

def delete_optionset(id)
  @connection.delete("/optionsets/#{id}")
end

#delete_productsObject



315
316
317
# File 'lib/bigcommerce_test/api.rb', line 315

def delete_products()
   @connection.delete("/products")
end

#get_brand(id) ⇒ Object



48
49
50
# File 'lib/bigcommerce_test/api.rb', line 48

def get_brand(id)
  @connection.get("/brands/#{id}", {})
end

#get_brands(options = {}) ⇒ Object



40
41
42
# File 'lib/bigcommerce_test/api.rb', line 40

def get_brands(options={})
  @connection.get("/brands", options)
end

#get_brands_countObject



44
45
46
# File 'lib/bigcommerce_test/api.rb', line 44

def get_brands_count
  @connection.get '/brands/count'
end

#get_categories(options = {}) ⇒ Object



80
81
82
# File 'lib/bigcommerce_test/api.rb', line 80

def get_categories(options={})
   @connection.get("/categories", options)
end

#get_categories_countObject



84
85
86
# File 'lib/bigcommerce_test/api.rb', line 84

def get_categories_count
  @connection.get '/categories/count'
end

#get_category(id) ⇒ Object



88
89
90
# File 'lib/bigcommerce_test/api.rb', line 88

def get_category(id)
  @connection.get("/categories/#{id}", {})
end

#get_countries(options = {}) ⇒ Object



108
109
110
# File 'lib/bigcommerce_test/api.rb', line 108

def get_countries(options={})
  @connection.get("/countries", options)
end

#get_countries_state(id, options = {}) ⇒ Object



120
121
122
# File 'lib/bigcommerce_test/api.rb', line 120

def get_countries_state(id, options={})
  @connection.get("/countries/#{id}/states", {})
end

#get_countries_states(options = {}) ⇒ Object



116
117
118
# File 'lib/bigcommerce_test/api.rb', line 116

def get_countries_states(options={})
  @connection.get("/countries/states", options)
end

#get_country(id) ⇒ Object



112
113
114
# File 'lib/bigcommerce_test/api.rb', line 112

def get_country(id)
  @connection.get("/countries/#{id}", {})
end

#get_coupons(options = {}) ⇒ Object



68
69
70
# File 'lib/bigcommerce_test/api.rb', line 68

def get_coupons(options={})
  @connection.get("/coupons", options)
end

#get_customer(id) ⇒ Object



128
129
130
# File 'lib/bigcommerce_test/api.rb', line 128

def get_customer(id)
  @connection.get('/customers/' + id.to_s, {})
end

#get_customer_address(customer_id, address_id) ⇒ Object



136
137
138
# File 'lib/bigcommerce_test/api.rb', line 136

def get_customer_address(customer_id, address_id)
  @connection.get("/customers/#{customer_id}/addresses/#{address_id}",{})
end

#get_customer_addresses(id, options = {}) ⇒ Object



132
133
134
# File 'lib/bigcommerce_test/api.rb', line 132

def get_customer_addresses(id, options = {})
  @connection.get("/customers/#{id}/addresses", options)
end

#get_customers(options = {}) ⇒ Object



124
125
126
# File 'lib/bigcommerce_test/api.rb', line 124

def get_customers(options = {})
  @connection.get("/customers", options)
end

#get_option(id) ⇒ Object



148
149
150
# File 'lib/bigcommerce_test/api.rb', line 148

def get_option(id)
  @connection.get("/options/#{id}",{})
end

#get_options(options = {}) ⇒ Object



140
141
142
# File 'lib/bigcommerce_test/api.rb', line 140

def get_options(options={})
   @connection.get("/options", options)
end

#get_options_countObject



144
145
146
# File 'lib/bigcommerce_test/api.rb', line 144

def get_options_count
   @connection.get '/options/count'
end

#get_options_value(id) ⇒ Object



168
169
170
# File 'lib/bigcommerce_test/api.rb', line 168

def get_options_value(id)
  @connection.get("/options/#{id}/values",{})
end

#get_options_values(options = {}) ⇒ Object



164
165
166
# File 'lib/bigcommerce_test/api.rb', line 164

def get_options_values(options={})
   @connection.get("/options/values", options)
end

#get_optionset(id) ⇒ Object



188
189
190
# File 'lib/bigcommerce_test/api.rb', line 188

def get_optionset(id)
  @connection.get("/optionsets/#{id}", {})
end

#get_optionset_options(id) ⇒ Object



208
209
210
# File 'lib/bigcommerce_test/api.rb', line 208

def get_optionset_options(id)
  @connection.get("/optionsets/#{id}/options", {})
end

#get_optionsets(options = {}) ⇒ Object



180
181
182
# File 'lib/bigcommerce_test/api.rb', line 180

def get_optionsets(options={})
   @connection.get("/optionsets", options)
end

#get_optionsets_countObject



184
185
186
# File 'lib/bigcommerce_test/api.rb', line 184

def get_optionsets_count
   @connection.get '/optionsets/count'
end

#get_optionsets_option(id) ⇒ Object



212
213
214
# File 'lib/bigcommerce_test/api.rb', line 212

def get_optionsets_option(id)
  @connection.get("/optionsets/options/#{id}", {})
end

#get_optionsets_options(options = {}) ⇒ Object



204
205
206
# File 'lib/bigcommerce_test/api.rb', line 204

def get_optionsets_options(options={})
   @connection.get("/optionsets/options", options)
end

#get_order(id) ⇒ Object



239
240
241
# File 'lib/bigcommerce_test/api.rb', line 239

def get_order(id)
  @connection.get("/orders/#{id}", {})
end

#get_orders(options = {}) ⇒ Object



224
225
226
# File 'lib/bigcommerce_test/api.rb', line 224

def get_orders(options={})
  @connection.get("/orders", options)
end

#get_orders_by_date(date, options = {}) ⇒ Object



228
229
230
231
232
233
# File 'lib/bigcommerce_test/api.rb', line 228

def get_orders_by_date(date, options={})
  if date.is_a?(String)
    date = DateTime.parse(date)
  end
  @connection.get('/orders', options.merge!(:min_date_created => to_rfc2822(date)))
end

#get_orders_coupon(order_id, coupon_id) ⇒ Object



251
252
253
# File 'lib/bigcommerce_test/api.rb', line 251

def get_orders_coupon(order_id,coupon_id)
  @connection.get("/orders/#{order_id}/coupons/#{coupon_id}", {})
end

#get_orders_coupons(id) ⇒ Object



247
248
249
# File 'lib/bigcommerce_test/api.rb', line 247

def get_orders_coupons(id)
  @connection.get("/orders/#{id}/coupons", {})
end

#get_orders_modified_since(date) ⇒ Object



235
236
237
# File 'lib/bigcommerce_test/api.rb', line 235

def get_orders_modified_since(date)
  @connection.get('/orders', {}, {'If-Modified-Since' => to_rfc2822(date)})
end

#get_orders_product(order_id, product_id) ⇒ Object



259
260
261
# File 'lib/bigcommerce_test/api.rb', line 259

def get_orders_product(order_id,product_id)
  @connection.get("/orders/#{order_id}/products/#{product_id}", {})
end

#get_orders_products(id) ⇒ Object



255
256
257
# File 'lib/bigcommerce_test/api.rb', line 255

def get_orders_products(id)
  @connection.get("/orders/#{id}/products", {})
end

#get_orders_shipment(order_id, shipment_id) ⇒ Object



271
272
273
# File 'lib/bigcommerce_test/api.rb', line 271

def get_orders_shipment(order_id,shipment_id)
  @connection.get("/orders/#{order_id}/shipments/#{shipment_id}", {})
end

#get_orders_shipments(id) ⇒ Object



263
264
265
# File 'lib/bigcommerce_test/api.rb', line 263

def get_orders_shipments(id)
  @connection.get("/orders/#{id}/shipments", {})
end

#get_orders_shippingaddress(order_id, shippingaddress_id) ⇒ Object



283
284
285
# File 'lib/bigcommerce_test/api.rb', line 283

def get_orders_shippingaddress(order_id,shippingaddress_id)
  @connection.get("/orders/#{order_id}/shippingaddresses/#{shippingaddress_id}", {})
end

#get_orders_shippingaddresses(id) ⇒ Object



279
280
281
# File 'lib/bigcommerce_test/api.rb', line 279

def get_orders_shippingaddresses(id)
  @connection.get("/orders/#{id}/shippingaddresses", {})
end

#get_orderstatus(id) ⇒ Object



291
292
293
# File 'lib/bigcommerce_test/api.rb', line 291

def get_orderstatus(id)
  @connection.get("/orderstatuses/#{id}", {})
end

#get_orderstatuses(options = {}) ⇒ Object



287
288
289
# File 'lib/bigcommerce_test/api.rb', line 287

def get_orderstatuses(options={})
  @connection.get("/orderstatuses", options)
end

#get_product(id) ⇒ Object



303
304
305
# File 'lib/bigcommerce_test/api.rb', line 303

def get_product(id)
  @connection.get("/products/#{id}", {})
end

#get_product_configurablefields(product_id, options = {}) ⇒ Object



335
336
337
# File 'lib/bigcommerce_test/api.rb', line 335

def get_product_configurablefields(product_id, options={})
  @connection.get("/products/#{product_id}/configurablefields", options)
end

#get_product_customfields(product_id, options = {}) ⇒ Object



347
348
349
# File 'lib/bigcommerce_test/api.rb', line 347

def get_product_customfields(product_id, options={})
  @connection.get("/products/#{product_id}/customfields", options)
end

#get_product_discountrules(product_id, options = {}) ⇒ Object



323
324
325
# File 'lib/bigcommerce_test/api.rb', line 323

def get_product_discountrules(product_id, options={})
  @connection.get("/products/#{product_id}/discountrules", options)
end

#get_product_images(product_id, options = {}) ⇒ Object



355
356
357
# File 'lib/bigcommerce_test/api.rb', line 355

def get_product_images(product_id, options={})
  @connection.get("/products/#{product_id}/images", options)
end

#get_product_options(product_id, options = {}) ⇒ Object



383
384
385
# File 'lib/bigcommerce_test/api.rb', line 383

def get_product_options(product_id, options={})
  @connection.get("/products/#{product_id}/options", options)
end

#get_product_rules(product_id, options = {}) ⇒ Object



395
396
397
# File 'lib/bigcommerce_test/api.rb', line 395

def get_product_rules(product_id, options={})
  @connection.get("/products/#{product_id}/rules", options)
end

#get_product_skus(product_id, options = {}) ⇒ Object



415
416
417
# File 'lib/bigcommerce_test/api.rb', line 415

def get_product_skus(product_id, options={})
  @connection.get("/products/#{product_id}/skus", options)
end

#get_product_videos(product_id, options = {}) ⇒ Object



435
436
437
# File 'lib/bigcommerce_test/api.rb', line 435

def get_product_videos(product_id, options={})
  @connection.get("/products/#{product_id}/videos", options)
end

#get_products(options = {}) ⇒ Object



295
296
297
# File 'lib/bigcommerce_test/api.rb', line 295

def get_products(options={})
  @connection.get("/products", options)
end

#get_products_configurablefield(product_id, configurable_field_id) ⇒ Object



339
340
341
# File 'lib/bigcommerce_test/api.rb', line 339

def get_products_configurablefield(product_id, configurable_field_id)
  @connection.get("/products/#{product_id}/configurablefields/#{configurable_field_id}", {})
end

#get_products_configurablefields(options = {}) ⇒ Object



331
332
333
# File 'lib/bigcommerce_test/api.rb', line 331

def get_products_configurablefields(options={})
  @connection.get("/products/configurablefields", options)
end

#get_products_countObject



299
300
301
# File 'lib/bigcommerce_test/api.rb', line 299

def get_products_count
  @connection.get '/products/count'
end

#get_products_customfield(product_id, custom_field_id) ⇒ Object



351
352
353
# File 'lib/bigcommerce_test/api.rb', line 351

def get_products_customfield(product_id, custom_field_id)
  @connection.get("/products/#{product_id}/customfields/#{custom_field_id}", {})
end

#get_products_customfields(options = {}) ⇒ Object



343
344
345
# File 'lib/bigcommerce_test/api.rb', line 343

def get_products_customfields(options={})
  @connection.get("/products/customfields", options)
end

#get_products_discountrule(product_id, discountrule_id) ⇒ Object



327
328
329
# File 'lib/bigcommerce_test/api.rb', line 327

def get_products_discountrule(product_id, discountrule_id)
  @connection.get("/products/#{product_id}/discountrules/#{discountrule_id}", {})
end

#get_products_discountrules(options = {}) ⇒ Object



319
320
321
# File 'lib/bigcommerce_test/api.rb', line 319

def get_products_discountrules(options={})
  @connection.get("/products/discountrules", options)
end

#get_products_image(product_id, image_id) ⇒ Object



371
372
373
# File 'lib/bigcommerce_test/api.rb', line 371

def get_products_image(product_id, image_id)
  @connection.get("/products/#{product_id}/images/#{image_id}", {})
end

#get_products_images(options = {}) ⇒ Object



363
364
365
# File 'lib/bigcommerce_test/api.rb', line 363

def get_products_images(options={})
  @connection.get("/products/images", options)
end

#get_products_option(product_id, option_id) ⇒ Object



387
388
389
# File 'lib/bigcommerce_test/api.rb', line 387

def get_products_option(product_id,option_id)
  @connection.get("/products/#{product_id}/options/#{option_id}", {})
end

#get_products_rule(product_id, rule_id) ⇒ Object



403
404
405
# File 'lib/bigcommerce_test/api.rb', line 403

def get_products_rule(product_id,rule_id)
  @connection.get("/products/#{product_id}/rules/#{rule_id}", {})
end

#get_products_rules(options = {}) ⇒ Object



391
392
393
# File 'lib/bigcommerce_test/api.rb', line 391

def get_products_rules(options={})
  @connection.get("/products/rules", options)
end

#get_products_sku(product_id, sku_id) ⇒ Object



423
424
425
# File 'lib/bigcommerce_test/api.rb', line 423

def get_products_sku(product_id, sku_id)
  @connection.get("/products/#{product_id}/skus/#{sku_id}", {})
end

#get_products_skus(options = {}) ⇒ Object



411
412
413
# File 'lib/bigcommerce_test/api.rb', line 411

def get_products_skus(options={})
  @connection.get("/products/skus", options)
end

#get_products_video(product_id, video_id) ⇒ Object



439
440
441
# File 'lib/bigcommerce_test/api.rb', line 439

def get_products_video(product_id, video_id)
  @connection.get("/products/#{product_id}/videos/#{video_id}", {})
end

#get_products_videos(options = {}) ⇒ Object



431
432
433
# File 'lib/bigcommerce_test/api.rb', line 431

def get_products_videos(options={})
  @connection.get("/products/videos", options)
end

#get_timeObject



36
37
38
# File 'lib/bigcommerce_test/api.rb', line 36

def get_time
  @connection.get '/time'
end

#store_url=(store_url) ⇒ Object



12
13
14
# File 'lib/bigcommerce_test/api.rb', line 12

def store_url=(store_url)
  @connection.store_url = store_url
end

#to_rfc2822(datetime) ⇒ Object



32
33
34
# File 'lib/bigcommerce_test/api.rb', line 32

def to_rfc2822(datetime)
  datetime.strftime("%a, %d %b %Y %H:%M:%S %z")
end

#update_brand(id, options = {}) ⇒ Object



56
57
58
# File 'lib/bigcommerce_test/api.rb', line 56

def update_brand(id, options={})
   @connection.put("/brands/#{id}", options)
end

#update_category(id, options = {}) ⇒ Object



96
97
98
# File 'lib/bigcommerce_test/api.rb', line 96

def update_category(id, options={})
   @connection.put("/categories/#{id}", options)
end

#update_coupon(id, options = {}) ⇒ Object



76
77
78
# File 'lib/bigcommerce_test/api.rb', line 76

def update_coupon(id, options={})
   @connection.put("/coupons/#{id}", options)
end

#update_option(id, options = {}) ⇒ Object



156
157
158
# File 'lib/bigcommerce_test/api.rb', line 156

def update_option(id, options={})
  @connection.put("/options/#{id}", options)
end

#update_options_value(options_id, values_id, options = {}) ⇒ Object



176
177
178
# File 'lib/bigcommerce_test/api.rb', line 176

def update_options_value(options_id, values_id, options={})
  @connection.put("/options/#{options_id}/values/#{values_id}", options)
end

#update_optionset(id, options = {}) ⇒ Object



196
197
198
# File 'lib/bigcommerce_test/api.rb', line 196

def update_optionset(id, options={})
  @connection.put("/optionsets/#{id}", options)
end

#update_optionset_option(optionset_id, option_id, options = {}) ⇒ Object



220
221
222
# File 'lib/bigcommerce_test/api.rb', line 220

def update_optionset_option(optionset_id, option_id, options={})
  @connection.put("/optionsets/#{optionset_id}/options/#{option_id}", options)
end

#update_order(id, options = {}) ⇒ Object



243
244
245
# File 'lib/bigcommerce_test/api.rb', line 243

def update_order(id,options={})
  @connection.put("/orders/#{id}", options)
end

#update_orders_shipment(order_id, shipment_id, options = {}) ⇒ Object



275
276
277
# File 'lib/bigcommerce_test/api.rb', line 275

def update_orders_shipment(order_id,shipment_id,options={})
  @connection.put("/orders/#{order_id}/shipments/#{shipment_id}", options)
end

#update_products(id, options = {}) ⇒ Object



311
312
313
# File 'lib/bigcommerce_test/api.rb', line 311

def update_products(id, options={})
  @connection.put("/products/#{id}", options)
end

#update_products_image(product_id, image_id, options = {}) ⇒ Object



375
376
377
# File 'lib/bigcommerce_test/api.rb', line 375

def update_products_image(product_id,image_id,options={})
  @connection.put("/products/#{product_id}/images/#{image_id}", options)
end

#update_products_rule(product_id, rule_id, options = {}) ⇒ Object



407
408
409
# File 'lib/bigcommerce_test/api.rb', line 407

def update_products_rule(product_id, rule_id, options={})
  @connection.put("/products/#{product_id}/rules/#{rule_id}", options)
end

#update_products_sku(product_id, sku_id, options = {}) ⇒ Object



427
428
429
# File 'lib/bigcommerce_test/api.rb', line 427

def update_products_sku(product_id, sku_id, options={})
  @connection.put("/products/#{product_id}/skus/#{sku_id}", options)
end

#username=(username) ⇒ Object



16
17
18
# File 'lib/bigcommerce_test/api.rb', line 16

def username=(username)
  @connection.username = username
end

#verify_ssl=(verify) ⇒ Object



24
25
26
# File 'lib/bigcommerce_test/api.rb', line 24

def verify_ssl=(verify)
  @connection.verify_ssl = verify
end