class Xdelivery::API::Orders
Constants
- COLUMNS
- INVOICE_COLUMNS
Attributes
orders[RW]
Public Instance Methods
[](index)
click to toggle source
# File lib/xdelivery/api/orders.rb, line 33 def [](index) orders[index] end
add(params, invoice_params={})
click to toggle source
# File lib/xdelivery/api/orders.rb, line 18 def add(params, invoice_params={}) self.orders ||= [] (params || {}).delete_if do |k, v| COLUMNS.include?(k) == false end invoice_params.delete_if do |k, v| INVOICE_COLUMNS.include?(k) == false end params.merge!(invoice: invoice_params) unless invoice_params.empty? orders.push(params) params end
count()
click to toggle source
# File lib/xdelivery/api/orders.rb, line 37 def count orders.count end
create!()
click to toggle source
# File lib/xdelivery/api/orders.rb, line 41 def create! response = post('/orders/batch.json') Response::Orders.new(response) end
Protected Instance Methods
post_data()
click to toggle source
# File lib/xdelivery/api/orders.rb, line 48 def post_data { import: { orders: orders } } end