Skip to content

vinted/packlink_lite

Repository files navigation

PacklinkLite

Build Status

Packlink.com API client

Installation

Add this line to your application's Gemfile:

gem 'packlink_lite'

Configuration

PacklinkLite.configure do |config|
  config.api_key = ENV['PACKLINK_API_KEY']
  config.testing = true
end

API key can be passed via options too:

PacklinkLite::Service.all(query, api_key: 'mykey')
PacklinkLite::Order.create(order_hash, api_key: 'mykey')

Usage

Fetch services list

services = PacklinkLite::Service.all(
  from: { country: 'DE', zip: 56457 },
  to: { country: 'DE', zip: 56457 },
  packages: { 0 => { width: 10, height: 10, length: 10, weight: 1 } }
)

Create order

order = PacklinkLite::Order.create(order_hash)

Fetch shipment tracking

tracking_history = PacklinkLite::TrackingHistory.find(shipment_reference)

Set callback urls

PacklinkLite.change_shipment_callback_url(url)
PacklinkLite.change_tracking_callback_url(url)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/vinted/packlink_lite.

License

The gem is available as open source under the terms of the MIT License.