Module: Agris::Api::Inventory::Orders

Included in:
Client
Defined in:
lib/agris/api/inventory/orders.rb

Instance Method Summary collapse

Instance Method Details

#create_order(order) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/agris/api/inventory/orders.rb', line 6

def create_order(order)
  response = @request.process_message(
    Gyoku.xml(xml: context_hash),
    82_320,
    create_post_payload_xml(convert_order_to_details(order))
  )

  PostResult.new(response)
end

#order(order_location, order_number, order_type = 'S') ⇒ Object



16
17
18
19
20
21
22
# File 'lib/agris/api/inventory/orders.rb', line 16

def order(order_location, order_number, order_type = 'S')
  extract = SpecificOrderExtract.new(
    order_location, order_number, order_type
  )

  orders([extract])
end

#orders(order_extracts) ⇒ Object



24
25
26
27
28
29
# File 'lib/agris/api/inventory/orders.rb', line 24

def orders(order_extracts)
  extract_documents(
    Messages::QueryOrderDocuments.new(order_extracts),
    Agris::Api::Order
  )
end

#orders_changed_since(datetime, detail = false) ⇒ Object



31
32
33
34
35
36
# File 'lib/agris/api/inventory/orders.rb', line 31

def orders_changed_since(datetime, detail = false)
  extract_documents(
    Messages::QueryChangedOrders.new(datetime, detail),
    Agris::Api::Order
  )
end