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

alta_bikes

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alta_bikes

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

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 = Openscoring::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.stations(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

FAQs

Package last updated on 04 Nov 2014

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