Class: EShipper::OrderInformationRequest

Inherits:
Request
  • Object
show all
Defined in:
lib/eshipper/requests/order_information_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Request

#build, #client, #send_now

Constructor Details

#initialize(order_id:, referenceCode: nil) ⇒ OrderInformationRequest

Returns a new instance of OrderInformationRequest.



7
8
9
10
11
# File 'lib/eshipper/requests/order_information_request.rb', line 7

def initialize(order_id:, referenceCode: nil)
  @order_id = order_id
  @referenceCode = referenceCode
  super()
end

Instance Attribute Details

#order_idObject (readonly)

Returns the value of attribute order_id.



5
6
7
# File 'lib/eshipper/requests/order_information_request.rb', line 5

def order_id
  @order_id
end

#referenceCodeObject (readonly)

Returns the value of attribute referenceCode.



5
6
7
# File 'lib/eshipper/requests/order_information_request.rb', line 5

def referenceCode
  @referenceCode
end

Instance Method Details

#order_propertiesObject



13
14
15
16
17
18
19
# File 'lib/eshipper/requests/order_information_request.rb', line 13

def order_properties
  {
    orderId: @order_id,
    referenceCode: referenceCode,
    detailed: "true",
  }.compact
end

#request_bodyObject



21
22
23
24
25
26
27
28
# File 'lib/eshipper/requests/order_information_request.rb', line 21

def request_body
  builder = build do |xml|
    xml.OrderInformationRequest do
      xml.Order(order_properties)
    end
  end
  builder.to_xml
end