Class: EShipper::OrderSearchRequest
- Defined in:
- lib/eshipper/requests/order_search_request.rb
Instance Attribute Summary collapse
-
#carrierId ⇒ Object
readonly
Returns the value of attribute carrierId.
-
#carrierTrackingNumber ⇒ Object
readonly
Returns the value of attribute carrierTrackingNumber.
-
#endOrderId ⇒ Object
readonly
Returns the value of attribute endOrderId.
-
#fromDate ⇒ Object
readonly
Returns the value of attribute fromDate.
-
#referenceValue ⇒ Object
readonly
Returns the value of attribute referenceValue.
-
#startOrderId ⇒ Object
readonly
Returns the value of attribute startOrderId.
-
#statusId ⇒ Object
readonly
Returns the value of attribute statusId.
-
#toDate ⇒ Object
readonly
Returns the value of attribute toDate.
Instance Method Summary collapse
-
#initialize(fromDate: Date.today - 90, toDate: Date.today, carrierId: nil, statusId: nil, startOrderId: nil, endOrderId: nil, carrierTrackingNumber: nil, referenceValue: nil) ⇒ OrderSearchRequest
constructor
A new instance of OrderSearchRequest.
- #order_properties ⇒ Object
- #request_body ⇒ Object
Methods inherited from Request
Constructor Details
#initialize(fromDate: Date.today - 90, toDate: Date.today, carrierId: nil, statusId: nil, startOrderId: nil, endOrderId: nil, carrierTrackingNumber: nil, referenceValue: nil) ⇒ OrderSearchRequest
Returns a new instance of OrderSearchRequest.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/eshipper/requests/order_search_request.rb', line 14 def initialize( fromDate: Date.today - 90, # [Required] toDate: Date.today, # [Required] carrierId: nil, # [Optional] statusId: nil, # [Optional] startOrderId: nil, # [Optional] endOrderId: nil, # [Optional] carrierTrackingNumber: nil, # [Optional] referenceValue: nil # [Optional] ) throw("Order date range should be within 3 month.") if fromDate + 90 > toDate @fromDate = fromDate @toDate = toDate @carrierId = carrierId @statusId = statusId @startOrderId = startOrderId @endOrderId = endOrderId @carrierTrackingNumber = carrierTrackingNumber @referenceValue = referenceValue super() end |
Instance Attribute Details
#carrierId ⇒ Object (readonly)
Returns the value of attribute carrierId.
7 8 9 |
# File 'lib/eshipper/requests/order_search_request.rb', line 7 def carrierId @carrierId end |
#carrierTrackingNumber ⇒ Object (readonly)
Returns the value of attribute carrierTrackingNumber.
11 12 13 |
# File 'lib/eshipper/requests/order_search_request.rb', line 11 def carrierTrackingNumber @carrierTrackingNumber end |
#endOrderId ⇒ Object (readonly)
Returns the value of attribute endOrderId.
10 11 12 |
# File 'lib/eshipper/requests/order_search_request.rb', line 10 def endOrderId @endOrderId end |
#fromDate ⇒ Object (readonly)
Returns the value of attribute fromDate.
5 6 7 |
# File 'lib/eshipper/requests/order_search_request.rb', line 5 def fromDate @fromDate end |
#referenceValue ⇒ Object (readonly)
Returns the value of attribute referenceValue.
12 13 14 |
# File 'lib/eshipper/requests/order_search_request.rb', line 12 def referenceValue @referenceValue end |
#startOrderId ⇒ Object (readonly)
Returns the value of attribute startOrderId.
9 10 11 |
# File 'lib/eshipper/requests/order_search_request.rb', line 9 def startOrderId @startOrderId end |
#statusId ⇒ Object (readonly)
Returns the value of attribute statusId.
8 9 10 |
# File 'lib/eshipper/requests/order_search_request.rb', line 8 def statusId @statusId end |
#toDate ⇒ Object (readonly)
Returns the value of attribute toDate.
6 7 8 |
# File 'lib/eshipper/requests/order_search_request.rb', line 6 def toDate @toDate end |
Instance Method Details
#order_properties ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/eshipper/requests/order_search_request.rb', line 37 def order_properties { fromDate: fromDate, toDate: toDate, carrierId: carrierId, statusId: statusId, startOrderId: startOrderId, endOrderId: endOrderId, carrierTrackingNumber: carrierTrackingNumber, referenceValue: referenceValue, }.compact end |
#request_body ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/eshipper/requests/order_search_request.rb', line 50 def request_body builder = build do |xml| xml.OrderSearchRequest do xml.Order(order_properties) end end builder.to_xml end |