Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/edumucelli/rubybikes
- Owner: edumucelli
- License: agpl-3.0
- Created: 2017-09-09T15:20:19.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-11T21:26:42.000Z (over 7 years ago)
- Last Synced: 2024-11-06T02:12:08.553Z (3 months ago)
- Topics: bike-sharing, crawler, ruby
- Language: Ruby
- Size: 945 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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`.