EasyshipRatesRubyApi
Installation
Add this line to your application's Gemfile:
gem 'easyship-rates-ruby-api'
And then execute:
$ bundle
Or install it yourself as:
$ gem install easyship-rates-ruby-api
Usage
Create a file:
config/initializers/easyship_rate_ruby_api.rb
require 'easyship_rates_ruby_api'
EasyshipRatesRubyApi.configure do |config|
config.uid = 'RATE_CALCULATOR_APPID'
config.secret = 'RATE_CALCULATOR_SECRET'
# if you want to use sandbox
config.sandbox = true
end
Get Rate
client = EasyshipRatesRubyApi::Client.new
client.get_token
client.get_rate(length: 1, width: 1, height: 1, origin_country_id: 96, destination_country_id: 199, total_actual_weight: 1)
Get All Rates
client = EasyshipRatesRubyApi::Client.new
client.get_token
params = {
origin_country_id: 96,
destination_country_id: 199,
is_insured: true,
items: [
{ category_id: 1, actual_weight: 30, length: 1, width: 1, height: 1, declared_customs_value: 100, declared_currency: 'HKD' }
]
}
client.get_all_rates(params)
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake test
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/easyship/easyship-rates-ruby-api.