-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
63 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,65 @@ | ||
[![Gem Version](https://badge.fury.io/rb/ups.svg)](http://badge.fury.io/rb/ups) | ||
[![Dependency Status](https://gemnasium.com/ptrippett/ups.png)](https://gemnasium.com/ptrippett/ups) | ||
[![Build Status](https://travis-ci.org/ptrippett/ups.png?branch=master)](https://travis-ci.org/ptrippett/ups) | ||
[![Coverage Status](https://coveralls.io/repos/ptrippett/ups/badge.svg)](https://coveralls.io/r/ptrippett/ups) | ||
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/ptrippett/ups/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/ptrippett/ups/?branch=master) | ||
[![Gem Version](https://img.shields.io/gem/v/ups.svg?style=flat-square)](http://badge.fury.io/rb/ups) | ||
[![Dependency Status](https://img.shields.io/gemnasium/ptrippett/ups.svg?style=flat-square)](https://gemnasium.com/ptrippett/ups) | ||
[![Build Status](https://img.shields.io/travis/ptrippett/ups.svg?style=flat-square)](https://travis-ci.org/ptrippett/ups) | ||
[![Coverage Status](https://img.shields.io/coveralls/ptrippett/ups.svg?style=flat-square)](https://coveralls.io/r/ptrippett/ups) | ||
[![Code Climate](https://img.shields.io/codeclimate/github/ptrippett/ups.svg?style=flat-square)](https://codeclimate.com/github/ptrippett/ups) | ||
|
||
UPS | ||
=== | ||
# UPS | ||
|
||
UPS Gem for accessing the UPS API from Ruby. Using the gem you can: | ||
- Return quotes from the UPS API | ||
- Book shipments | ||
- Return labels and tracking numbers for a shipment | ||
|
||
This gem is currently used in production at [Veeqo](http://www.veeqo.com) | ||
|
||
## Installation | ||
|
||
gem install ups | ||
|
||
...or add it to your project's [Gemfile](http://bundler.io/). | ||
|
||
## Sample Usage | ||
|
||
### Return rates | ||
|
||
require 'ups' | ||
server = UPS::Connection.new(test_mode: true) | ||
response = server.rates do |rate_builder| | ||
rate_builder.add_access_request 'API_KEY', 'USERNAME', 'PASSWORD' | ||
rate_builder.add_shipper company_name: 'Veeqo Limited', | ||
phone_number: '01792 123456', | ||
address_line_1: '11 Wind Street', | ||
city: 'Swansea', | ||
state: 'Wales', | ||
postal_code: 'SA1 1DA', | ||
country: 'GB', | ||
shipper_number: 'ACCOUNT_NUMBER' | ||
rate_builder.add_ship_from company_name: 'Veeqo Limited', | ||
phone_number: '01792 123456', | ||
address_line_1: '11 Wind Street', | ||
city: 'Swansea', | ||
state: 'Wales', | ||
postal_code: 'SA1 1DA', | ||
country: 'GB', | ||
shipper_number: ENV['UPS_ACCOUNT_NUMBER'] | ||
rate_builder.add_ship_to company_name: 'Google Inc.', | ||
phone_number: '0207 031 3000', | ||
address_line_1: '1 St Giles High Street', | ||
city: 'London', | ||
state: 'England', | ||
postal_code: 'WC2H 8AG', | ||
country: 'GB' | ||
rate_builder.add_package weight: '0.5', | ||
unit: 'KGS' | ||
end | ||
|
||
# Then use... | ||
response.success? | ||
response.graphic_image | ||
response.tracking_number | ||
|
||
## Running the tests | ||
|
||
After installing dependencies with `bundle install`, you can run the unit tests using `rspec`. | ||
|
||
UPS Gem for accessing the UPS API from Ruby |