Module: Deliveries::Couriers::MondialRelayDual
- Extended by:
- Deliveries::Courier
- Defined in:
- lib/deliveries/couriers/mondial_relay_dual.rb,
lib/deliveries/couriers/mondial_relay_dual/address.rb,
lib/deliveries/couriers/mondial_relay_dual/shipments/create.rb,
lib/deliveries/couriers/mondial_relay_dual/pickups/create/format_params.rb,
lib/deliveries/couriers/mondial_relay_dual/shipments/create/format_params.rb
Defined Under Namespace
Modules: Pickups, Shipments Classes: Address, Config
Constant Summary collapse
- API_ENDPOINT_LIVE =
'https://connect-api.mondialrelay.com/api/shipment'.freeze
- API_ENDPOINT_TEST =
'https://connect-api-sandbox.mondialrelay.com/api/shipment'.freeze
Class Method Summary collapse
- .create_pickup(sender:, receiver:, parcels:, reference_code:, pickup_date: nil, remarks: nil, language: nil) ⇒ Object
- .create_shipment(sender:, receiver:, parcels:, reference_code:, collection_point: nil, shipment_date: nil, remarks: nil, language: nil) ⇒ Object
- .get_collection_point(global_point_id:) ⇒ Object
- .get_collection_points(country:, postcode:) ⇒ Object
- .get_label ⇒ Object
- .get_labels ⇒ Object
- .pickup_info(tracking_code:, language: nil) ⇒ Object
- .shipment_info(tracking_code:, language: nil) ⇒ Object
Methods included from Deliveries::Courier
config, configure, configured?, live?, test?
Class Method Details
.create_pickup(sender:, receiver:, parcels:, reference_code:, pickup_date: nil, remarks: nil, language: nil) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/deliveries/couriers/mondial_relay_dual.rb', line 61 def create_pickup(sender:, receiver:, parcels:, reference_code:, pickup_date: nil, remarks: nil, language: nil) params = Pickups::Create::FormatParams.new( sender: sender, receiver: receiver, parcels: parcels, reference_code: reference_code, remarks: remarks, language: language ).execute tracking_code, pdf_url = Shipments::Create.new( params: params ).execute.values_at(:tracking_code, :pdf_url) Deliveries::Pickup.new( courier_id: 'mondial_relay_dual', sender: sender, receiver: receiver, parcels: parcels, reference_code: reference_code, tracking_code: tracking_code, pickup_date: pickup_date, label: Label.new(url: pdf_url) ) end |
.create_shipment(sender:, receiver:, parcels:, reference_code:, collection_point: nil, shipment_date: nil, remarks: nil, language: nil) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/deliveries/couriers/mondial_relay_dual.rb', line 34 def create_shipment(sender:, receiver:, parcels:, reference_code:, collection_point: nil, shipment_date: nil, remarks: nil, language: nil) params = Shipments::Create::FormatParams.new( sender: sender, receiver: receiver, parcels: parcels, collection_point: collection_point, reference_code: reference_code, remarks: remarks, language: language ).execute tracking_code, pdf_url = Shipments::Create.new( params: params ).execute.values_at(:tracking_code, :pdf_url) Deliveries::Shipment.new( courier_id: 'mondial_relay_dual', sender: sender, receiver: receiver, parcels: parcels, reference_code: reference_code, tracking_code: tracking_code, shipment_date: shipment_date, label: Label.new(url: pdf_url) ) end |
.get_collection_point(global_point_id:) ⇒ Object
30 31 32 |
# File 'lib/deliveries/couriers/mondial_relay_dual.rb', line 30 def get_collection_point(global_point_id:) MondialRelay.get_collection_point(global_point_id: global_point_id) end |
.get_collection_points(country:, postcode:) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/deliveries/couriers/mondial_relay_dual.rb', line 23 def get_collection_points(country:, postcode:) MondialRelay.get_collection_points( country: country, postcode: postcode ) end |
.get_label ⇒ Object
96 97 98 |
# File 'lib/deliveries/couriers/mondial_relay_dual.rb', line 96 def get_label(**) raise NotImplementedError, 'This courier does not support get_label operation' end |
.get_labels ⇒ Object
100 101 102 |
# File 'lib/deliveries/couriers/mondial_relay_dual.rb', line 100 def get_labels(**) raise NotImplementedError, 'This courier does not support get_labels operation' end |
.pickup_info(tracking_code:, language: nil) ⇒ Object
92 93 94 |
# File 'lib/deliveries/couriers/mondial_relay_dual.rb', line 92 def pickup_info(tracking_code:, language: nil) MondialRelay.pickup_info(tracking_code: tracking_code, language: language) end |
.shipment_info(tracking_code:, language: nil) ⇒ Object
88 89 90 |
# File 'lib/deliveries/couriers/mondial_relay_dual.rb', line 88 def shipment_info(tracking_code:, language: nil) MondialRelay.shipment_info(tracking_code: tracking_code, language: language) end |