0.0
No commit activity in last 3 years
No release in over 3 years
(DEPRECATED, see dpd_shipping) A simple way to access the iloxx shipping API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 2.11.0
~> 1.13.0

Runtime

~> 2.2.0
 Project Readme

Dpd::Shipping

Gem Version Build Status

This gem is a wrapper around the SOAP-based API provided by iloxx. It works both for DPD and iloxx customers. It allows you to build and send a shipment request and return a shipping label and the parcel numbers. The gem was formerly known as iloxx_shipping.

Installation

Add this line to your application's Gemfile:

gem 'dpd_shipping'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dpd_shipping

Usage

  1. Create a new receiver address:

     receiver = Dpd::Shipping::Address.new({
       :name => "Lilly Lox",
       :street => "Gutenstetter Str. 8b",
       :zip => "90449",
       :city => "Nürnberg",
       :country_code => "DE"
     })
    
  2. Create a new parcel

     parcel = Dpd::Shipping::Parcel.new(
       weight: 1.25,
       content: "Stones",
       address: receiver,
       service: Dpd::Shipping::NormalpaketService.new,
       # ^- or use ExpressService or RetoureService (with parameters) instead
       reference: "Order #1234",
     )
    
  3. Submit your parcel

     config = {
       user: "Your DPD/iloxx User ID",
       token: "Your DPD/iloxx User Token",
     }
     api = Dpd::Shipping::API.new(config, {
       test: true # If test is set, all API calls go against the test system
     })
     shipment_date = Date.today
     result = api.add_order(parcel, shipment_date)
    
  4. Receive the parcel number and label pdf

     result[:shipments].each do |shipment|
       p shipment[:parcel_number]
     end
    
     # base64 encoded label.pdf in result[:label_data] - lets save it to disk:
    
     f = File.open('label.pdf', 'w')
     begin
       f.write Base64.decode64(result[:label_data])
     ensure
       f.close unless f.nil?
     end
    

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Thanks

  • iloxx AG for providing the documentation for their SOAP API
  • savon for a nice soap abstraction library