A Ruby wrapper for the shipcloud API
Add this line to your application's Gemfile:
gem 'shipcloud'
And then execute:
$ bundle
Or install it yourself as:
$ gem install shipcloud
Before using the shipcloud API, you need to set the API access key:
Shipcloud.api_key = 'your-api-key-goes-here'
Since Version 0.4.0, you can also do this via a configuration block, e.g. in an initializer:
Shipcloud.configure do |config|
config.api_key = 'your-api-key-goes-here'
end
You can sign up for a developer account at shipcloud.io
To create a new Shipment on the shipclod platform, you need to provide the name of the carrier, to- and from-address, and the package dimensions. For details, see shipcloud API documentation on Shipments
Shipcloud::Shipment.create(
carrier: 'ups',
from: from-address-params,
to: to-address-params,
package: package-params,
create_shipping_label: true
)
Shipment#create
will return shipping label and tracking information, encapsulated in a Shipcloud::Shipment
object:
shipment = Shipcloud::Shipment.create(...) # parameters ommitted
shipment.tracking_url # -> http://track.shipcloud.io/uzdgu22z3ed12
- 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