Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

102 Commits

Repository files navigation

Geotab

Ruby wrapper for the Geotab SDK API inspired by ActiveRecord.

Add this line to your application's Gemfile:

gem"geotab",git: "https://github.com/rarestep/geotab.git",tag: "v0.0.1"

And then execute:

$ bundle

Or install it yourself as:

$ gem install geotab

Usage

Global connection configuration

Geotab.configdo |c|
c.username="<username>"c.password="<password>"c.database="<database>"c.path="myxx.geotab.com"endGeotab::Device.all

Or inline connection

client=Geotab::Client.newclient.authenticate("<username>","<password>","<database>")Geotab::Device.with_connection(client).all

Or inside of a block

client=Geotab::Client.newclient.authenticate("<username>","<password>","<database>")Geotab.with_connection(client)dodevices=Geotab::Device.allfault_data=Geotab::FaultDatum.allend

Geotab resources are modeled after ActiveRecord models. They have access to .all, .where, .find, and .first. The where method is chainable. Next step is to add support for .update.

# Returns an array of devicesGeotab::Device.all# Returns a single deviceGeotab::StatusDatum.firstGeotab::Diagnostic.find("b1")# Where clauses are chainable. Conditions should follow Geotab SDK syntaxGeotab::Device.where({"serialNumber"=>"G7B020D3E1A4"}).where({"name"=>"07 BMW 335i"}).first# Some resources have associated resources and can be queried as suchdevice=Geotab::Device.find("b1")# Returns associated StatusData objectsdevice.status_data# Returns device's current GPS locationdevice.location=>{:date=>"2015-08-18T19:54:49.063Z",:bearing=>140,:current_state_duration=>"06:04:46.063",:is_device_communicating=>true,:is_driving=>false,:latitude=>33.511528,:longitude=>-86.8136673,:speed=>0.0}

Contributing

  1. Fork it ( https://github.com/[my-github-username]/geotab/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

Geotab integration gem

Resources

Stars

9 stars

Watchers

41 watching

Forks

Releases

Packages

Contributors

Languages