alta_bikes

Wrapper for getting data from Alta Bike share systems


License
MIT
Install
gem install alta_bikes -v 0.0.1

Documentation

AltaBikes

This gem is just intended to make getting data from AltaBike shares easier for Ruby apps.

Installation

Add this line to your application's Gemfile:

gem 'alta_bikes'

And then execute:

$ bundle

Or install it yourself as:

$ gem install alta_bikes

Usage

Configuration

Configuring can be done in an initializer for the class, or for any single instance of a model.

A list of cities that Alta Bikes have made JSON data available for is kept in a configuration constant

AltaBikes::Configuration::CITIES =
  { :chicago     =>"http://www.divvybikes.com/stations/json",
    :new_york    =>"http://www.citibikenyc.com/stations/json",
    :toronto     =>"http://www.bikesharetoronto.com/stations/json",
    :columbus    =>"http://www.cogobikeshare.com/stations/json",
    :bay_area    =>"http://www.bayareabikeshare.com/stations/json",
    :chattanooga =>"http://www.bikechattanooga.com/stations/json"
  }

config/initializers/alta_bikes.rb

AltaBikes.configure do |config|
  config.json_url = AltaBikes::Configuration::CITIES[:chicago]
  config.stations_root = 'someNewRoot'
end

configure for an instance of a single city

config = AltaBikes::Configuration.new
config.json_url = AltaBikes::Configuration::CITIES[:chicago]
config.stations_root = 'someNewRoot'
city = AltaBikes::City.new(config)

Getting station data

All Stations

Calling #stations will either return the stations_list that is already present, or fetch the stations from the json_url.

stations = city.stations

One Station

station = city.station(32)
=> #<AltaBikes::Station:0x000000049ba448

 @details={ :id=>32,
            :location=>"550 S. Racine",
            :name=>"Racine Ave & Congress Pkwy",
            :longitude=>-87.65703,
            :latitude=>41.87464},

 @stats={ :available_docks=>10,
          :total_docks=>19,
          :available_bikes=>9}>

Contributing

  1. Fork it ( https://github.com/[my-github-username]/alta_bikes/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