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(payload, 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_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, payload, 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(payload, params = {}) ⇒ Object
Create a new shop item
247 248 249 250 251 252 253 254 255 |
# File 'lib/blomming_api/sell_endpoints.rb', line 247 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
285 286 287 288 289 290 291 292 |
# File 'lib/blomming_api/sell_endpoints.rb', line 285 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
260 261 262 263 264 265 266 267 |
# File 'lib/blomming_api/sell_endpoints.rb', line 260 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.
297 298 299 300 301 302 303 304 305 |
# File 'lib/blomming_api/sell_endpoints.rb', line 297 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.
310 311 312 313 314 315 316 317 318 319 320 |
# File 'lib/blomming_api/sell_endpoints.rb', line 310 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, payload, params = {}) ⇒ Object
Update some of the properties of the Item
272 273 274 275 276 277 278 279 280 |
# File 'lib/blomming_api/sell_endpoints.rb', line 272 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.
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
413 414 415 416 417 418 419 420 |
# File 'lib/blomming_api/sell_endpoints.rb', line 413 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.
438 439 440 441 442 443 444 445 |
# File 'lib/blomming_api/sell_endpoints.rb', line 438 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)
425 426 427 428 429 430 431 432 |
# File 'lib/blomming_api/sell_endpoints.rb', line 425 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.
451 452 453 454 455 456 457 458 459 |
# File 'lib/blomming_api/sell_endpoints.rb', line 451 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
401 402 403 404 405 406 407 408 |
# File 'lib/blomming_api/sell_endpoints.rb', line 401 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
342 343 344 345 346 347 348 349 350 |
# File 'lib/blomming_api/sell_endpoints.rb', line 342 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
368 369 370 371 372 373 374 375 |
# File 'lib/blomming_api/sell_endpoints.rb', line 368 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.
381 382 383 384 385 386 387 388 |
# File 'lib/blomming_api/sell_endpoints.rb', line 381 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
355 356 357 358 359 360 361 362 363 |
# File 'lib/blomming_api/sell_endpoints.rb', line 355 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
330 331 332 333 334 335 336 337 |
# File 'lib/blomming_api/sell_endpoints.rb', line 330 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.
469 470 471 472 473 474 475 476 |
# File 'lib/blomming_api/sell_endpoints.rb', line 469 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.
486 487 488 489 490 491 492 493 |
# File 'lib/blomming_api/sell_endpoints.rb', line 486 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 |