Project

hailo

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Provides easy way to interact with the HAILO API in any kind of application
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5
~> 3.3
>= 10.0.0, ~> 10.0
~> 2.6
 Project Readme

Gem for HAILO API ( hailocab.com )

Gem Version Code Climate Gratipay

This is a Ruby Gem for the hailocab.com API. It should simplify the process of consuming data from the HAILO API for developers using Ruby.

Installation

Add following to your application Gemfile

gem 'hailo'

Then execute

$ bundle install

Or install it just like that

$ gem install hailo

Usage

It's pretty straightforward. Sample script using Hailo API:

#!/usr/bin/env ruby
require 'hailo'
require 'ap'

CFG_USER_KEY  = 'potatoKey'

client = Hailo::Client.new({ app_user_key: CFG_USER_KEY, api_host: 'https://api.hailoapp.com' })
result = client.drivers_near(:latitude => '51.512555', :longitude => '-0.127716')
ap result[0].service_type

result = client.drivers_eta(:latitude => '51.512555', :longitude => '-0.127716')
ap result

Gives following output. JSON from return has been converted into object to make it easier to query.

{
    "drivers" => [
        [0] {
                "latitude" => 51.51025,
               "longitude" => -0.1269102,
            "service_type" => "regular"
        },
        [1] {
                "latitude" => 51.512363,
               "longitude" => -0.13302514,
            "service_type" => "regular"
        },
        [2] {
                "latitude" => 51.510216,
               "longitude" => -0.117230095,
            "service_type" => "regular"
        },
        [3] {
                "latitude" => 51.516865,
               "longitude" => -0.1368112,
            "service_type" => "regular"
        }
    ]
}
{
    "etas" => [
        [0] {
                     "eta" => 5,
                   "count" => 4,
            "service_type" => "regular"
        }
    ]
}