Class: TflApi::Client::BikePoint
- Inherits:
-
Object
- Object
- TflApi::Client::BikePoint
- Defined in:
- lib/tfl_api_client/bike_point.rb
Overview
This class communicates with the TFL “/BikePoint” API to obtain details about bike points locations based upon their IDs or by their latitude and longitude values.
Instance Method Summary collapse
-
#initialize(client) ⇒ BikePoint
constructor
Initialize the BikePoint object and store the reference to Client object.
-
#location(id) ⇒ hash
Returns the all details known by the TFL service for the given BikePoint id.
-
#locations ⇒ Array
Returns all BikePoint locations known by the TFL service.
-
#locations_within_bounding_box(sw_latitude, sw_longitude, ne_latitude, ne_longitude) ⇒ Array
Returns all BikePoint locations known by the TFL service within a the given box based upon it’s defined corner locations.
-
#locations_within_locus(latitude, longitude, radius) ⇒ Array
Returns all BikePoint locations known by the TFL service within a particular position or place (a locus).
-
#search(query) ⇒ Array
Returns all BikePoint locations known by the TFL service within based upon the given search query.
Constructor Details
#initialize(client) ⇒ BikePoint
Initialize the BikePoint object and store the reference to Client object
40 41 42 |
# File 'lib/tfl_api_client/bike_point.rb', line 40 def initialize(client) @client = client end |
Instance Method Details
#location(id) ⇒ hash
Returns the all details known by the TFL service for the given BikePoint id.
59 60 61 |
# File 'lib/tfl_api_client/bike_point.rb', line 59 def location(id) @client.get("/BikePoint/#{id}") end |
#locations ⇒ Array
Returns all BikePoint locations known by the TFL service
48 49 50 |
# File 'lib/tfl_api_client/bike_point.rb', line 48 def locations @client.get('/BikePoint') end |
#locations_within_bounding_box(sw_latitude, sw_longitude, ne_latitude, ne_longitude) ⇒ Array
Returns all BikePoint locations known by the TFL service within a the given box based upon it’s defined corner locations.
87 88 89 90 |
# File 'lib/tfl_api_client/bike_point.rb', line 87 def locations_within_bounding_box(sw_latitude, sw_longitude, ne_latitude, ne_longitude) uri_params = { swLat: sw_latitude, swLon: sw_longitude, neLat: ne_latitude, neLon: ne_longitude } @client.get('/BikePoint', uri_params) end |
#locations_within_locus(latitude, longitude, radius) ⇒ Array
Returns all BikePoint locations known by the TFL service within a particular position or place (a locus).
72 73 74 75 |
# File 'lib/tfl_api_client/bike_point.rb', line 72 def locations_within_locus(latitude, longitude, radius) uri_params = { lat: latitude, lon: longitude, radius: radius } @client.get('/BikePoint', uri_params) end |
#search(query) ⇒ Array
Returns all BikePoint locations known by the TFL service within based upon the given search query.
99 100 101 |
# File 'lib/tfl_api_client/bike_point.rb', line 99 def search(query) @client.get('/BikePoint/Search', { query: query }) end |