Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/edumucelli/rubybikes

A set of Bike Sharing System parsers in Ruby
https://github.com/edumucelli/rubybikes

bike-sharing crawler ruby

Last synced: about 2 months ago
JSON representation

A set of Bike Sharing System parsers in Ruby

Awesome Lists containing this project

README

        

# RubyBikes

RubyBikes was inspired by [PyBikes](https://github.com/eskerda/pybikes).

RubyBikes has two main concepts, _labels_ and _tags_.

For instance, if you want to get information from the stations in the 'Encicla' (Medellin, Colombia) system, you'd use:

```ruby
require 'rubybikes'

bikes = RubyBikes.new
encicla = bikes.get({'tag' => 'encicla'})
encicla.update
encicla.stations.each do |station|
puts "#{station.name}, #{station.latitude}, #{station.longitude}, #{station.free}, #{station.bikes}"
end
```

Currently, RubyBikes supports 270 system tags, i.e., 270 bike-sharing systems around the world.
For the complete list of tags, check out documentation, or use the tags method, `puts bikes.tags`.

However, generally a set bike-sharing systems belong to the same company, which we call _label_.

If you want, for instance, get all the systems within JCDecaux' Cyclocity system, which encompasses, 'velib' (Paris, France), 'velov' (Lyon, France), 'sevici' (Sevilla, Spain), etc., you'd use:

```ruby
instances = bikes.get({'label' => 'Cyclocity', 'api_key' => 'API_KEY'})
# each 'instance' is a system, i.e., a 'tag' system
instances.each do |instance|
instance.stations.each do |station|
puts "#{station.name}, #{station.latitude}, #{station.longitude}, #{station.free}, #{station.bikes}"
end
end
```

In this case here, `API_KEY` is required in Cyclocity systems. This is the only system contained in RubyBikes that asks for a `API_KEY`.