blomming_api 0.4.6 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/blomming_api +1 -1
- data/lib/blomming_api/buy_endpoints.rb +177 -32
- data/lib/blomming_api/help.rb +5 -3
- data/lib/blomming_api/sell_endpoints.rb +194 -34
- data/lib/blomming_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef281dfa6f26763582a9689b0538f068517e4ba0
|
4
|
+
data.tar.gz: 522da850bc418c5f24f5047f3ae037adb22cda4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff0ad8e69dd1181907b9508f6554a1f10143b82c2b602fa25e69685d24ac9d99a949e51a490a32511bf033f3aa6b36537ad723a6493a8f38856947c347f1a37d
|
7
|
+
data.tar.gz: 59b9c907352eeae6a1021eeef33714a440652294cbe424ccf175deb5dca3ea1dc2ad32c1568da5737ac4d46fcb1039a0a627b9dab7ffc3693f82247ba8855363
|
data/bin/blomming_api
CHANGED
@@ -5,49 +5,71 @@ require 'rest_client'
|
|
5
5
|
module BlommingApi
|
6
6
|
module BuyEndpoints
|
7
7
|
#
|
8
|
+
# BUY
|
8
9
|
# CARTS
|
9
10
|
#
|
10
11
|
|
12
|
+
#
|
13
|
+
# Create a new Cart on the server, as present in the home page of the web site.
|
14
|
+
# It also redirects to the Cart URL.
|
15
|
+
#
|
11
16
|
def carts_create(sku_id, params={})
|
12
|
-
url = api_url
|
17
|
+
url = api_url "/carts"
|
13
18
|
req = request_params({currency: @currency}.merge(params))
|
14
19
|
|
15
20
|
# with a hash sends parameters as a urlencoded form body
|
16
|
-
load = {:
|
17
|
-
|
18
|
-
# debug
|
19
|
-
#puts req
|
20
|
-
#RestClient.log = 'stdout'
|
21
|
+
load = {sku_id: sku_id, multipart: true}
|
21
22
|
|
22
23
|
feed_or_retry do
|
23
24
|
RestClient.post url, load, req
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
28
|
+
#
|
29
|
+
# Returns the Cart with the given ID, as returned from the create cart API.
|
30
|
+
#
|
31
|
+
def carts_find(cart_id, params={})
|
32
|
+
url = api_url "/carts/#{cart_id}"
|
33
|
+
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
34
|
+
|
35
|
+
feed_or_retry do
|
36
|
+
RestClient.get url, req
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# Add multiple SKUs to the Cart.
|
42
|
+
#
|
27
43
|
def carts_add(*skus, cart_id, params)
|
28
44
|
url = api_url "/carts/#{cart_id}/add"
|
29
45
|
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
30
46
|
|
31
47
|
# with a hash sends parameters as a urlencoded form body
|
32
|
-
load = {:
|
48
|
+
load = {skus: skus.join(','), multipart: true}
|
33
49
|
|
34
50
|
feed_or_retry do
|
35
51
|
RestClient.put url, load, req
|
36
52
|
end
|
37
53
|
end
|
38
54
|
|
55
|
+
#
|
56
|
+
# Remove multiple SKUs from the Cart.
|
57
|
+
#
|
39
58
|
def carts_remove(*skus, cart_id, params)
|
40
59
|
url = api_url "/carts/#{cart_id}/remove"
|
41
60
|
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
42
61
|
|
43
62
|
# with a hash sends parameters as a urlencoded form body
|
44
|
-
load = {:
|
63
|
+
load = {skus: skus.join(','), multipart: true}
|
45
64
|
|
46
65
|
feed_or_retry do
|
47
66
|
RestClient.put url, load, req
|
48
67
|
end
|
49
68
|
end
|
50
69
|
|
70
|
+
#
|
71
|
+
# Remove all SKUs from the Cart.
|
72
|
+
#
|
51
73
|
def carts_clear(cart_id, params={})
|
52
74
|
url = api_url "/carts/#{cart_id}/clear"
|
53
75
|
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
@@ -58,59 +80,92 @@ module BlommingApi
|
|
58
80
|
end
|
59
81
|
end
|
60
82
|
|
61
|
-
|
62
|
-
|
83
|
+
#
|
84
|
+
# Returns countries to which this Cart can be shipped to.
|
85
|
+
#
|
86
|
+
def carts_shipping_countries(cart_id, params={})
|
87
|
+
url = api_url "/carts/#{cart_id}/shipping_countries"
|
63
88
|
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
64
|
-
load = MultiJson.dump order
|
65
|
-
|
66
|
-
feed_or_retry do
|
67
|
-
# POST with raw JSON payloads ?
|
68
|
-
RestClient.post url, load, req
|
69
|
-
end
|
70
|
-
end
|
71
89
|
|
72
|
-
def carts_place_paypal_order(paypal_order, params={})
|
73
|
-
url = api_url '/carts/place_paypal_order'
|
74
|
-
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
75
|
-
load = MultiJson.dump paypal_order
|
76
|
-
|
77
90
|
feed_or_retry do
|
78
|
-
RestClient.
|
91
|
+
RestClient.get url, req
|
79
92
|
end
|
80
93
|
end
|
81
94
|
|
95
|
+
#
|
96
|
+
# order_example = {
|
97
|
+
# ship_to_first_name: "Andrea",
|
98
|
+
# ship_to_last_name: "Salicetti",
|
99
|
+
# ship_to_address: "via%20Teodosio%2065",
|
100
|
+
# ship_to_postal_code: 20100,
|
101
|
+
# ship_to_city: "Milano",
|
102
|
+
# ship_to_province: "MI",
|
103
|
+
# ship_to_country: "Italy",
|
104
|
+
# bill_is_ship: "false",
|
105
|
+
# bill_to_first_name: "Nicola%20Junior",
|
106
|
+
# bill_to_last_name: "Vitto",
|
107
|
+
# bill_to_address: "via%20Teodosio%2065",
|
108
|
+
# bill_to_postal_code: "20100",
|
109
|
+
# bill_to_city: "Milano",
|
110
|
+
# bill_to_province: "MI",
|
111
|
+
# bill_to_country: "Italy",
|
112
|
+
# bill_to_company: "Blomming%20SpA",
|
113
|
+
# bill_to_vat_number: "IT07199240966",
|
114
|
+
# phone_number3: ""
|
115
|
+
# }
|
116
|
+
#
|
82
117
|
|
83
|
-
|
84
|
-
|
85
|
-
|
118
|
+
#
|
119
|
+
# Returns the Cart with the given ID, as returned from the create cart API.
|
120
|
+
#
|
121
|
+
def carts_validate_order(cart_id, order, payment_type, params={})
|
122
|
+
url = api_url "/carts/#{cart_id}/validate/#{payment_type}"
|
123
|
+
req = request_params({order: order, currency: @currency, locale: @locale}.merge(params))
|
86
124
|
|
87
125
|
feed_or_retry do
|
88
126
|
RestClient.get url, req
|
89
127
|
end
|
90
128
|
end
|
91
129
|
|
92
|
-
|
93
|
-
|
130
|
+
#
|
131
|
+
# Checkout of the Cart.
|
132
|
+
#
|
133
|
+
def carts_checkout_order(cart_id, order, payment_type, params={})
|
134
|
+
url = api_url "/carts/#{cart_id}/checkout/#{payment_type}"
|
94
135
|
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
95
136
|
|
137
|
+
# with a hash sends parameters as a urlencoded form body
|
138
|
+
load = {order: order, multipart: true}
|
139
|
+
|
96
140
|
feed_or_retry do
|
97
|
-
RestClient.
|
141
|
+
RestClient.post url, load, req
|
98
142
|
end
|
99
143
|
end
|
100
144
|
|
101
|
-
|
102
|
-
|
145
|
+
#
|
146
|
+
# Complete a PayPal transaction
|
147
|
+
#
|
148
|
+
def carts_place_paypal_order(cart_id, order_id, paypal_token, paypal_payer_id, params={})
|
149
|
+
url = api_url "/carts/#{cart_id}/order/#{order_id}/place_paypal"
|
103
150
|
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
151
|
+
|
152
|
+
# with a hash sends parameters as a urlencoded form body
|
153
|
+
load = {token: paypal_token, PayerID: paypal_payer_id, multipart: true}
|
104
154
|
|
105
155
|
feed_or_retry do
|
106
|
-
RestClient.
|
156
|
+
RestClient.post url, load, req
|
107
157
|
end
|
108
158
|
end
|
109
159
|
|
110
160
|
|
111
161
|
#
|
162
|
+
# BUY
|
112
163
|
# CATEGORIES
|
113
164
|
#
|
165
|
+
|
166
|
+
#
|
167
|
+
# Returns the categories
|
168
|
+
#
|
114
169
|
def categories(params={})
|
115
170
|
url = api_url '/categories'
|
116
171
|
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
@@ -120,6 +175,9 @@ module BlommingApi
|
|
120
175
|
end
|
121
176
|
end
|
122
177
|
|
178
|
+
#
|
179
|
+
# Returns all the Items (paged) belonging to a certain category.
|
180
|
+
#
|
123
181
|
def category_items (category_id, params={})
|
124
182
|
url = api_url "/categories/#{category_id}/items"
|
125
183
|
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
@@ -130,8 +188,13 @@ module BlommingApi
|
|
130
188
|
end
|
131
189
|
|
132
190
|
#
|
191
|
+
# BUY
|
133
192
|
# COLLECTIONS
|
134
193
|
#
|
194
|
+
|
195
|
+
#
|
196
|
+
# Returns the collections
|
197
|
+
#
|
135
198
|
def collections(params={})
|
136
199
|
url = api_url '/collections'
|
137
200
|
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
@@ -141,6 +204,9 @@ module BlommingApi
|
|
141
204
|
end
|
142
205
|
end
|
143
206
|
|
207
|
+
#
|
208
|
+
# Returns the Items of a shop.
|
209
|
+
#
|
144
210
|
def collection_items (collection_id, params={})
|
145
211
|
url = api_url "/collections/#{collection_id}/items"
|
146
212
|
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
@@ -151,8 +217,13 @@ module BlommingApi
|
|
151
217
|
end
|
152
218
|
|
153
219
|
#
|
220
|
+
# BUY
|
154
221
|
# COUNTRIES
|
155
222
|
#
|
223
|
+
|
224
|
+
#
|
225
|
+
# Get the full list of the possible Countries, localized.
|
226
|
+
#
|
156
227
|
def countries(params={})
|
157
228
|
url = api_url '/countries'
|
158
229
|
req = request_params({locale: @locale}.merge(params))
|
@@ -163,8 +234,13 @@ module BlommingApi
|
|
163
234
|
end
|
164
235
|
|
165
236
|
#
|
237
|
+
# BUY
|
166
238
|
# CURRENCIES
|
167
239
|
#
|
240
|
+
|
241
|
+
#
|
242
|
+
# Returns currencies accepted by Blomming
|
243
|
+
#
|
168
244
|
def currencies(params={})
|
169
245
|
url = api_url '/currencies'
|
170
246
|
req = request_params({locale: @locale}.merge(params))
|
@@ -175,8 +251,13 @@ module BlommingApi
|
|
175
251
|
end
|
176
252
|
|
177
253
|
#
|
254
|
+
# BUY
|
178
255
|
# ITEMS
|
179
256
|
#
|
257
|
+
|
258
|
+
#
|
259
|
+
# Returns the “discounted” Items, as present in the home page of the web site
|
260
|
+
#
|
180
261
|
def items_discounted(params={})
|
181
262
|
url = api_url '/items/discounted'
|
182
263
|
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
@@ -186,6 +267,9 @@ module BlommingApi
|
|
186
267
|
end
|
187
268
|
end
|
188
269
|
|
270
|
+
#
|
271
|
+
# Returns the “featured” Items, as present in the home page of the web site.
|
272
|
+
#
|
189
273
|
def items_featured(params={})
|
190
274
|
url = api_url '/items/featured'
|
191
275
|
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
@@ -195,6 +279,9 @@ module BlommingApi
|
|
195
279
|
end
|
196
280
|
end
|
197
281
|
|
282
|
+
#
|
283
|
+
# Returns the “hand picked” Items, as present in the home page of the web site.
|
284
|
+
#
|
198
285
|
def items_hand_picked(params={})
|
199
286
|
url = api_url '/items/hand_picked'
|
200
287
|
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
@@ -204,6 +291,9 @@ module BlommingApi
|
|
204
291
|
end
|
205
292
|
end
|
206
293
|
|
294
|
+
#
|
295
|
+
# Returns the Items with the specified ids.
|
296
|
+
#
|
207
297
|
def items_list (item_id, params={})
|
208
298
|
url = api_url '/items/list'
|
209
299
|
req = request_params({id: item_id, currency: @currency, locale: @locale}.merge(params))
|
@@ -213,6 +303,9 @@ module BlommingApi
|
|
213
303
|
end
|
214
304
|
end
|
215
305
|
|
306
|
+
#
|
307
|
+
# Returns the “most_liked” Items, as present in the home page of the web site.
|
308
|
+
#
|
216
309
|
def items_most_liked(params={})
|
217
310
|
url = api_url '/items/most_liked'
|
218
311
|
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
@@ -222,6 +315,9 @@ module BlommingApi
|
|
222
315
|
end
|
223
316
|
end
|
224
317
|
|
318
|
+
#
|
319
|
+
# Search Blomming for items that respond to a query.
|
320
|
+
#
|
225
321
|
def items_search (keyword, params={})
|
226
322
|
url = api_url '/items/search'
|
227
323
|
req = request_params({q: keyword, currency: @currency, locale: @locale}.merge(params))
|
@@ -232,8 +328,13 @@ module BlommingApi
|
|
232
328
|
end
|
233
329
|
|
234
330
|
#
|
331
|
+
# BUY
|
235
332
|
# MACROCATEGORIES
|
236
333
|
#
|
334
|
+
|
335
|
+
#
|
336
|
+
# Returns the Macrocategories
|
337
|
+
#
|
237
338
|
def macrocategories(params={})
|
238
339
|
url = api_url '/macrocategories'
|
239
340
|
req = request_params({locale: @locale}.merge(params))
|
@@ -243,6 +344,9 @@ module BlommingApi
|
|
243
344
|
end
|
244
345
|
end
|
245
346
|
|
347
|
+
#
|
348
|
+
# Returns the Categories included in the given Macrocategory.
|
349
|
+
#
|
246
350
|
def macrocategory_categories (macrocategory_id, params={})
|
247
351
|
url = api_url "/macrocategories/:macrocategory_id/categories"
|
248
352
|
req = request_params({locale: @locale}.merge(params))
|
@@ -252,6 +356,9 @@ module BlommingApi
|
|
252
356
|
end
|
253
357
|
end
|
254
358
|
|
359
|
+
#
|
360
|
+
# Returns the Items inside a Macrocategory.
|
361
|
+
#
|
255
362
|
def macrocategory_items (macrocategory_id, params={})
|
256
363
|
url = api_url "/macrocategories/:macrocategory_id/items"
|
257
364
|
req = request_params({locale: @locale}.merge(params))
|
@@ -263,8 +370,15 @@ module BlommingApi
|
|
263
370
|
|
264
371
|
|
265
372
|
#
|
373
|
+
# BUY
|
266
374
|
# PASSWORD_RESETS
|
267
375
|
#
|
376
|
+
|
377
|
+
#
|
378
|
+
# Perform a password reset request to Blomming.
|
379
|
+
# If it does succeed, an email is sent to the user
|
380
|
+
# with the link to renew his passowrd for Blomming.
|
381
|
+
#
|
268
382
|
def password_resets (email_of_user, params={})
|
269
383
|
url = api_url "/password_resets"
|
270
384
|
|
@@ -276,8 +390,13 @@ module BlommingApi
|
|
276
390
|
|
277
391
|
|
278
392
|
#
|
393
|
+
# BUY
|
279
394
|
# PROVINCES
|
280
395
|
#
|
396
|
+
|
397
|
+
#
|
398
|
+
# Retruns the provinces list for a given Country.
|
399
|
+
#
|
281
400
|
def provinces (province_country_code, params={})
|
282
401
|
url = api_url "/provinces/#{province_country_code}"
|
283
402
|
|
@@ -287,8 +406,13 @@ module BlommingApi
|
|
287
406
|
end
|
288
407
|
|
289
408
|
#
|
409
|
+
# BUY
|
290
410
|
# SHOPS
|
291
411
|
#
|
412
|
+
|
413
|
+
#
|
414
|
+
# Returns the Shops list
|
415
|
+
#
|
292
416
|
def shops (params={})
|
293
417
|
url = api_url '/shops'
|
294
418
|
|
@@ -297,6 +421,11 @@ module BlommingApi
|
|
297
421
|
end
|
298
422
|
end
|
299
423
|
|
424
|
+
#
|
425
|
+
# Returns the Items of a Shop.
|
426
|
+
# :shop_id is the Shop id (the User’s login owner of the Shop)
|
427
|
+
# as returned from the /shops endpoint.
|
428
|
+
#
|
300
429
|
def shop_items (shop_id, params={})
|
301
430
|
url = api_url "/shops/#{shop_id}/items"
|
302
431
|
|
@@ -308,6 +437,9 @@ module BlommingApi
|
|
308
437
|
data
|
309
438
|
end
|
310
439
|
|
440
|
+
#
|
441
|
+
# Returns the details of an Item.
|
442
|
+
#
|
311
443
|
def shop_item (shop_id, item_id, params={})
|
312
444
|
url = api_url "/shops/#{shop_id}/items/#{item_id}"
|
313
445
|
|
@@ -316,6 +448,11 @@ module BlommingApi
|
|
316
448
|
end
|
317
449
|
end
|
318
450
|
|
451
|
+
#
|
452
|
+
# Get the details of a single Shop.
|
453
|
+
# :id is the Shop id (the User’s login owner of the Shop)
|
454
|
+
# as returned from the /shops endpoint.
|
455
|
+
#
|
319
456
|
def shops_find (shop_id, params={})
|
320
457
|
url = api_url "/shops/#{shop_id}"
|
321
458
|
|
@@ -325,8 +462,13 @@ module BlommingApi
|
|
325
462
|
end
|
326
463
|
|
327
464
|
#
|
465
|
+
# BUY
|
328
466
|
# TAGS
|
329
467
|
#
|
468
|
+
|
469
|
+
#
|
470
|
+
# Retrieve the tags.
|
471
|
+
#
|
330
472
|
def tags (params={})
|
331
473
|
url = api_url "/tags"
|
332
474
|
|
@@ -335,6 +477,9 @@ module BlommingApi
|
|
335
477
|
end
|
336
478
|
end
|
337
479
|
|
480
|
+
#
|
481
|
+
# Returns the Items with a specific tag.
|
482
|
+
#
|
338
483
|
def tags_items (tag_id, params={})
|
339
484
|
url = api_url "/tags/#{tag_id}/items"
|
340
485
|
|
data/lib/blomming_api/help.rb
CHANGED
@@ -16,7 +16,8 @@ module BlommingApi
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def BlommingApi::endpoints_help
|
19
|
-
puts "BUY
|
19
|
+
puts "BUY ENDPOINTS METHODS"
|
20
|
+
puts "=====================\n"
|
20
21
|
|
21
22
|
buy_endpoints_methods = BlommingApi::BuyEndpoints.instance_methods(false)
|
22
23
|
|
@@ -24,7 +25,8 @@ module BlommingApi
|
|
24
25
|
display_method_info method_name
|
25
26
|
end
|
26
27
|
|
27
|
-
puts "SELL
|
28
|
+
puts "SELL ENDPOINTS METHODS"
|
29
|
+
puts "======================\n"
|
28
30
|
|
29
31
|
sell_endpoints_methods = BlommingApi::SellEndpoints.instance_methods(false)
|
30
32
|
|
@@ -43,7 +45,7 @@ module BlommingApi
|
|
43
45
|
method_def = method_source.split("\n").first.strip[/def (?<match>.*)/,"match"]
|
44
46
|
location = BlommingApi::Client.instance_method(method_name.to_sym).source_location
|
45
47
|
|
46
|
-
puts "#{method_comment}"
|
48
|
+
puts "\n#{method_comment}"
|
47
49
|
puts "\t#{method_def}"
|
48
50
|
puts "\tfile: #{location.first}"
|
49
51
|
puts "\tline: #{location.last}"
|
@@ -6,8 +6,13 @@ module BlommingApi
|
|
6
6
|
module SellEndpoints
|
7
7
|
|
8
8
|
#
|
9
|
+
# SELL
|
9
10
|
# PAYMENT_TYPES
|
10
11
|
#
|
12
|
+
|
13
|
+
#
|
14
|
+
# Get the current Payment Type
|
15
|
+
#
|
11
16
|
def sell_payment_types_find (params={})
|
12
17
|
url = api_url "/sell/payment_types/user_list"
|
13
18
|
req = request_params(params)
|
@@ -17,9 +22,12 @@ module BlommingApi
|
|
17
22
|
end
|
18
23
|
end
|
19
24
|
|
20
|
-
|
25
|
+
#
|
26
|
+
# Create a new Payment Type
|
27
|
+
#
|
28
|
+
def sell_payment_types_create (email, params={})
|
21
29
|
url = api_url "/sell/payment_types/new"
|
22
|
-
load = MultiJson.dump
|
30
|
+
load = MultiJson.dump email: email
|
23
31
|
req = request_params(params)
|
24
32
|
|
25
33
|
feed_or_retry do
|
@@ -27,9 +35,12 @@ module BlommingApi
|
|
27
35
|
end
|
28
36
|
end
|
29
37
|
|
30
|
-
|
31
|
-
|
32
|
-
|
38
|
+
#
|
39
|
+
# Edit a Payment Type
|
40
|
+
#
|
41
|
+
def sell_payment_types_update (payment_type_id, email, params={})
|
42
|
+
url = api_url "/sell/payment_types/#{payment_type_id}"
|
43
|
+
load = MultiJson.dump email: email
|
33
44
|
req = request_params(params)
|
34
45
|
|
35
46
|
feed_or_retry do
|
@@ -37,8 +48,11 @@ module BlommingApi
|
|
37
48
|
end
|
38
49
|
end
|
39
50
|
|
40
|
-
|
41
|
-
|
51
|
+
#
|
52
|
+
# Delete a Payment Type
|
53
|
+
#
|
54
|
+
def sell_payment_types_delete (payment_type_id, params={})
|
55
|
+
url = api_url "/sell/payment_types/#{payment_type_id}"
|
42
56
|
req = request_params(params)
|
43
57
|
|
44
58
|
feed_or_retry do
|
@@ -47,8 +61,13 @@ module BlommingApi
|
|
47
61
|
end
|
48
62
|
|
49
63
|
#
|
64
|
+
# SELL
|
50
65
|
# REGISTER
|
51
66
|
#
|
67
|
+
|
68
|
+
#
|
69
|
+
# Register a new account to blomming
|
70
|
+
#
|
52
71
|
def sell_register (payload, params={})
|
53
72
|
url = api_url "/sell/register"
|
54
73
|
load = MultiJson.dump payload
|
@@ -60,11 +79,16 @@ module BlommingApi
|
|
60
79
|
end
|
61
80
|
|
62
81
|
#
|
82
|
+
# SELL
|
63
83
|
# SHIPPING_COUNTRIES
|
64
84
|
#
|
85
|
+
|
86
|
+
#
|
87
|
+
# Get the full list of the possible Countries
|
88
|
+
# for the shipping profile, localized.
|
89
|
+
#
|
65
90
|
def sell_shipping_countries_all (params={})
|
66
|
-
|
67
|
-
req = request_params({locale: @locale}.merge(params))
|
91
|
+
req = request_params({locale: @locale}.merge(params))
|
68
92
|
|
69
93
|
feed_or_retry do
|
70
94
|
RestClient.get url, req
|
@@ -72,9 +96,13 @@ module BlommingApi
|
|
72
96
|
end
|
73
97
|
|
74
98
|
#
|
99
|
+
# SELL
|
75
100
|
# SHIPPING_PROFILES
|
76
101
|
#
|
77
|
-
|
102
|
+
|
103
|
+
#
|
104
|
+
# Get all the shipping profiles associated to the user
|
105
|
+
#
|
78
106
|
def sell_shipping_profiles (params={})
|
79
107
|
url = api_url "/sell/shipping_profiles"
|
80
108
|
req = request_params(params)
|
@@ -84,6 +112,9 @@ module BlommingApi
|
|
84
112
|
end
|
85
113
|
end
|
86
114
|
|
115
|
+
#
|
116
|
+
# Create a new Shipping Profile
|
117
|
+
#
|
87
118
|
def sell_shipping_profile_create (payload, params={})
|
88
119
|
url = api_url "/sell/shipping_profiles"
|
89
120
|
load = MultiJson.dump payload
|
@@ -94,19 +125,10 @@ module BlommingApi
|
|
94
125
|
end
|
95
126
|
end
|
96
127
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
req = request_params(params)
|
102
|
-
|
103
|
-
feed_or_retry do
|
104
|
-
RestClient.put url, load, req
|
105
|
-
end
|
106
|
-
end
|
107
|
-
=end
|
108
|
-
|
109
|
-
def sell_shipping_profile_update (payload, params={})
|
128
|
+
#
|
129
|
+
# Edit a Shipping Profile
|
130
|
+
#
|
131
|
+
def sell_shipping_profile_update (id, payload, params={})
|
110
132
|
url = api_url "/sell/shipping_profiles/#{id}"
|
111
133
|
load = MultiJson.dump payload
|
112
134
|
req = request_params(params)
|
@@ -116,8 +138,11 @@ module BlommingApi
|
|
116
138
|
end
|
117
139
|
end
|
118
140
|
|
141
|
+
#
|
142
|
+
# Delete a Shipping Profile
|
143
|
+
#
|
119
144
|
def sell_shipping_profile_delete (id, params={})
|
120
|
-
url = api_url "/sell/
|
145
|
+
url = api_url "/sell/shipping_profiles/#{id}"
|
121
146
|
req = request_params(params)
|
122
147
|
|
123
148
|
feed_or_retry do
|
@@ -125,8 +150,11 @@ module BlommingApi
|
|
125
150
|
end
|
126
151
|
end
|
127
152
|
|
153
|
+
#
|
154
|
+
# Get the shipping profile that has the id given
|
155
|
+
#
|
128
156
|
def sell_shipping_profile_find (id, params={})
|
129
|
-
url = api_url "/sell/
|
157
|
+
url = api_url "/sell/shipping_profiles/#{id}"
|
130
158
|
req = request_params(params)
|
131
159
|
|
132
160
|
feed_or_retry do
|
@@ -134,6 +162,9 @@ module BlommingApi
|
|
134
162
|
end
|
135
163
|
end
|
136
164
|
|
165
|
+
#
|
166
|
+
# Create a Shipping Profile and assign it to an Item
|
167
|
+
#
|
137
168
|
def sell_shipping_profile_item_create (payload, item_id, params={})
|
138
169
|
url = api_url "/sell/shipping_profiles/items/#{item_id}"
|
139
170
|
load = MultiJson.dump payload
|
@@ -146,8 +177,14 @@ module BlommingApi
|
|
146
177
|
|
147
178
|
|
148
179
|
#
|
180
|
+
# SELL
|
149
181
|
# SHIPPING_REGIONS
|
150
182
|
#
|
183
|
+
|
184
|
+
#
|
185
|
+
# Get the full list of the possible Regions
|
186
|
+
# for the shipping profile, localized.
|
187
|
+
#
|
151
188
|
def sell_shipping_regions (params={})
|
152
189
|
url = api_url "/sell/shipping_regions/all"
|
153
190
|
req = request_params({locale: @locale}.merge(params))
|
@@ -158,8 +195,14 @@ module BlommingApi
|
|
158
195
|
end
|
159
196
|
|
160
197
|
#
|
198
|
+
# SELL
|
161
199
|
# SHOP_DASHBOARD
|
162
200
|
#
|
201
|
+
|
202
|
+
#
|
203
|
+
# Get shop dashboard details,
|
204
|
+
# that are products count, orders count and total revenue
|
205
|
+
#
|
163
206
|
def sell_shop_dashboard (params={})
|
164
207
|
url = api_url "/sell/shop/dashboard"
|
165
208
|
req = request_params({locale: @locale}.merge(params))
|
@@ -170,8 +213,14 @@ module BlommingApi
|
|
170
213
|
end
|
171
214
|
|
172
215
|
#
|
216
|
+
# SELL
|
173
217
|
# SHOP_ITEMS
|
174
218
|
#
|
219
|
+
|
220
|
+
#
|
221
|
+
# Returns an ordered, paginated list of all the items
|
222
|
+
# (pubished or not) present on a given shop.
|
223
|
+
#
|
175
224
|
def sell_shop_items (params={})
|
176
225
|
url = api_url '/sell/shop/items'
|
177
226
|
req = request_params(params)
|
@@ -181,6 +230,9 @@ module BlommingApi
|
|
181
230
|
end
|
182
231
|
end
|
183
232
|
|
233
|
+
#
|
234
|
+
# Create a new shop item
|
235
|
+
#
|
184
236
|
def sell_shop_item_create (payload, params={})
|
185
237
|
url = api_url '/sell/shop/items/new'
|
186
238
|
load = MultiJson.dump payload
|
@@ -191,6 +243,9 @@ module BlommingApi
|
|
191
243
|
end
|
192
244
|
end
|
193
245
|
|
246
|
+
#
|
247
|
+
# Returns one of shop products’ details
|
248
|
+
#
|
194
249
|
def sell_shop_item_find (item_id, params={})
|
195
250
|
url = api_url "/sell/shop/items/#{item_id}"
|
196
251
|
req = request_params(params)
|
@@ -200,6 +255,9 @@ module BlommingApi
|
|
200
255
|
end
|
201
256
|
end
|
202
257
|
|
258
|
+
#
|
259
|
+
# Update some of the properties of the Item
|
260
|
+
#
|
203
261
|
def sell_shop_item_update (item_id, payload, params={})
|
204
262
|
url = api_url "/sell/shop/items/#{item_id}"
|
205
263
|
load = MultiJson.dump payload
|
@@ -210,6 +268,9 @@ module BlommingApi
|
|
210
268
|
end
|
211
269
|
end
|
212
270
|
|
271
|
+
#
|
272
|
+
# Delete an item given an id
|
273
|
+
#
|
213
274
|
def sell_shop_item_delete (item_id, params={})
|
214
275
|
url = api_url "/sell/shop/items/#{item_id}"
|
215
276
|
req = request_params(params)
|
@@ -219,35 +280,113 @@ module BlommingApi
|
|
219
280
|
end
|
220
281
|
end
|
221
282
|
|
222
|
-
|
283
|
+
#
|
284
|
+
# Add one or more Tag to an Item.
|
285
|
+
#
|
286
|
+
def sell_shop_item_tags_add(item_id, *tags, params)
|
223
287
|
url = api_url "/sell/shop/items/#{item_id}/add_tags"
|
288
|
+
load = {tag_list: tags.join(','), multipart: true}
|
224
289
|
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
225
290
|
|
226
|
-
# with a hash sends parameters as a urlencoded form body
|
227
|
-
load = {:tags => tags.join(','), :multipart => true}
|
228
|
-
|
229
291
|
feed_or_retry do
|
230
292
|
RestClient.post url, load, req
|
231
293
|
end
|
232
294
|
end
|
233
295
|
|
234
|
-
|
296
|
+
#
|
297
|
+
# Remove one or more Tag to an Item.
|
298
|
+
#
|
299
|
+
def sell_shop_item_tags_remove(item_id, *tags, params)
|
235
300
|
url = api_url "/sell/shop/items/#{item_id}/remove_tag"
|
236
301
|
req = request_params({currency: @currency, locale: @locale}.merge(params))
|
237
302
|
|
238
303
|
# with a hash sends parameters as a urlencoded form body
|
239
|
-
load = {:
|
304
|
+
load = {tag: tags.join(','), multipart: true}
|
240
305
|
|
241
306
|
feed_or_retry do
|
242
307
|
RestClient.post url, load, req
|
243
308
|
end
|
244
309
|
end
|
245
310
|
|
311
|
+
#
|
312
|
+
# SELL
|
313
|
+
# SHOP_SECTIONS
|
314
|
+
#
|
246
315
|
|
316
|
+
#
|
317
|
+
# Return all sections of current shop
|
318
|
+
#
|
319
|
+
def sell_shop_sections (params={})
|
320
|
+
url = api_url "/sell/shop/sections"
|
321
|
+
req = request_params(params)
|
247
322
|
|
323
|
+
feed_or_retry do
|
324
|
+
RestClient.get url, req
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
#
|
329
|
+
# Creates a new section for current shop
|
248
330
|
#
|
331
|
+
def sell_shop_section_create (section_name, params={})
|
332
|
+
url = api_url "/sell/shop/sections"
|
333
|
+
req = request_params(params)
|
334
|
+
load = MultiJson.dump name: section_name
|
335
|
+
|
336
|
+
feed_or_retry do
|
337
|
+
RestClient.post url, load, req
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
#
|
342
|
+
# Update the section name from a given section_id of the current shop
|
343
|
+
#
|
344
|
+
def sell_shop_section_update (section_id, section_name, params={})
|
345
|
+
url = api_url "/sell/shop/sections/#{section_id}"
|
346
|
+
req = request_params(params)
|
347
|
+
load = MultiJson.dump name: section_name
|
348
|
+
|
349
|
+
feed_or_retry do
|
350
|
+
RestClient.put url, load, req
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
#
|
355
|
+
# Delete a section with a given section_id of the current shop
|
356
|
+
#
|
357
|
+
def sell_shop_section_delete (section_id, params={})
|
358
|
+
url = api_url "/sell/shop/sections/#{section_id}"
|
359
|
+
req = request_params(params)
|
360
|
+
|
361
|
+
feed_or_retry do
|
362
|
+
RestClient.delete url, req
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
#
|
367
|
+
# Returns an ordered, paginated list of all the items (pubished or not)
|
368
|
+
# present on a given shop section.
|
369
|
+
#
|
370
|
+
def sell_shop_section_items (section_id, params={})
|
371
|
+
url = api_url "/sell/shop/sections/#{section_id}/items"
|
372
|
+
req = request_params(params)
|
373
|
+
|
374
|
+
feed_or_retry do
|
375
|
+
RestClient.get url, req
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
379
|
+
#
|
380
|
+
# SELL
|
249
381
|
# SHOP_ORDERS
|
250
382
|
#
|
383
|
+
|
384
|
+
#
|
385
|
+
# Returns the valid order states
|
386
|
+
# (for filtering purpose on API Orders requests).
|
387
|
+
# This is a dictionary endpoint: it should never change
|
388
|
+
# and its response body may be long cached on API clients
|
389
|
+
#
|
251
390
|
def sell_shop_orders_states (params={})
|
252
391
|
url = api_url "/sell/shop/orders/states"
|
253
392
|
req = request_params(params)
|
@@ -257,6 +396,9 @@ module BlommingApi
|
|
257
396
|
end
|
258
397
|
end
|
259
398
|
|
399
|
+
#
|
400
|
+
# Returns a collection of orders received by the shop
|
401
|
+
#
|
260
402
|
def sell_shop_orders (order_status, params={})
|
261
403
|
url = api_url "/sell/shop/orders"
|
262
404
|
req = request_params({ order_status: order_status, currency: @currency, locale: @locale}.merge(params))
|
@@ -266,6 +408,9 @@ module BlommingApi
|
|
266
408
|
end
|
267
409
|
end
|
268
410
|
|
411
|
+
#
|
412
|
+
# Returns the details for the specific Order (uniquely identified by :order_number)
|
413
|
+
#
|
269
414
|
def sell_shop_orders_find (order_number, params={})
|
270
415
|
url = api_url "/sell/shop/orders/#{order_number}"
|
271
416
|
req = request_params(params)
|
@@ -275,31 +420,41 @@ module BlommingApi
|
|
275
420
|
end
|
276
421
|
end
|
277
422
|
|
423
|
+
#
|
424
|
+
# Cause a transaction in the Order state
|
425
|
+
# to the new state specified by state request param.
|
426
|
+
#
|
278
427
|
def sell_shop_orders_change_state (order_number, state, params={})
|
279
428
|
url = api_url "/sell/shop/orders/#{order_number}/change_state"
|
280
429
|
req = request_params({state: state}.merge(params))
|
281
430
|
|
282
431
|
feed_or_retry do
|
283
|
-
# POST with a hash sends parameters as a urlencoded form body
|
284
432
|
RestClient.post url, req
|
285
433
|
end
|
286
434
|
end
|
287
435
|
|
288
|
-
|
436
|
+
#
|
437
|
+
# Foreward an Order cancellation request to Blomming staff.
|
438
|
+
# The request parameter set MUST be passed into the request Body as a JSON object.
|
439
|
+
#
|
289
440
|
def sell_shop_orders_request_cancellation (order_number, reason_string, params={})
|
290
441
|
url = api_url "/sell/shop/orders/#{order_number}/request_cancellation"
|
291
442
|
req = request_params(params)
|
292
443
|
load = MultiJson.dump reason: reason_string
|
293
444
|
|
294
445
|
feed_or_retry do
|
295
|
-
# POST with raw payloads
|
296
446
|
RestClient.post url, load, req
|
297
447
|
end
|
298
448
|
end
|
299
449
|
|
300
450
|
#
|
451
|
+
# SELL
|
301
452
|
# SHOP_SHIPPING_PROFILES
|
302
453
|
#
|
454
|
+
|
455
|
+
#
|
456
|
+
# Returns all the shipping profiles of the shop.
|
457
|
+
#
|
303
458
|
def sell_shop_shipping_profiles (params={})
|
304
459
|
url = api_url "/sell/shop/shipping_profiles"
|
305
460
|
req = request_params({locale: @locale}.merge(params))
|
@@ -310,8 +465,13 @@ module BlommingApi
|
|
310
465
|
end
|
311
466
|
|
312
467
|
#
|
468
|
+
# SELL
|
313
469
|
# SHOP_USER_DETAILS
|
314
470
|
#
|
471
|
+
|
472
|
+
#
|
473
|
+
# Get details about current user and his shop.
|
474
|
+
#
|
315
475
|
def sell_shop_user_details (params={})
|
316
476
|
url = api_url "/sell/shop/user_details"
|
317
477
|
req = request_params({locale: @locale}.merge(params))
|
data/lib/blomming_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blomming_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Giorgio Robino
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: method_source
|