Module: BlommingApi::BuyEndpoints
- Included in:
- Client
- Defined in:
- lib/blomming_api/buy_endpoints.rb
Instance Method Summary collapse
- #carts_add(*skus, cart_id, params) ⇒ Object
- #carts_checkout(order, params = {}) ⇒ Object
- #carts_clear(cart_id, params = {}) ⇒ Object
-
#carts_create(sku_id, params = {}) ⇒ Object
CARTS.
- #carts_place_paypal_order(paypal_order, params = {}) ⇒ Object
- #carts_remove(*skus, cart_id, params) ⇒ Object
- #carts_shipping_countries(params = {}) ⇒ Object
- #carts_show(cart_id, params = {}) ⇒ Object
- #carts_validate(cart_id, params = {}) ⇒ Object
-
#categories(params = {}) ⇒ Object
CATEGORIES.
- #category_items(category_id, params = {}) ⇒ Object
- #collection_items(collection_id, params = {}) ⇒ Object
-
#collections(params = {}) ⇒ Object
COLLECTIONS.
-
#countries(params = {}) ⇒ Object
COUNTRIES.
-
#currencies(params = {}) ⇒ Object
CURRENCIES.
-
#items_discounted(params = {}) ⇒ Object
ITEMS.
- #items_featured(params = {}) ⇒ Object
- #items_hand_picked(params = {}) ⇒ Object
- #items_list(item_id, params = {}) ⇒ Object
- #items_most_liked(params = {}) ⇒ Object
- #items_search(keyword, params = {}) ⇒ Object
-
#macrocategories(params = {}) ⇒ Object
MACROCATEGORIES.
- #macrocategory_categories(macrocategory_id, params = {}) ⇒ Object
- #macrocategory_items(macrocategory_id, params = {}) ⇒ Object
-
#password_resets(email_of_user, params = {}) ⇒ Object
PASSWORD_RESETS.
-
#provinces(province_country_code, params = {}) ⇒ Object
PROVINCES.
- #shop_item(shop_id, item_id, params = {}) ⇒ Object
- #shop_items(shop_id, params = {}) ⇒ Object
-
#shops(params = {}) ⇒ Object
SHOPS.
- #shops_find(shop_id, params = {}) ⇒ Object
-
#tags(params = {}) ⇒ Object
TAGS.
- #tags_items(tag_id, params = {}) ⇒ Object
Instance Method Details
#carts_add(*skus, cart_id, params) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/blomming_api/buy_endpoints.rb', line 27 def carts_add(*skus, cart_id, params) url = api_url "/carts/#{cart_id}/add" req = request_params({currency: @currency, locale: @locale}.merge(params)) # with a hash sends parameters as a urlencoded form body load = {:skus => skus.join(','), :multipart => true} feed_or_retry do RestClient.put url, load, req end end |
#carts_checkout(order, params = {}) ⇒ Object
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/blomming_api/buy_endpoints.rb', line 61 def carts_checkout(order, params={}) url = api_url '/carts/checkout' req = request_params({currency: @currency, locale: @locale}.merge(params)) load = MultiJson.dump order feed_or_retry do # POST with raw JSON payloads ? RestClient.post url, load, req end end |
#carts_clear(cart_id, params = {}) ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/blomming_api/buy_endpoints.rb', line 51 def carts_clear(cart_id, params={}) url = api_url "/carts/#{cart_id}/clear" req = request_params({currency: @currency, locale: @locale}.merge(params)) feed_or_retry do # PUT with a hash sends parameters as a urlencoded form body ? RestClient.put url, req end end |
#carts_create(sku_id, params = {}) ⇒ Object
CARTS
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/blomming_api/buy_endpoints.rb', line 11 def carts_create(sku_id, params={}) url = api_url '/carts' req = request_params({currency: @currency}.merge(params)) # with a hash sends parameters as a urlencoded form body load = {:sku_id => sku_id, :multipart => true} # debug #puts req #RestClient.log = 'stdout' feed_or_retry do RestClient.post url, load, req end end |
#carts_place_paypal_order(paypal_order, params = {}) ⇒ Object
72 73 74 75 76 77 78 79 80 |
# File 'lib/blomming_api/buy_endpoints.rb', line 72 def carts_place_paypal_order(paypal_order, params={}) url = api_url '/carts/place_paypal_order' req = request_params({currency: @currency, locale: @locale}.merge(params)) load = MultiJson.dump paypal_order feed_or_retry do RestClient.post url, load, req end end |
#carts_remove(*skus, cart_id, params) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/blomming_api/buy_endpoints.rb', line 39 def carts_remove(*skus, cart_id, params) url = api_url "/carts/#{cart_id}/remove" req = request_params({currency: @currency, locale: @locale}.merge(params)) # with a hash sends parameters as a urlencoded form body load = {:skus => skus.join(','), :multipart => true} feed_or_retry do RestClient.put url, load, req end end |
#carts_shipping_countries(params = {}) ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'lib/blomming_api/buy_endpoints.rb', line 83 def carts_shipping_countries(params={}) url = api_url '/carts/shipping_countries' req = request_params({currency: @currency, locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#carts_show(cart_id, params = {}) ⇒ Object
92 93 94 95 96 97 98 99 |
# File 'lib/blomming_api/buy_endpoints.rb', line 92 def carts_show(cart_id, params={}) url = api_url '/carts/#{cart_id}/show' req = request_params({currency: @currency, locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#carts_validate(cart_id, params = {}) ⇒ Object
101 102 103 104 105 106 107 108 |
# File 'lib/blomming_api/buy_endpoints.rb', line 101 def carts_validate(cart_id, params={}) url = api_url '/carts/#{cart_id}/validate' req = request_params({currency: @currency, locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#categories(params = {}) ⇒ Object
CATEGORIES
114 115 116 117 118 119 120 121 |
# File 'lib/blomming_api/buy_endpoints.rb', line 114 def categories(params={}) url = api_url '/categories' req = request_params({currency: @currency, locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#category_items(category_id, params = {}) ⇒ Object
123 124 125 126 127 128 129 130 |
# File 'lib/blomming_api/buy_endpoints.rb', line 123 def category_items (category_id, params={}) url = api_url "/categories/#{category_id}/items" req = request_params({currency: @currency, locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#collection_items(collection_id, params = {}) ⇒ Object
144 145 146 147 148 149 150 151 |
# File 'lib/blomming_api/buy_endpoints.rb', line 144 def collection_items (collection_id, params={}) url = api_url "/collections/#{collection_id}/items" req = request_params({currency: @currency, locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#collections(params = {}) ⇒ Object
COLLECTIONS
135 136 137 138 139 140 141 142 |
# File 'lib/blomming_api/buy_endpoints.rb', line 135 def collections(params={}) url = api_url '/collections' req = request_params({currency: @currency, locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#countries(params = {}) ⇒ Object
COUNTRIES
156 157 158 159 160 161 162 163 |
# File 'lib/blomming_api/buy_endpoints.rb', line 156 def countries(params={}) url = api_url '/countries' req = request_params({locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#currencies(params = {}) ⇒ Object
CURRENCIES
168 169 170 171 172 173 174 175 |
# File 'lib/blomming_api/buy_endpoints.rb', line 168 def currencies(params={}) url = api_url '/currencies' req = request_params({locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#items_discounted(params = {}) ⇒ Object
ITEMS
180 181 182 183 184 185 186 187 |
# File 'lib/blomming_api/buy_endpoints.rb', line 180 def items_discounted(params={}) url = api_url '/items/discounted' req = request_params({currency: @currency, locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#items_featured(params = {}) ⇒ Object
189 190 191 192 193 194 195 196 |
# File 'lib/blomming_api/buy_endpoints.rb', line 189 def items_featured(params={}) url = api_url '/items/featured' req = request_params({currency: @currency, locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#items_hand_picked(params = {}) ⇒ Object
198 199 200 201 202 203 204 205 |
# File 'lib/blomming_api/buy_endpoints.rb', line 198 def items_hand_picked(params={}) url = api_url '/items/hand_picked' req = request_params({currency: @currency, locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#items_list(item_id, params = {}) ⇒ Object
207 208 209 210 211 212 213 214 |
# File 'lib/blomming_api/buy_endpoints.rb', line 207 def items_list (item_id, params={}) url = api_url '/items/list' req = request_params({id: item_id, currency: @currency, locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#items_most_liked(params = {}) ⇒ Object
216 217 218 219 220 221 222 223 |
# File 'lib/blomming_api/buy_endpoints.rb', line 216 def items_most_liked(params={}) url = api_url '/items/most_liked' req = request_params({currency: @currency, locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#items_search(keyword, params = {}) ⇒ Object
225 226 227 228 229 230 231 232 |
# File 'lib/blomming_api/buy_endpoints.rb', line 225 def items_search (keyword, params={}) url = api_url '/items/search' req = request_params({q: keyword, currency: @currency, locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#macrocategories(params = {}) ⇒ Object
MACROCATEGORIES
237 238 239 240 241 242 243 244 |
# File 'lib/blomming_api/buy_endpoints.rb', line 237 def macrocategories(params={}) url = api_url '/macrocategories' req = request_params({locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#macrocategory_categories(macrocategory_id, params = {}) ⇒ Object
246 247 248 249 250 251 252 253 |
# File 'lib/blomming_api/buy_endpoints.rb', line 246 def macrocategory_categories (macrocategory_id, params={}) url = api_url "/macrocategories/:macrocategory_id/categories" req = request_params({locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#macrocategory_items(macrocategory_id, params = {}) ⇒ Object
255 256 257 258 259 260 261 262 |
# File 'lib/blomming_api/buy_endpoints.rb', line 255 def macrocategory_items (macrocategory_id, params={}) url = api_url "/macrocategories/:macrocategory_id/items" req = request_params({locale: @locale}.merge(params)) feed_or_retry do RestClient.get url, req end end |
#password_resets(email_of_user, params = {}) ⇒ Object
PASSWORD_RESETS
268 269 270 271 272 273 274 275 |
# File 'lib/blomming_api/buy_endpoints.rb', line 268 def password_resets (email_of_user, params={}) url = api_url "/password_resets" feed_or_retry do # payload JSON ? RestClient.post url, {email_of_user: email_of_user}.merge(params) end end |
#provinces(province_country_code, params = {}) ⇒ Object
PROVINCES
281 282 283 284 285 286 287 |
# File 'lib/blomming_api/buy_endpoints.rb', line 281 def provinces (province_country_code, params={}) url = api_url "/provinces/#{province_country_code}" feed_or_retry do RestClient.get url, request_params(params) end end |
#shop_item(shop_id, item_id, params = {}) ⇒ Object
311 312 313 314 315 316 317 |
# File 'lib/blomming_api/buy_endpoints.rb', line 311 def shop_item (shop_id, item_id, params={}) url = api_url "/shops/#{shop_id}/items/#{item_id}" feed_or_retry do RestClient.get url, request_params(params) end end |
#shop_items(shop_id, params = {}) ⇒ Object
300 301 302 303 304 305 306 307 308 309 |
# File 'lib/blomming_api/buy_endpoints.rb', line 300 def shop_items (shop_id, params={}) url = api_url "/shops/#{shop_id}/items" data = feed_or_retry do RestClient.get url, request_params(params) end #puts_response_header(__method__, data) if @verbose data end |
#shops(params = {}) ⇒ Object
SHOPS
292 293 294 295 296 297 298 |
# File 'lib/blomming_api/buy_endpoints.rb', line 292 def shops (params={}) url = api_url '/shops' feed_or_retry do RestClient.get url, request_params(params) end end |
#shops_find(shop_id, params = {}) ⇒ Object
319 320 321 322 323 324 325 |
# File 'lib/blomming_api/buy_endpoints.rb', line 319 def shops_find (shop_id, params={}) url = api_url "/shops/#{shop_id}" feed_or_retry do RestClient.get url, request_params(params) end end |
#tags(params = {}) ⇒ Object
TAGS
330 331 332 333 334 335 336 |
# File 'lib/blomming_api/buy_endpoints.rb', line 330 def (params={}) url = api_url "/tags" feed_or_retry do RestClient.get url, request_params(params) end end |
#tags_items(tag_id, params = {}) ⇒ Object
338 339 340 341 342 343 344 |
# File 'lib/blomming_api/buy_endpoints.rb', line 338 def (tag_id, params={}) url = api_url "/tags/#{tag_id}/items" feed_or_retry do RestClient.get url, request_params(params) end end |