Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

seametrix_ruby

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

seametrix_ruby

  • 1.0.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

SeametrixRuby

Unofficial ruby gem for Seametrix API.

Installation

Add this line to your application's Gemfile:

gem 'seametrix_ruby', git: 'https://github.com/adiwids/seametrix_ruby.git', branch: 'master', require: 'seametrix'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install seametrix_ruby

Usage

:anchor: Ports Service

Search ports by LOCODE or port name (min. 3 characters of LOCODE or port name).

port_result = Seametrix::Ports.get('MTX')

port_result is an instance of PortResult class, plain Ruby object version of JSON response.


:map: Routes Service

# array of starting and end points pairs with <longitude, latitude> format
legs = [
  ["-101.123456, 14.772125", "117.443101, 1.123456"]
]
route_requests = legs.map do |leg|
    start_coord, end_coord = leg
    start_lon, start_lat = start_coord.split(',').map(&:strip)
    end_lon, end_lat = start_coord.split(',').map(&:strip)
    attrs = {
      start_lon: start_lon,
      start_lat: start_lat,
      end_lon: end_lon,
      end_lat: end_lat
    }
    # Other parameter can be added too

    SeametrixRuby::Requests::RouteRequest.new(attrs)
end
route_result = Seametrix::Routes.get(route_requests)

route_result is an instance of RouteResult class, plain Ruby object version of JSON response.


Configuration

Seametrix.configure do |config|
  config.base_url = "<URL of API endpoint> or see Configuration::DEFAULT_BASE_URL value"
  config.access_key = "validAccessKey"
  config.logger = Logger.new(STDOUT) #optional
  config.debugging = false #optional
end

Test

$ bundle exec rake test

Supported Ruby Versions

  • MRI Ruby 2.5.0 and above

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/adiwids/seametrix_ruby. This project is intended to be a safe, and welcoming space for collaboration.

  1. Fork this repository to your Github's.
  2. Create feature branch git checkout -b feature/feature_name.
  3. Commit your changes with descriptive commit message.
  4. Push to the branch to the forked repository on your Github.
  5. Create a Pull Request.

License

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

Credits

FAQs

Package last updated on 20 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc