Class: Bluepark::Client::Sales
- Inherits:
-
Object
- Object
- Bluepark::Client::Sales
- Defined in:
- lib/bluepark/client/sales.rb
Instance Method Summary collapse
- #count(params = {}) ⇒ Object
- #create_product(product_params) ⇒ Object
- #delete_all_products ⇒ Object
- #delete_product_by_id(product_id) ⇒ Object
- #get_product(product_id) ⇒ Object
- #get_products(params = {}) ⇒ Object
-
#initialize(client, order_id) ⇒ Sales
constructor
A new instance of Sales.
- #update_single_product(product_id, product_params) ⇒ Object
Constructor Details
#initialize(client, order_id) ⇒ Sales
Returns a new instance of Sales.
4 5 6 7 |
# File 'lib/bluepark/client/sales.rb', line 4 def initialize(client, order_id) @client = client @order_id = order_id end |
Instance Method Details
#count(params = {}) ⇒ Object
17 18 19 |
# File 'lib/bluepark/client/sales.rb', line 17 def count(params = {}) @client.rest_get_with_token("orders/#{@order_id}/products/count", params)['count'] end |
#create_product(product_params) ⇒ Object
21 22 23 |
# File 'lib/bluepark/client/sales.rb', line 21 def create_product(product_params) @client.rest_post_with_token("orders/#{@order_id}/products", product_params) end |
#delete_all_products ⇒ Object
33 34 35 |
# File 'lib/bluepark/client/sales.rb', line 33 def delete_all_products @client.rest_delete_with_token("orders/#{@order_id}/products/all") end |
#delete_product_by_id(product_id) ⇒ Object
29 30 31 |
# File 'lib/bluepark/client/sales.rb', line 29 def delete_product_by_id(product_id) @client.rest_delete_with_token("orders/#{@order_id}/products/#{product_id}") end |
#get_product(product_id) ⇒ Object
13 14 15 |
# File 'lib/bluepark/client/sales.rb', line 13 def get_product(product_id) @client.rest_get_with_token("orders/#{@order_id}/products/#{product_id}") end |
#get_products(params = {}) ⇒ Object
9 10 11 |
# File 'lib/bluepark/client/sales.rb', line 9 def get_products(params = {}) @client.rest_get_with_token("orders/#{@order_id}/products/", params) end |
#update_single_product(product_id, product_params) ⇒ Object
25 26 27 |
# File 'lib/bluepark/client/sales.rb', line 25 def update_single_product(product_id, product_params) @client.rest_put_with_token("orders/#{@order_id}/products/#{product_id}", product_params) end |