Skip to content

sylogix/mondial_relay

Repository files navigation

Mondial Relay API client

Build Status Gem Version

The gem works as an interface to the Mondial Relay Web service.

Usage

Detailed usage examples and available options can be obtained in a gem's docs.

Getting started

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',
)

Parcel Shops

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.

Labels

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.

Shipments

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

Documentation is generated using Yard.

Contribution

  • Each endpoint (operation) should be documented.
  • Each entity (e.g. parcel shop) should provide a public interface to query the API.