Sha256: 7554b6fddf1d5726be1cc0d248660d2cc68c7943be94db97ba03350374e072aa

Contents?: true

Size: 1.68 KB

Versions: 1

Compression:

Stored size: 1.68 KB

Contents

# ShippingScale

ShippingScale is a simple interface with the USPS Price Calculator API.  With it, you can quickly and easily calculate postage prices for packages.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'shipping-scale'

# or from the github repository
gem 'shipping-scale', :git => 'https://github.com/jereinhardt/shipping-scale.git'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install shipping-scale

## Setup

In order to properly configure your interface, you must first have a registered developer account with the US Postal Service.  

Add an initializer to your application and configure it to use your API USER ID

```ruby 
ShippingScale.configure do |config|
  config.user_id = ENV["USPS_USER_ID"]
  config.timeout = 5
  config.testing = false
end
```

## Usage

If you have all of the necessary information for the package you want to ship, using the gem is as simples as creating an instance of `ShipingScale::Package` and using `#get_price!`.  Other details are also returned with this method.

```ruby
package_options = { 
  weight: 1,
  length: 3,
  width: 2,
  height: 3,
  zip_origin: "66204",
  zip_destination: "63501" 
}

package = ShippingScale::Package.new(package_options)

package.get_price!

# for the floating point value of postage
package.price # => 15

# for other details sent back from the request
package.details # => { zip_origination: "66204", zip_destination: "63501", pounds: "1", ... }
```


## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

Bug reports and pull requests are welcome on GitHub at https://github.com/jereinhardt/shipping-scale.


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shipping-scale-0.1.0 README.md