Module: BlommingApi::SellEndpoints

Included in:
Client
Defined in:
lib/blomming_api/sell_endpoints.rb

Instance Method Summary collapse

Instance Method Details

#sell_payment_types_create(email, params = {}) ⇒ Object

Create a new Payment Type



28
29
30
31
32
33
34
35
36
# File 'lib/blomming_api/sell_endpoints.rb', line 28

def sell_payment_types_create (email, params={})
  url = api_url "/sell/payment_types​/new"
  load = MultiJson.dump email: email
  req = request_params(params)

  feed_or_retry do
    RestClient.post url, load, req 
  end  
end

#sell_payment_types_delete(payment_type_id, params = {}) ⇒ Object

Delete a Payment Type



54
55
56
57
58
59
60
61
# File 'lib/blomming_api/sell_endpoints.rb', line 54

def sell_payment_types_delete (payment_type_id, params={})
  url = api_url "/sell/payment_types​/#{payment_type_id}"
  req = request_params(params)

  feed_or_retry do
    RestClient.delete url, req 
  end  
end

#sell_payment_types_find(params = {}) ⇒ Object

Get the current Payment Type



16
17
18
19
20
21
22
23
# File 'lib/blomming_api/sell_endpoints.rb', line 16

def sell_payment_types_find (params={})
  url = api_url "/sell/payment_types​/user_list"
  req = request_params(params)

  feed_or_retry do
    RestClient.get url, req
  end  
end

#sell_payment_types_update(payment_type_id, email, params = {}) ⇒ Object

Edit a Payment Type



41
42
43
44
45
46
47
48
49
# File 'lib/blomming_api/sell_endpoints.rb', line 41

def sell_payment_types_update (payment_type_id, email, params={})
  url = api_url "/sell/payment_types​/#{payment_type_id}"
  load = MultiJson.dump email: email
  req = request_params(params)

  feed_or_retry do
    RestClient.put url, load, req 
  end  
end

#sell_register(payload, params = {}) ⇒ Object

Register a new account to blomming



71
72
73
74
75
76
77
78
79
# File 'lib/blomming_api/sell_endpoints.rb', line 71

def sell_register (payload, params={})
  url = api_url "/sell/register"
  load = MultiJson.dump payload
  req = request_params(params)

  feed_or_retry do
    RestClient.post url, load, req 
  end  
end

#sell_shipping_countries_all(params = {}) ⇒ Object

Get the full list of the possible Countries for the shipping profile, localized.



90
91
92
93
94
95
96
# File 'lib/blomming_api/sell_endpoints.rb', line 90

def sell_shipping_countries_all (params={})
 req = request_params({locale: @locale}.merge(params))

  feed_or_retry do
    RestClient.get url, req
  end  
end

#sell_shipping_profile_create(payload, params = {}) ⇒ Object

Create a new Shipping Profile



118
119
120
121
122
123
124
125
126
# File 'lib/blomming_api/sell_endpoints.rb', line 118

def sell_shipping_profile_create (payload, params={})
  url = api_url "/sell/shipping_profiles"
  load = MultiJson.dump payload
  req = request_params(params)

  feed_or_retry do
    RestClient.post url, load, req 
  end  
end

#sell_shipping_profile_delete(id, params = {}) ⇒ Object

Delete a Shipping Profile



144
145
146
147
148
149
150
151
# File 'lib/blomming_api/sell_endpoints.rb', line 144

def sell_shipping_profile_delete (id, params={})
  url = api_url "/sell/shipping_profiles/#{id}"
  req = request_params(params)

  feed_or_retry do
    RestClient.delete url, req 
  end  
end

#sell_shipping_profile_find(id, params = {}) ⇒ Object

Get the shipping profile that has the id given



156
157
158
159
160
161
162
163
# File 'lib/blomming_api/sell_endpoints.rb', line 156

def sell_shipping_profile_find (id, params={})
  url = api_url "/sell/shipping_profiles/#{id}"
  req = request_params(params)

  feed_or_retry do
    RestClient.get url, req 
  end  
end

#sell_shipping_profile_item_create(payload, item_id, params = {}) ⇒ Object

Create a Shipping Profile and assign it to an Item



168
169
170
171
172
173
174
175
176
# File 'lib/blomming_api/sell_endpoints.rb', line 168

def sell_shipping_profile_item_create (payload, item_id, params={})
  url = api_url "/sell/shipping_profiles/items​/#{item_id}"
  load = MultiJson.dump payload
  req = request_params(params)

  feed_or_retry do
    RestClient.post url, load, req 
  end  
end

#sell_shipping_profile_update(id, payload, params = {}) ⇒ Object

Edit a Shipping Profile



131
132
133
134
135
136
137
138
139
# File 'lib/blomming_api/sell_endpoints.rb', line 131

def sell_shipping_profile_update (id, payload, params={})
  url = api_url "/sell/shipping_profiles/#{id}"
  load = MultiJson.dump payload
  req = request_params(params)

  feed_or_retry do
    RestClient.put url, load, req 
  end  
end

#sell_shipping_profiles(params = {}) ⇒ Object

