Skip to content
/ ups Public
forked from chirag7jain/ups

Gem for accessing the UPS API from Ruby

License

Notifications You must be signed in to change notification settings

matt423/ups

 
 

Repository files navigation

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

This gem is currently used in production at Veeqo

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.

About

Gem for accessing the UPS API from Ruby

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%