ActiveShipping is a simple shipping abstraction library extracted from Shopify
ActiveShipping is a simple shipping abstraction library extracted from Shopify
This library interfaces with the web services of various shipping carriers. The goal is to abstract the features that are most frequently used into a pleasant and consistent Ruby API:
Note: 2.x contains breaking changes, please see the changelog. Shopify will not be actively contributing to the 2.x version of this gem and is looking for maintainers.
See our releases for past versions.
Using bundler, add to the Gemfile:
gem 'active_shipping'Or stand alone:
$ gem install active_shipping…Dimensions for packages are in Height x Width x Length order.
…The :login key passed to ActiveShipping::FedEx.new() is really the FedEx meter number, not the FedEx login.
When developing with test credentials, be sure to pass test: true to ActiveShipping::FedEx.new().
You can run the unit tests with:
bundle exec rake test:unitand the remote tests with:
bundle exec rake test:remoteThe unit tests mock out requests and responses so that everything runs locally, while the remote tests actually hit the carrier servers. For the remote tests, you'll need valid test credentials for any carriers' tests you want to run. The credentials should go in ~/.active_shipping/credentials.yml. For some carriers, we have public credentials you can use for testing in .travis.yml. Remote tests missing credentials will be skipped.
See CONTRIBUTING.md.
We love getting pull requests! Anything from new features to documentation clean up.
If you're building a new carrier, a good place to start is in the Carrier base class.
It would also be good to familiarize yourself with Location, Package, and Response.
You can use the test/console.rb to do some local testing against real endpoints.
To log requests and responses, just set the logger on your Carrier class to some kind of Logger object:
ActiveShipping::USPS.logger = Logger.new(STDOUT)Any new features or carriers should have passing unit and remote tests. Look at some existing carriers as examples.
When opening a pull request, include description of the feature, why it exists, and any supporting documentation to explain interaction with carriers.
git checkout -b my-new-feature)git commit -am 'Add some feature')git push origin my-new-feature)No open issues yet, or sync has not completed.