Skip to content

andre-lgf/searates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SeaRates

Ruby gem to make requests to SeaRates REST API in a simple and easy way.

Installation

Add this line to your application's Gemfile:

gem 'searates'

And then execute:

$ bundle

Or install it yourself as:

$ gem install searates

Usage

Run the Generator:

$ rails g searates:install

Place your API Key as an environment variable at your server or replace the ENV value in the initializer initializers/searates.rb

Searates.configure do |config|
  config.api_key = ENV['SEARATES_API_KEY']
  #config.api_key = 'XXXXXXXXXXXXXXXX'
end

Logistics Explorer - FCL Rates

To make requests, simple call the API you want and store the return in a variable. e.g.

response = Searates::API::LogisticsExplorer.get_fcl_rates(lat_from, lng_from, lat_to, lng_to)

you can also pass true after the lng_to value if you also want the route info.

Logistics Explorer - LCL Rates

  • Weight of cargo in kg
  • Volume of cargo in CBM
response = Searates::API::LogisticsExplorer.get_lcl_rates(lat_from, lng_from, lat_to, lng_to, volume, weight)

Logistics Explorer - Sea Route

response = Searates::API::LogisticsExplorer.get_sea_route(lat_from, lng_from, lat_to, lng_to)

Logistics Explorer - Air Rates

  • Weight of cargo in tons
response = Searates::API::LogisticsExplorer.get_air_rates(lat_from, lng_from, lat_to, lng_to, weight)

Logistics Explorer - Rail Rates

response = Searates::API::LogisticsExplorer.get_rail_rates(lat_from, lng_from, lat_to, lng_to)

Logistics Explorer - Road Rates

  • Weight of cargo in kg
  • Volume of cargo in CBM
  • Type of shipment. The available values for this parameter are: LTL | FTL | CONTAINER (optional) Default value: CONTAINER
  • Container type. The available values for this parameter are: 20st | 40st | 40hq | 20ref | 40ref (optional) Default value: 20st
response = Searates::API::LogisticsExplorer.get_road_rates(lat_from, lng_from, lat_to, lng_to, volume, weight, type, container)

For more information, please visit the official API documentation

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/andre-lgf/searates.

License

The gem is available as open source under the terms of the MIT License.

About

REST API consumer for SeaRates

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published