Class: Bling::API::Order
Overview
This class is used to make requests to all available actions related to orders in Bling api. Is strongly recommended to use the Bling::API module wrapper
Instance Method Summary collapse
-
#create(params) ⇒ Array
Insert a order in Bling.
-
#get(order_id) ⇒ Array
Get a specific object based on order_id.
-
#list ⇒ Array
Get a list of available orders.
-
#put(order_id, status) ⇒ Array
Put an order status update based on order_id.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Bling::API::Request
Instance Method Details
#create(params) ⇒ Array
Insert a order in Bling
82 83 84 |
# File 'lib/bling/api/order.rb', line 82 def create(params) post_request(t_url(:order), parsed_xml(params)) end |
#get(order_id) ⇒ Array
Get a specific object based on order_id
28 29 30 |
# File 'lib/bling/api/order.rb', line 28 def get(order_id) get_request(t_url(:order, order_id)) end |
#list ⇒ Array
Get a list of available orders
15 16 17 |
# File 'lib/bling/api/order.rb', line 15 def list get_request(t_url(:orders)) end |
#put(order_id, status) ⇒ Array
Put an order status update based on order_id
Available statuses
- 0 (Em Aberto)
- 1 (Atendido)
- 2 (Cancelado)
- 3 (Em Andamento)
- 4 (Venda Agenciada)
- 10 (Em Digita
106 107 108 109 110 |
# File 'lib/bling/api/order.rb', line 106 def put(order_id, status) raise ArgumentError unless [0, 1, 2, 3, 4, 10, 11].include?(status.to_i) xml = order_update_template % { status: status.to_i } put_request(t_url(:order, order_id), xml) end |