Velov
Velov is a ruby wrapper for Velov API (Public Bike Sharing System of Lyon, France). This Wrapper allows you to play with objects like bike's stations !
Installation
Add this line to your application's Gemfile:
gem 'velov'
And then execute:
bundle install
Or install it yourself as:
gem install velov
Usage
Start with the Velov API
Fetch data of all stations in one call:
station_list = Velov::StationList.fetch
station_list.size # => 349
Navigate through the data with an Array of Station:
stations = station_list.to_a
stations.each do |station|
puts station.name
end
Play with stations
Find a specific station with its internal ID:
station = Velov::Station.find_by_number(10117)
station.status # => "OPEN"
Want more attributes ? Try one of these for a station:
- number (internal ID)
- name
- address
- address_complement
- city
- district_number
- bonus
- position (some indications to find the station)
- lat (latitude)
- lng (longitude)
- bike_stands (count of bike stands at this station)
- status ("OPEN" or "CLOSED")
- available_bike_stands (free slots)
- available_bikes (ready to ride ?)
- availability_code (internal usage)
- availability_label (internal usage)
- last_update (last time data were updated)
Use the data
Get reports for a list of stations:
station_list.bike_stands # => 6832
station_list.available_bike_stands # => 3534
station_list.available_bikes # => 3022
Discover if you can reach a specific station:
station.distance_to(45.8,4.9) # => 2.48 (km)
Find the nearest stations around you:
station_list.nearest(45.8,4.9)
Know the distance you will walk in a specified trip
station_list.walking_distance([45.8,4.9],[46.1,4.8])
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request