Module: BlommingApi::SellEndpoints
- Included in:
- Client
- Defined in:
- lib/blomming_api/sell_endpoints.rb
Instance Method Summary collapse
-
#sell_payment_types_create(email, params = {}) ⇒ Object
Create a new Payment Type.
-
#sell_payment_types_delete(payment_type_id, params = {}) ⇒ Object
Delete a Payment Type.
-
#sell_payment_types_find(params = {}) ⇒ Object
Get the current Payment Type.
-
#sell_payment_types_update(payment_type_id, email, params = {}) ⇒ Object
Edit a Payment Type.
-
#sell_register(payload, params = {}) ⇒ Object
Register a new account to blomming.
-
#sell_shipping_countries_all(params = {}) ⇒ Object
Get the full list of the possible Countries for the shipping profile, localized.
-
#sell_shipping_profile_create(shipping_profile, params = {}) ⇒ Object
Create a new Shipping Profile.
-
#sell_shipping_profile_delete(id, params = {}) ⇒ Object
Delete a Shipping Profile.
-
#sell_shipping_profile_find(id, params = {}) ⇒ Object
Get the shipping profile that has the id given.
-
#sell_shipping_profile_item_create(payload, item_id, params = {}) ⇒ Object
Create a Shipping Profile and assign it to an Item.
-
#sell_shipping_profile_update(id, shipping_profile, params = {}) ⇒ Object
Edit a Shipping Profile.
-
#sell_shipping_profiles(params = {}) ⇒ Object
Get all the shipping profiles associated to the user.
-
#sell_shipping_regions(params = {}) ⇒ Object
Get the full list of the possible Regions for the shipping profile, localized.
-
#sell_shop_dashboard(params = {}) ⇒ Object
Get shop dashboard details, that are products count, orders count and total revenue.
-
#sell_shop_item_create(item, params = {}) ⇒ Object
Create a new shop item.
-
#sell_shop_item_delete(item_id, params = {}) ⇒ Object
Delete an item given an id.
-
#sell_shop_item_find(item_id, params = {}) ⇒ Object
Returns one of shop products’ details.
-
#sell_shop_item_section_add(item_id, section_name, params = {}) ⇒ Object
Add an Item (:item_id) to a section (:section_name).
-
#sell_shop_item_section_remove(item_id, section_id, params = {}) ⇒ Object
Remove an Item (:item_id) from a section (:section_id).
-
#sell_shop_item_tags_add(item_id, *tags, params) ⇒ Object
Add one or more Tag to an Item.
-
#sell_shop_item_tags_remove(item_id, *tags, params) ⇒ Object
Remove one or more Tag to an Item.
-
#sell_shop_item_update(item_id, item, params = {}) ⇒ Object
Update some of the properties of the Item.
-
#sell_shop_items(params = {}) ⇒ Object
Returns an ordered, paginated list of all the items (pubished or not) present on a given shop.
-
#sell_shop_orders(order_status, params = {}) ⇒ Object
Returns a collection of orders received by the shop.
-
#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.
-
#sell_shop_orders_find(order_number, params = {}) ⇒ Object
Returns the details for the specific Order (uniquely identified by :order_number).
-
#sell_shop_orders_request_cancellation(order_number, reason_string, params = {}) ⇒ Object
Foreward an Order cancellation request to Blomming staff.
-
#sell_shop_orders_states(params = {}) ⇒ Object
Returns the valid order states (for filtering purpose on API Orders requests).
-
#sell_shop_section_create(section_name, params = {}) ⇒ Object
Creates a new section for current shop.
-
#sell_shop_section_delete(section_id, params = {}) ⇒ Object
Delete a section with a given section_id of the current shop.
-
#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.
-
#sell_shop_section_update(section_id, section_name, params = {}) ⇒ Object
Update the section name from a given section_id of the current shop.
-
#sell_shop_sections(params = {}) ⇒ Object
Return all sections of current shop.
-
#sell_shop_shipping_profiles(params = {}) ⇒ Object
Returns all the shipping profiles of the shop.
-
#sell_shop_user_details(params = {}) ⇒ Object
Get details about current user and his shop.
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(shipping_profile, params = {}) ⇒ Object
Create a new Shipping Profile
example:
shipping_profile =
{ "name":"National shipping",
"origin_country_code":"IT",
"everywhere_else_cost_single":10,
"everywhere_else_cost_shared":5
}
blomming.sell_shipping_profile_create shipping_profile
129 130 131 132 133 134 135 136 137 |
# File 'lib/blomming_api/sell_endpoints.rb', line 129 def sell_shipping_profile_create (shipping_profile, params={}) url = api_url "/sell/shipping_profiles" load = MultiJson.dump shipping_profile 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
155 156 157 158 159 160 161 162 |
# File 'lib/blomming_api/sell_endpoints.rb', line 155 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
167 168 169 170 171 172 173 174 |
# File 'lib/blomming_api/sell_endpoints.rb', line 167 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
179 180 181 182 183 184 185 186 187 |
# File 'lib/blomming_api/sell_endpoints.rb', line 179 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, shipping_profile, params = {}) ⇒ Object
Edit a Shipping Profile
142 143 144 145 146 147 148 149 150 |
# File 'lib/blomming_api/sell_endpoints.rb', line 142 def sell_shipping_profile_update (id, shipping_profile, params={}) url = api_url "/sell/shipping_profiles/#{id}" load = MultiJson.dump shipping_profile 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.
199 200 201 202 203 204 205 206 |
# File 'lib/blomming_api/sell_endpoints.rb', line 199 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
217 218 219 220 221 222 223 224 |
# File 'lib/blomming_api/sell_endpoints.rb', line 217 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(item, params = {}) ⇒ Object
Create a new shop item
example:
item = { “category_ids”: [101],
"source_shipping_profile_id": "",
"price": 8.50,
"title": "An Item",
"quantity": 1,
"description": "New description",
"published": true,
"original_price": 10.00
}
blomming.sell_shop_item_create item
261 262 263 264 265 266 267 268 269 |
# File 'lib/blomming_api/sell_endpoints.rb', line 261 def sell_shop_item_create (item, params={}) url = api_url "/sell/shop/items/new" load = MultiJson.dump item 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
314 315 316 317 318 319 320 321 |
# File 'lib/blomming_api/sell_endpoints.rb', line 314 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
274 275 276 277 278 279 280 281 |
# File 'lib/blomming_api/sell_endpoints.rb', line 274 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_section_add(item_id, section_name, params = {}) ⇒ Object
Add an Item (:item_id) to a section (:section_name)
355 356 357 358 359 360 361 362 363 |
# File 'lib/blomming_api/sell_endpoints.rb', line 355 def sell_shop_item_section_add(item_id, section_name, params={}) url = api_url "/sell/shop/items/#{item_id}/add_section" req = request_params({currency: @currency, locale: @locale}.merge(params)) load = MultiJson.dump section: section_name feed_or_retry do RestClient.post url, load, req end end |
#sell_shop_item_section_remove(item_id, section_id, params = {}) ⇒ Object
Remove an Item (:item_id) from a section (:section_id)
369 370 371 372 373 374 375 376 |
# File 'lib/blomming_api/sell_endpoints.rb', line 369 def sell_shop_item_section_remove(item_id, section_id, params={}) url = api_url "/sell/shop/items/#{item_id}/remove_section/#{section_id}" req = request_params({currency: @currency, locale: @locale}.merge(params)) feed_or_retry do RestClient.delete url, req end end |
#sell_shop_item_tags_add(item_id, *tags, params) ⇒ Object
Add one or more Tag to an Item.
326 327 328 329 330 331 332 333 334 |
# File 'lib/blomming_api/sell_endpoints.rb', line 326 def (item_id, *, params) url = api_url "/sell/shop/items/#{item_id}/add_tags" load = {tag_list: .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.
339 340 341 342 343 344 345 346 347 348 349 |
# File 'lib/blomming_api/sell_endpoints.rb', line 339 def (item_id, *, 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: .join(','), multipart: true} feed_or_retry do RestClient.post url, load, req end end |
#sell_shop_item_update(item_id, item, params = {}) ⇒ Object
Update some of the properties of the Item
example:
item = { “category_ids”: [101],
"source_shipping_profile_id": "",
"price": 8.50,
"title": "An Item",
"quantity": 1,
"description": "New description",
"published": true,
"original_price": 10.00
}
blomming.sell_shop_item_update 60034, item
301 302 303 304 305 306 307 308 309 |
# File 'lib/blomming_api/sell_endpoints.rb', line 301 def sell_shop_item_update (item_id, item, params={}) url = api_url "/sell/shop/items/#{item_id}" load = MultiJson.dump item 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.
235 236 237 238 239 240 241 242 |
# File 'lib/blomming_api/sell_endpoints.rb', line 235 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
469 470 471 472 473 474 475 476 |
# File 'lib/blomming_api/sell_endpoints.rb', line 469 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.
494 495 496 497 498 499 500 501 |
# File 'lib/blomming_api/sell_endpoints.rb', line 494 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)
481 482 483 484 485 486 487 488 |
# File 'lib/blomming_api/sell_endpoints.rb', line 481 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.
507 508 509 510 511 512 513 514 515 |
# File 'lib/blomming_api/sell_endpoints.rb', line 507 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
457 458 459 460 461 462 463 464 |
# File 'lib/blomming_api/sell_endpoints.rb', line 457 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
398 399 400 401 402 403 404 405 406 |
# File 'lib/blomming_api/sell_endpoints.rb', line 398 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
424 425 426 427 428 429 430 431 |
# File 'lib/blomming_api/sell_endpoints.rb', line 424 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.
437 438 439 440 441 442 443 444 |
# File 'lib/blomming_api/sell_endpoints.rb', line 437 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
411 412 413 414 415 416 417 418 419 |
# File 'lib/blomming_api/sell_endpoints.rb', line 411 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
386 387 388 389 390 391 392 393 |
# File 'lib/blomming_api/sell_endpoints.rb', line 386 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.
525 526 527 528 529 530 531 532 |
# File 'lib/blomming_api/sell_endpoints.rb', line 525 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.
542 543 544 545 546 547 548 549 |
# File 'lib/blomming_api/sell_endpoints.rb', line 542 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 |