Get all the shipping profiles associated to the user



106
107
108
109
110
111
112
113
# File 'lib/blomming_api/sell_endpoints.rb', line 106

def sell_shipping_profiles (params={})
  url = api_url "/sell/shipping_profiles"
  req = request_params(params)

  feed_or_retry do
    RestClient.get url, req
  end
end

#sell_shipping_regions(params = {}) ⇒ Object

Get the full list of the possible Regions for the shipping profile, localized.



188
189
190
191
192
193
194
195
# File 'lib/blomming_api/sell_endpoints.rb', line 188

def sell_shipping_regions (params={})
  url = api_url "/sell/shipping_regions​/all"
  req = request_params({locale: @locale}.merge(params))

  feed_or_retry do
    RestClient.get url, req
  end  
end

#sell_shop_dashboard(params = {}) ⇒ Object

Get shop dashboard details, that are products count, orders count and total revenue



206
207
208
209
210
211
212
213
# File 'lib/blomming_api/sell_endpoints.rb', line 206

def sell_shop_dashboard (params={})
  url = api_url "/sell/shop/dashboard"
  req = request_params({locale: @locale}.merge(params))

  feed_or_retry do
    RestClient.get url, req
  end  
end

#sell_shop_item_create(payload, params = {}) ⇒ Object

Create a new shop item



236
237
238
239
240
241
242
243
244
# File 'lib/blomming_api/sell_endpoints.rb', line 236

def sell_shop_item_create (payload, params={})
  url = api_url '/sell/shop/items/new'
  load = MultiJson.dump payload
  req = request_params(params)

  feed_or_retry do
    RestClient.post url, load, req 
  end  
end

#sell_shop_item_delete(item_id, params = {}) ⇒ Object

Delete an item given an id



274
275
276
277
278
279
280
281
# File 'lib/blomming_api/sell_endpoints.rb', line 274

def sell_shop_item_delete (item_id, params={})
  url = api_url "/sell/shop/items/#{item_id}"
  req = request_params(params)

  feed_or_retry do
    RestClient.delete url, req
  end  
end

#sell_shop_item_find(item_id, params = {}) ⇒ Object

Returns one of shop products’ details



249
250
251
252
253
254
255
256
# File 'lib/blomming_api/sell_endpoints.rb', line 249

def sell_shop_item_find (item_id, params={})
  url = api_url "/sell/shop/items/#{item_id}"
  req = request_params(params)

  feed_or_retry do
    RestClient.get url, req
  end  
end

#sell_shop_item_tags_add(item_id, *tags, params) ⇒ Object

Add one or more Tag to an Item.



286
287
288
289
290
291
292
293
294
# File 'lib/blomming_api/sell_endpoints.rb', line 286

def sell_shop_item_tags_add(item_id, *tags, params)
  url = api_url "/sell/shop/items/#{item_id}/add_tags"
  load = {tag_list: tags.join(','), multipart: true}
  req = request_params({currency: @currency, locale: @locale}.merge(params))
  
  feed_or_retry do
    RestClient.post url, load, req
  end  
end

#sell_shop_item_tags_remove(item_id, *tags, params) ⇒ Object

Remove one or more Tag to an Item.



299
300
301
302
303
304
305
306
307
308
309
# File 'lib/blomming_api/sell_endpoints.rb', line 299

def sell_shop_item_tags_remove(item_id, *tags, params)
  url = api_url "/sell/shop/items/#{item_id}/remove_tag"
  req = request_params({currency: @currency, locale: @locale}.merge(params))
  
  # with a hash sends parameters as a urlencoded form body
  load = {tag: tags.join(','), multipart: true}

  feed_or_retry do
    RestClient.post url, load, req
  end  
end

#sell_shop_item_update(item_id, payload, params = {}) ⇒ Object

Update some of the properties of the Item



261
262
263
264
265
266
267
268
269
# File 'lib/blomming_api/sell_endpoints.rb', line 261

def sell_shop_item_update (item_id, payload, params={})
  url = api_url "/sell/shop/items/#{item_id}"
  load = MultiJson.dump payload
  req = request_params(params)

  feed_or_retry do
    RestClient.put url, load, req
  end    
end

#sell_shop_items(params = {}) ⇒ Object

Returns an ordered, paginated list of all the items (pubished or not) present on a given shop.



224
225
226
227
228
229
230
231
# File 'lib/blomming_api/sell_endpoints.rb', line 224

def sell_shop_items (params={})
  url = api_url '/sell/shop/items'
  req = request_params(params)

  feed_or_retry do
    RestClient.get url, req
  end  
end

#sell_shop_orders(order_status, params = {}) ⇒ Object

Returns a collection of orders received by the shop



402
403
404
405
406
407
408
409
# File 'lib/blomming_api/sell_endpoints.rb', line 402

def sell_shop_orders (order_status, params={})
  url = api_url "/sell/shop/orders"
  req = request_params({ order_status: order_status, currency: @currency, locale: @locale}.merge(params))

  feed_or_retry do
    RestClient.get url, req
  end  
end

#sell_shop_orders_change_state(order_number, state, params = {}) ⇒ Object

