Class: Workarea::GlobalE::UpdateOrderDispatchRequest
- Inherits:
-
Object
- Object
- Workarea::GlobalE::UpdateOrderDispatchRequest
- Defined in:
- app/services/workarea/global_e/update_order_dispatch_request.rb
Instance Attribute Summary collapse
-
#fulfillment_id ⇒ Object
readonly
Returns the value of attribute fulfillment_id.
-
#tracking_number ⇒ Object
readonly
Returns the value of attribute tracking_number.
Instance Method Summary collapse
- #as_json(*args) ⇒ Object
-
#delivery_reference_number ⇒ String
Merchant’s internal Delivery Reference Number for this order.
-
#exceptions ⇒ Workarea::GlobalE::UpdateOrderDispatchException?
List of UpdateOrderDispatchException objects for this the UpdateOrderDispatchRequest.
-
#initialize(fulfillment_id, tracking_number: nil) ⇒ UpdateOrderDispatchRequest
constructor
A new instance of UpdateOrderDispatchRequest.
-
#is_completed ⇒ Boolean
Flag to mark orders as “completed” by the merchant.
-
#merchant_order_id ⇒ String
Order unique identifier on the Merchant’s site.
-
#order_id ⇒ String
Global-e order unique identifier.
-
#parcels ⇒ Array<Workarea::GlobalE::Parcel>, Nil
List of Parcel object for this UpdateOrderDispatchRequest.
-
#tracking_details ⇒ Workarea::GlobalE::TrackingDetails nil
Tracking information on order level of the parcel in case the merchant does the shipping by itself.
Constructor Details
#initialize(fulfillment_id, tracking_number: nil) ⇒ UpdateOrderDispatchRequest
Returns a new instance of UpdateOrderDispatchRequest.
6 7 8 9 |
# File 'app/services/workarea/global_e/update_order_dispatch_request.rb', line 6 def initialize(fulfillment_id, tracking_number: nil) @fulfillment_id = fulfillment_id @tracking_number = tracking_number end |
Instance Attribute Details
#fulfillment_id ⇒ Object (readonly)
Returns the value of attribute fulfillment_id.
4 5 6 |
# File 'app/services/workarea/global_e/update_order_dispatch_request.rb', line 4 def fulfillment_id @fulfillment_id end |
#tracking_number ⇒ Object (readonly)
Returns the value of attribute tracking_number.
4 5 6 |
# File 'app/services/workarea/global_e/update_order_dispatch_request.rb', line 4 def tracking_number @tracking_number end |
Instance Method Details
#as_json(*args) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/services/workarea/global_e/update_order_dispatch_request.rb', line 11 def as_json(*args) { OrderId: order_id, MerchantOrderId: merchant_order_id, DeliveryReferenceNumber: delivery_reference_number, IsCompleted: is_completed, Parcels: parcels, Exceptions: exceptions, TrackingDetails: tracking_details } end |
#delivery_reference_number ⇒ String
Merchant’s internal Delivery Reference Number for this order.
46 47 |
# File 'app/services/workarea/global_e/update_order_dispatch_request.rb', line 46 def delivery_reference_number end |
#exceptions ⇒ Workarea::GlobalE::UpdateOrderDispatchException?
List of UpdateOrderDispatchException objects for this the UpdateOrderDispatchRequest. NOTE either Parcels or Exceptions should be specified. This property is mandatory only if Parcels property has not been specified.
83 84 |
# File 'app/services/workarea/global_e/update_order_dispatch_request.rb', line 83 def exceptions end |
#is_completed ⇒ Boolean
Flag to mark orders as “completed” by the merchant. TRUE if order fulfilment has been completed and no more products will be shipped. FALSE if order fulfilment hasn’t been completed yet.
55 56 57 |
# File 'app/services/workarea/global_e/update_order_dispatch_request.rb', line 55 def is_completed [:shipped, :canceled].include? fulfilment.status end |
#merchant_order_id ⇒ String
Order unique identifier on the Merchant’s site. NOTE either OrderID or MerchantOrderID should be specified. This property is mandatory only if OrderID property has not been specified.
39 40 |
# File 'app/services/workarea/global_e/update_order_dispatch_request.rb', line 39 def merchant_order_id end |
#order_id ⇒ String
Global-e order unique identifier. NOTE either OrderID or MerchantOrderID should be specified. This property is mandatory only if MerchantOrderID property has not been specified.
29 30 31 |
# File 'app/services/workarea/global_e/update_order_dispatch_request.rb', line 29 def order_id order.global_e_id end |
#parcels ⇒ Array<Workarea::GlobalE::Parcel>, Nil
List of Parcel object for this UpdateOrderDispatchRequest. NOTE either Parcels or Exceptions should be specified. This property is mandatory only if Exceptions property has not been specified.
65 66 67 68 69 70 71 72 73 74 |
# File 'app/services/workarea/global_e/update_order_dispatch_request.rb', line 65 def parcels return unless tracking_number.present? @parcels ||= Array.wrap(fulfilment.find_package(tracking_number)).map do |package| GlobalE::Parcel.new( fulfilment, Storefront::PackageViewModel.wrap(package, order: order) ) end end |
#tracking_details ⇒ Workarea::GlobalE::TrackingDetails nil
Tracking information on order level of the parcel in case the merchant does the shipping by itself.
91 92 93 94 95 |
# File 'app/services/workarea/global_e/update_order_dispatch_request.rb', line 91 def tracking_details return unless tracking_number.present? TrackingDetails.new(tracking_number: tracking_number) end |