Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
A

active_shipping

> 编程语言
Open source

ActiveShipping is a simple shipping abstraction library extracted from Shopify

816 stars0 likes1 views
WebsiteGitHub

About

ActiveShipping is a simple shipping abstraction library extracted from Shopify

ActiveShipping

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:

  • Finding shipping rates
  • Registering shipments
  • Tracking shipments
  • Purchasing shipping labels

Supported Shipping Carriers

  • USPS
  • USPS Returns
  • FedEx
  • Canada Post
  • New Zealand Post
  • Shipwire
  • Stamps
  • Kunaki
  • Australia Post

Versions

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.

Installation

Using bundler, add to the Gemfile:

ruby
gem 'active_shipping'

Or stand alone:

$ gem install active_shipping

Sample Usage

Compare rates from different carriers

…

Dimensions for packages are in Height x Width x Length order.

Track a FedEx package

…

Carrier specific notes

FedEx connection

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().

Tests

You can run the unit tests with:

bundle exec rake test:unit

and the remote tests with:

bundle exec rake test:remote

The 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.

Contributing

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:

ruby
ActiveShipping::USPS.logger = Logger.new(STDOUT)

Anatomy of a pull request

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.

How to contribute

  1. Fork it ( https://github.com/Shopify/active_shipping/fork )
  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 a new Pull Request

Issues· 55 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rubyshipping

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言