Module: IFormat::Client::Orders
- Included in:
- IFormat::Client
- Defined in:
- lib/iformat/client/orders.rb
Instance Method Summary collapse
- #create_order(id, items) ⇒ Object
- #get_order_info(id) ⇒ Object
- #get_orders_history(start = 0, limit = 5) ⇒ Object
- #get_orders_history_quantity ⇒ Object
- #repeat_order(id) ⇒ Object
Instance Method Details
#create_order(id, items) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/iformat/client/orders.rb', line 10 def create_order(id, items) attrs = session_request(:create_order, { 'orderID' => id, 'items' => { 'iFSCreateOrderReq' => items } }) end |
#get_order_info(id) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/iformat/client/orders.rb', line 19 def get_order_info(id) attrs = session_request(:get_order_info, { 'orderID' => id }) attrs[:items] = Array.wrap(attrs.delete(:items)[:i_fs_item]).map do |item_attrs| item_attrs[:urls] = Array.wrap(item_attrs.delete(:content)[:string]) IFormat::OrderItem.new(item_attrs) end IFormat::Order.new(attrs) end |
#get_orders_history(start = 0, limit = 5) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/iformat/client/orders.rb', line 36 def get_orders_history(start = 0, limit = 5) attrs = session_request(:get_orders_history, { 'start' => start, 'limit' => limit }) end |
#get_orders_history_quantity ⇒ Object
43 44 45 46 47 |
# File 'lib/iformat/client/orders.rb', line 43 def get_orders_history_quantity attrs = session_request(:get_orders_history_quantity) attrs[:quantity].to_i end |
#repeat_order(id) ⇒ Object
32 33 34 |
# File 'lib/iformat/client/orders.rb', line 32 def repeat_order(id) get_order_info(id) end |