Class: Deliveries::Couriers::MondialRelay::Pickups::Create::FormatParams
- Inherits:
-
Object
- Object
- Deliveries::Couriers::MondialRelay::Pickups::Create::FormatParams
- Defined in:
- lib/deliveries/couriers/mondial_relay/pickups/create/format_params.rb
Instance Attribute Summary collapse
-
#language ⇒ Object
Returns the value of attribute language.
-
#parcels ⇒ Object
Returns the value of attribute parcels.
-
#pickup_date ⇒ Object
Returns the value of attribute pickup_date.
-
#receiver ⇒ Object
Returns the value of attribute receiver.
-
#reference_code ⇒ Object
Returns the value of attribute reference_code.
-
#remarks ⇒ Object
Returns the value of attribute remarks.
-
#sender ⇒ Object
Returns the value of attribute sender.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(sender:, receiver:, parcels:, reference_code:, pickup_date:, remarks:, language:) ⇒ FormatParams
constructor
A new instance of FormatParams.
Constructor Details
#initialize(sender:, receiver:, parcels:, reference_code:, pickup_date:, remarks:, language:) ⇒ FormatParams
Returns a new instance of FormatParams.
9 10 11 12 13 14 15 16 17 |
# File 'lib/deliveries/couriers/mondial_relay/pickups/create/format_params.rb', line 9 def initialize(sender:, receiver:, parcels:, reference_code:, pickup_date:, remarks:, language:) self.sender = sender self.receiver = receiver self.parcels = parcels self.reference_code = reference_code self.pickup_date = pickup_date self.remarks = remarks self.language = language end |
Instance Attribute Details
#language ⇒ Object
Returns the value of attribute language.
7 8 9 |
# File 'lib/deliveries/couriers/mondial_relay/pickups/create/format_params.rb', line 7 def language @language end |
#parcels ⇒ Object
Returns the value of attribute parcels.
7 8 9 |
# File 'lib/deliveries/couriers/mondial_relay/pickups/create/format_params.rb', line 7 def parcels @parcels end |
#pickup_date ⇒ Object
Returns the value of attribute pickup_date.
7 8 9 |
# File 'lib/deliveries/couriers/mondial_relay/pickups/create/format_params.rb', line 7 def pickup_date @pickup_date end |
#receiver ⇒ Object
Returns the value of attribute receiver.
7 8 9 |
# File 'lib/deliveries/couriers/mondial_relay/pickups/create/format_params.rb', line 7 def receiver @receiver end |
#reference_code ⇒ Object
Returns the value of attribute reference_code.
7 8 9 |
# File 'lib/deliveries/couriers/mondial_relay/pickups/create/format_params.rb', line 7 def reference_code @reference_code end |
#remarks ⇒ Object
Returns the value of attribute remarks.
7 8 9 |
# File 'lib/deliveries/couriers/mondial_relay/pickups/create/format_params.rb', line 7 def remarks @remarks end |
#sender ⇒ Object
Returns the value of attribute sender.
7 8 9 |
# File 'lib/deliveries/couriers/mondial_relay/pickups/create/format_params.rb', line 7 def sender @sender end |
Instance Method Details
#execute ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/deliveries/couriers/mondial_relay/pickups/create/format_params.rb', line 19 def execute params = { 'Enseigne' => Deliveries::Couriers::MondialRelay.config(:mondial_relay_merchant), 'ModeCol' => 'REL', 'ModeLiv' => 'LCC', 'COL_Rel_Pays' => 'XX', 'COL_Rel' => 'AUTO', 'NDossier' => reference_code, 'Expe_Langage' => language.to_s.upcase, 'Expe_Ad1' => sender.name, 'Expe_Ad3' => sender.street, 'Expe_Ville' => sender.city, 'Expe_CP' => sender.postcode, 'Expe_Pays' => sender.country, 'Expe_Tel1' => sender.phone, 'Expe_Mail' => sender.email, 'Dest_Langage' => language.to_s.upcase, 'Dest_Ad1' => receiver.name, 'Dest_Ad3' => receiver.street, 'Dest_Ville' => receiver.city, 'Dest_CP' => receiver.postcode, 'Dest_Pays' => receiver.country, 'Dest_Tel1' => receiver.phone, 'Dest_Mail' => receiver.email, 'NbColis' => parcels, 'Instructions' => I18n.transliterate(remarks.to_s).gsub(%r{[^0-9A-Z_\-'., /]}i, '').upcase.truncate(30, omission: '') } defaults = Shipments::Create::Defaults::PARAMS defaults.merge(params) end |