Iloxx::Shipping
This gem is a wrapper around the SOAP-based API provided by iloxx. It allows you to build and send a shipment request and return a shipping label and the parcel numbers.
DEPRECATED
This gem has been renamed to dpd_shipping.
Installation
Add this line to your application's Gemfile:
gem 'iloxx_shipping'
And then execute:
$ bundle
Or install it yourself as:
$ gem install iloxx_shipping
Usage
Create a new receiver address:
receiver = Iloxx::Shipping::Address.new({ :name => "Lilly Lox", :street => "Gutenstetter Str. 8b", :zip => "90449", :city => "Nürnberg", :country_code => "DE" })
Create a new parcel
parcel = Iloxx::Shipping::Parcel.new( weight: 1.25, content: "Stones", address: receiver, service: Iloxx::Shipping::NormalpaketService.new, # ^- or use ExpressService or RetoureService (with parameters) instead reference: "Order #1234", )
Submit your parcel
config = { user: "Your Iloxx User ID", token: "Your Iloxx User Token", } api = Iloxx::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)
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
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Thanks
- iloxx AG for providing the documentation for their SOAP API
- savon for a nice soap abstraction library