Gem for accessing the UPS API from Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
spec Bump the bundle Oct 30, 2017
.DS_Store Bump the bundle Oct 30, 2017
.gitignore Initial Commit Apr 23, 2015
.hound.yml
.rubocop.yml
.ruby-gemset
.ruby-version Bump the bundle Oct 30, 2017
.travis.yml Bump the bundle Oct 30, 2017
Changelog.md Update Changelog Mar 25, 2016
Gemfile
Gemfile.lock
LICENSE.txt
README.md
Rakefile
ups.gemspec Bump the bundle Oct 30, 2017

README.md

Gem Version Dependency Status Build Status Coverage Status Code Climate

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

Installation

gem install ups

...or add it to your project's Gemfile.

Documentation

Yard documentation can be found at RubyDoc.

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.

Contributers

Thanks to the following contributers to this project.

  • CJ - Method to generate labels in available other formats [EPL, ZPL], Constant for packaging type.