Cause a transaction in the Order state to the new state specified by state request param.



427
428
429
430
431
432
433
434
# File 'lib/blomming_api/sell_endpoints.rb', line 427

def sell_shop_orders_change_state (order_number, state, params={})
  url = api_url "/sell/shop/orders/#{order_number}/change_state"
  req = request_params({state: state}.merge(params))

  feed_or_retry do
    RestClient.post url, req
  end  
end

#sell_shop_orders_find(order_number, params = {}) ⇒ Object

Returns the details for the specific Order (uniquely identified by :order_number)



414
415
416
417
418
419
420
421
# File 'lib/blomming_api/sell_endpoints.rb', line 414

def sell_shop_orders_find (order_number, params={})
  url = api_url "/sell/shop/orders/#{order_number}"
  req = request_params(params)

  feed_or_retry do
    RestClient.get url, req
  end  
end

#sell_shop_orders_request_cancellation(order_number, reason_string, params = {}) ⇒ Object

Foreward an Order cancellation request to Blomming staff. The request parameter set MUST be passed into the request Body as a JSON object.



440
441
442
443
444
445
446
447
448
# File 'lib/blomming_api/sell_endpoints.rb', line 440

def sell_shop_orders_request_cancellation (order_number, reason_string, params={})
  url = api_url "/sell/shop/orders/#{order_number}/request_cancellation"
  req = request_params(params)
  load = MultiJson.dump reason: reason_string

  feed_or_retry do
    RestClient.post url, load, req
  end  
end

#sell_shop_orders_states(params = {}) ⇒ Object

Returns the valid order states (for filtering purpose on API Orders requests). This is a dictionary endpoint: it should never change and its response body may be long cached on API clients



390
391
392
393
394
395
396
397
# File 'lib/blomming_api/sell_endpoints.rb', line 390

def sell_shop_orders_states (params={})
  url = api_url "/sell/shop/orders/states"
  req = request_params(params)

  feed_or_retry do
    RestClient.get url, req
  end  
end

#sell_shop_section_create(section_name, params = {}) ⇒ Object

Creates a new section for current shop



331
332
333
334
335
336
337
338
339
# File 'lib/blomming_api/sell_endpoints.rb', line 331

def sell_shop_section_create (section_name, params={})
  url = api_url "/sell/shop/sections"
  req = request_params(params)
  load = MultiJson.dump name: section_name

  feed_or_retry do
    RestClient.post url, load, req
  end  
end

#sell_shop_section_delete(section_id, params = {}) ⇒ Object

Delete a section with a given section_id of the current shop



357
358
359
360
361
362
363
364
# File 'lib/blomming_api/sell_endpoints.rb', line 357

def sell_shop_section_delete (section_id, params={})
  url = api_url "/sell/shop/sections/#{section_id}"
  req = request_params(params)

  feed_or_retry do
    RestClient.delete url, req
  end  
end

#sell_shop_section_items(section_id, params = {}) ⇒ Object

Returns an ordered, paginated list of all the items (pubished or not) present on a given shop section.



370
371
372
373
374
375
376
377
# File 'lib/blomming_api/sell_endpoints.rb', line 370

def sell_shop_section_items (section_id, params={})
  url = api_url "/sell/shop/sections/#{section_id}/items"
  req = request_params(params)

  feed_or_retry do
    RestClient.get url, req
  end  
end

#sell_shop_section_update(section_id, section_name, params = {}) ⇒ Object

Update the section name from a given section_id of the current shop



344
345
346
347
348
349
350
351
352
# File 'lib/blomming_api/sell_endpoints.rb', line 344

def sell_shop_section_update (section_id, section_name, params={})
  url = api_url "/sell/shop/sections/#{section_id}"
  req = request_params(params)
  load = MultiJson.dump name: section_name

  feed_or_retry do
    RestClient.put url, load, req
  end  
end

#sell_shop_sections(params = {}) ⇒ Object

Return all sections of current shop



319
320
321
322
323
324
325
326
# File 'lib/blomming_api/sell_endpoints.rb', line 319

def sell_shop_sections (params={})
  url = api_url "/sell/shop/sections"
  req = request_params(params)

  feed_or_retry do
    RestClient.get url, req
  end  
end

#sell_shop_shipping_profiles(params = {}) ⇒ Object

Returns all the shipping profiles of the shop.



458
459
460
461
462
463
464
465
# File 'lib/blomming_api/sell_endpoints.rb', line 458

def sell_shop_shipping_profiles (params={})
  url = api_url "/sell/shop/shipping_profiles"
  req = request_params({locale: @locale}.merge(params))

  feed_or_retry do
    RestClient.get url, req
  end  
end

#sell_shop_user_details(params = {}) ⇒ Object

Get details about current user and his shop.



475
476
477
478
479
480
481
482
# File 'lib/blomming_api/sell_endpoints.rb', line 475

def sell_shop_user_details (params={})
  url = api_url "/sell/shop/user_details"
  req = request_params({locale: @locale}.merge(params))

  feed_or_retry do
    RestClient.get url, req
  end  
end