Class: Deliveries::Couriers::MondialRelay::Shipments::Trace::FormatResponse
- Inherits:
-
Object
- Object
- Deliveries::Couriers::MondialRelay::Shipments::Trace::FormatResponse
- Defined in:
- lib/deliveries/couriers/mondial_relay/shipments/trace/format_response.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(response:) ⇒ FormatResponse
constructor
A new instance of FormatResponse.
Constructor Details
#initialize(response:) ⇒ FormatResponse
Returns a new instance of FormatResponse.
11 12 13 |
# File 'lib/deliveries/couriers/mondial_relay/shipments/trace/format_response.rb', line 11 def initialize(response:) self.response = response end |
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
9 10 11 |
# File 'lib/deliveries/couriers/mondial_relay/shipments/trace/format_response.rb', line 9 def response @response end |
Instance Method Details
#execute ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/deliveries/couriers/mondial_relay/shipments/trace/format_response.rb', line 15 def execute statuses = response[:tracing][:ret_wsi2_sub_tracing_colis_detaille].delete_if do |key, _value| key[:libelle].blank? end tracking_info_params = {} tracking_info_params[:courier_id] = 'mondial_relay' tracking_info_params[:status] = shipment_status(response[:stat].to_i, last_status(statuses)) tracking_info_params[:checkpoints] = formatted_checkpoints(statuses) tracking_info_params end |