Class: Citibikenyc::Api
- Inherits:
-
Object
- Object
- Citibikenyc::Api
- Defined in:
- lib/citibikenyc/api.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#feeds ⇒ Object
readonly
Returns the value of attribute feeds.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#station_information ⇒ Object
readonly
Returns the value of attribute station_information.
-
#station_status ⇒ Object
readonly
Returns the value of attribute station_status.
-
#system_alerts ⇒ Object
readonly
Returns the value of attribute system_alerts.
-
#system_information ⇒ Object
readonly
Returns the value of attribute system_information.
-
#system_regions ⇒ Object
readonly
Returns the value of attribute system_regions.
Instance Method Summary collapse
- #get_feeds ⇒ Object
- #get_station_information ⇒ Object
- #get_station_status ⇒ Object
- #get_system_alerts ⇒ Object
- #get_system_information ⇒ Object
- #get_system_regions ⇒ Object
-
#initialize ⇒ Api
constructor
A new instance of Api.
Constructor Details
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
12 13 14 |
# File 'lib/citibikenyc/api.rb', line 12 def client @client end |
#feeds ⇒ Object (readonly)
Returns the value of attribute feeds.
12 13 14 |
# File 'lib/citibikenyc/api.rb', line 12 def feeds @feeds end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
12 13 14 |
# File 'lib/citibikenyc/api.rb', line 12 def response @response end |
#station_information ⇒ Object (readonly)
Returns the value of attribute station_information.
12 13 14 |
# File 'lib/citibikenyc/api.rb', line 12 def station_information @station_information end |
#station_status ⇒ Object (readonly)
Returns the value of attribute station_status.
12 13 14 |
# File 'lib/citibikenyc/api.rb', line 12 def station_status @station_status end |
#system_alerts ⇒ Object (readonly)
Returns the value of attribute system_alerts.
12 13 14 |
# File 'lib/citibikenyc/api.rb', line 12 def system_alerts @system_alerts end |
#system_information ⇒ Object (readonly)
Returns the value of attribute system_information.
12 13 14 |
# File 'lib/citibikenyc/api.rb', line 12 def system_information @system_information end |
#system_regions ⇒ Object (readonly)
Returns the value of attribute system_regions.
12 13 14 |
# File 'lib/citibikenyc/api.rb', line 12 def system_regions @system_regions end |
Instance Method Details
#get_feeds ⇒ Object
20 21 22 |
# File 'lib/citibikenyc/api.rb', line 20 def get_feeds @feeds = response_to_json("/gbfs/gbfs.json")[@lang]["feeds"].map { |feed| Feed.new( feed["name"], feed["url"] ) } end |
#get_station_information ⇒ Object
29 30 31 32 |
# File 'lib/citibikenyc/api.rb', line 29 def get_station_information feed = @feeds.find{ |f| f.name == "station_information"} @station_information = response_to_json(feed.url)["stations"].map { |station_information| StationInformation.new(station_information) } end |
#get_station_status ⇒ Object
24 25 26 27 |
# File 'lib/citibikenyc/api.rb', line 24 def get_station_status feed = @feeds.find{ |f| f.name == "station_status"} @station_status = response_to_json(feed.url)["stations"].map { |station_status| StationStatus.new(station_status) } end |
#get_system_alerts ⇒ Object
44 45 46 47 |
# File 'lib/citibikenyc/api.rb', line 44 def get_system_alerts feed = @feeds.find{ |f| f.name == "system_alerts"} @system_alerts = response_to_json(feed.url)["alertsa"] end |
#get_system_information ⇒ Object
39 40 41 42 |
# File 'lib/citibikenyc/api.rb', line 39 def get_system_information feed = @feeds.find{ |f| f.name == "station_information"} @system_information = response_to_json(feed.url) end |