Module: DublinBikes::Client::Stations
- Included in:
- DublinBikes::Client
- Defined in:
- lib/dublin_bikes/client/stations.rb
Instance Method Summary collapse
Instance Method Details
#stations ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/dublin_bikes/client/stations.rb', line 4 def stations @_stations ||= begin response = get('carto') payload = response.body marker_list = DublinBikes::ApiMarkerList.parse(payload, single: true) marker_list.markers.map do |marker| DublinBikes::Station.new(marker) end end end |
#stations_closest_to(lat, lng) ⇒ Object
15 16 17 |
# File 'lib/dublin_bikes/client/stations.rb', line 15 def stations_closest_to(lat, lng) stations.sort_by { |station| station.distance_to(lat, lng) } end |