module BlommingApi::SellEndpoints
Public Instance Methods
Create a new Payment Type
# 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
Delete a Payment Type
# 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
Get the current Payment Type
# 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
Edit a Payment Type
# 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
Register a new account to blomming
# 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
Get the full list of the possible Countries for the shipping profile, localized.
# 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
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
# 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
Delete a Shipping Profile
# 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
Get the shipping profile that has the id given
# 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
Create a Shipping Profile and assign it to an Item
# 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
Edit a Shipping Profile
# 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
Get all the shipping profiles associated to the user
# 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
Get the full list of the possible Regions for the shipping profile, localized.
# 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
Get shop dashboard details, that are products count, orders count and total revenue
# 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
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
# 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
Delete an item given an id
# 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
Returns one of shop products’ details
# 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
Add an Item (:item_id) to a section (:section_name)
# 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
Remove an Item (:item_id) from a section (:section_id)
# 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
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
# 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
Returns an ordered, paginated list of all the items (pubished or not) present on a given shop.
# 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
Returns a collection of orders received by the shop
# 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
Cause a transaction in the Order state to the new state specified by state request param.
# 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
Returns the details for the specific Order (uniquely identified by :order_number)
# 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
Foreward an Order cancellation request to Blomming staff. The request parameter set MUST be passed into the request Body as a JSON object.
# 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
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
# 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
Creates a new section for current shop
# 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
Delete a section with a given section_id of the current shop
# 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
Returns an ordered, paginated list of all the items (pubished or not) present on a given shop section.
# 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
Update the section name from a given section_id of the current shop
# 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
Return all sections of current shop
# 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
Returns all the shipping profiles of the shop.
# 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
Get details about current user and his shop.
# 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