The gem works as an interface to the Mondial Relay Web service.
Detailed usage examples and available options can be obtained in a gem's docs.
Several configurations such as debug
mode or api_timeout
can be setup as the following:
MondialRelay.configure do |config|
config.debug = true
# .. Other configurations
end
A merchant account with Mondial Relay Web service credentials must be created:
merchant_account = MondialRelay::Account.new(
'Your Merchant ID',
'Your Private Key',
)
Do the parcel shop search:
MondialRelay::ParcelShops::Search.for(
merchant_account,
country: 'FR',
postal_code: '75010',
latitude: '48.8711706',
longitude: '02.3602504',
)
See the docs for a detailed list of search options.
Create a shipment and return its number with a label url:
MondialRelay::Labels::Create.for(
merchant_account,
collection_mode: 'REL',
delivery_mode: '24R',
sender_language: 'FR',
sender_name: 'Test Sender',
# ...
)
Fetch labels of several sizes for provided shipments:
MondialRelay::Labels::Fetch.for(
merchant_account,
shipment_numbers: '31236189',
language: 'FR',
)
See the docs for a detailed list of options.
Create a shipment and return its number with some extra information:
MondialRelay::Shipments::Create.for(
merchant_account,
collection_mode: 'REL',
delivery_mode: '24R',
sender_language: 'FR',
sender_name: 'Test Sender',
# ...
)
Get the shipment details:
MondialRelay::Shipments::Trace.for(
merchant_account,
shipment_number: '31236189',
language: 'FR',
)
See the docs for a detailed list of options.
Documentation is generated using Yard.
- Each endpoint (operation) should be documented.
- Each entity (e.g. parcel shop) should provide a public interface to query the API.