README.md in active_shipping-1.8.6 vs README.md in active_shipping-1.9.0

- old
+ new

@@ -5,14 +5,12 @@ - Finding shipping rates - Registering shipments - Tracking shipments - Purchasing shipping labels -Active Shipping is currently being used and improved in a production environment for [Shopify][]. Development is being done by the Shopify integrations team (<integrations-team@shopify.com>). Discussion is welcome in the [Active Merchant Google Group][discuss]. +Active Shipping is currently being used and improved in a production environment for [Shopify](http://shopify.com). -[Shopify]:http://www.shopify.com -[discuss]:http://groups.google.com/group/activemerchant ## Supported Shipping Carriers * [UPS](http://www.ups.com) * [USPS](http://www.usps.com) @@ -23,18 +21,33 @@ * [Shipwire](http://www.shipwire.com) * [Stamps](http://www.stamps.com) * [Kunaki](http://www.kunaki.com) * [Australia Post](http://auspost.com.au/) + +## Versions + +Development on `master` is for a pre-release of the `2.x` version of this gem. It includes a number of backwards incompatible changes and improvements. Progress can be tracked in [the milestone](https://github.com/Shopify/active_shipping/milestone/1). + +We are no longer actively developing version `1.x`. We have released `1.9` and will only backport small fixes to this version, on branch `1-9-stable`, and they should be on `master` first. + + ## Installation +Using bundler, add to the `Gemfile`: + ```ruby -gem install active_shipping +gem 'active_shipping' ``` -...or add it to your project's [Gemfile](http://bundler.io/). +Or stand alone: +``` +$ gem install active_shipping +``` + + ## Sample Usage ### Compare rates from different carriers ```ruby @@ -84,10 +97,12 @@ # ["USPS GXG Envelopes", 9400], # ["USPS Global Express Guaranteed Non-Document Rectangular", 9400], # ["USPS Global Express Guaranteed", 9400]] ``` +Dimensions for packages are in `Height x Width x Length` order. + ### Track a FedEx package ```ruby fedex = ActiveShipping::FedEx.new(login: '999999999', password: '7777777', key: '1BXXXXXXXXXxrcB', account: '51XXXXX20') tracking_info = fedex.find_tracking_info('tracking-number', carrier_code: 'fedex_ground') # Ground package @@ -102,42 +117,64 @@ # Arrived at FedEx sort facility at KNOXVILLE, TN on Fri Oct 24 02:45:00 UTC 2008. # Scanned at FedEx sort facility at KNOXVILLE, TN on Fri Oct 24 05:56:00 UTC 2008. # Delivered at Knoxville, TN on Fri Oct 24 16:45:00 UTC 2008. Signed for by: T.BAKER ``` -#### FedEx connection notes +## Carrier specific notes -The :login key passed to ```ActiveShipping::FedEx.new()``` is really the FedEx meter number, not the FedEx login. +### FedEx connection -When developing with test credentials, be sure to pass ```test: true``` to ```ActiveShipping::FedEx.new()``` . +The `:login` key passed to `ActiveShipping::FedEx.new()` is really the FedEx meter number, not the FedEx login. -## Running the tests +When developing with test credentials, be sure to pass `test: true` to `ActiveShipping::FedEx.new()`. -After installing dependencies with `bundle install`, you can run the unit tests with `rake test:unit` and the remote tests with `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, and the format of that file can be seen in the included [credentials.yml](https://github.com/Shopify/active_shipping/blob/master/test/credentials.yml). For some carriers, we have public credentials you can use for testing: see `.travis.yml`. -## Development +## Tests -Yes, please! Take a look at the tests and the implementation of the Carrier class to see how the basics work. At some point soon there will be a carrier template generator along the lines of the gateway generator included in Active Merchant, but the [Carrier class](https://github.com/Shopify/active_shipping/blob/master/lib/active_shipping/carrier.rb) outlines most of what's necessary. The other main classes that would be good to familiarize yourself with are [Location](https://github.com/Shopify/active_shipping/blob/master/lib/active_shipping/location.rb), [Package](https://github.com/Shopify/active_shipping/blob/master/lib/active_shipping/package.rb), and [Response](https://github.com/Shopify/active_shipping/blob/master/lib/active_shipping/response.rb). +You can run the unit tests with: -For the features that you add, you should have both unit tests and remote tests. It's probably best to start with the remote tests, and then log those requests and responses and use them as the mocks for the unit tests. You can see how this works with the USPS tests right now: +``` +bundle exec rake test:unit +``` -[https://github.com/Shopify/active_shipping/blob/master/test/remote/usps_test.rb](https://github.com/Shopify/active_shipping/blob/master/test/remote/usps_test.rb) -[https://github.com/Shopify/active_shipping/blob/master/test/unit/carriers/usps_test.rb](https://github.com/Shopify/active_shipping/blob/master/test/unit/carriers/usps_test.rb) -[https://github.com/Shopify/active_shipping/tree/master/test/fixtures/xml/usps](https://github.com/Shopify/active_shipping/tree/master/test/fixtures/xml/usps) +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`](https://github.com/Shopify/active_shipping/blob/master/test/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](https://github.com/Shopify/active_shipping/blob/master/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](https://github.com/Shopify/active_shipping/blob/master/lib/active_shipping/carrier.rb). + +It would also be good to familiarize yourself with [`Location`](https://github.com/Shopify/active_shipping/blob/master/lib/active_shipping/location.rb), [`Package`](https://github.com/Shopify/active_shipping/blob/master/lib/active_shipping/package.rb), and [`Response`](https://github.com/Shopify/active_shipping/blob/master/lib/active_shipping/response.rb). + +You can use the [`test/console.rb`](https://github.com/Shopify/active_shipping/blob/master/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) +ActiveShipping::USPS.logger = Logger.new(STDOUT) ``` -(This logging functionality is provided by the [`PostsData` module](https://github.com/Shopify/active_utils/blob/master/lib/active_utils/posts_data.rb) in the `active_utils` dependency.) +### Anatomy of a pull request -To debug API requests and your code, you can run `rake console` to start a Pry session with `ActiveShipping` included -and instances of the various carriers set up with your test credentials. -Look at the file [`test/console.rb`](https://github.com/Shopify/active_shipping/blob/master/test/console.rb) to see the other goodies it provides. +Any new features or carriers should have passing unit _and_ remote tests. Look at some existing carriers as examples. -After you've pushed your well-tested changes to your github fork, make a pull request, and we'll take it from there! For more information, see [CONTRIBUTING.md](https://github.com/Shopify/active_shipping/blob/master/CONTRIBUTING.md). +When opening a pull request, include description of the feature, why it exists, and any supporting documentation to explain interaction with carriers. -## Legal Mumbo Jumbo -Unless otherwise noted in specific files, all code in the ActiveShipping project is under the copyright and license described in the included MIT-LICENSE file. +### 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 +