Class: Waqi::Client
- Inherits:
-
Object
- Object
- Waqi::Client
- Defined in:
- lib/waqi/client.rb
Instance Method Summary collapse
- #city_feed(city_name) ⇒ Object
- #geo_feed(lat, lon) ⇒ Object
-
#initialize(token:) ⇒ Client
constructor
A new instance of Client.
- #local_feed ⇒ Object
- #map_stations(*bounds) ⇒ Object
- #search(keyword) ⇒ Object
- #station_feed(station_id) ⇒ Object
Constructor Details
#initialize(token:) ⇒ Client
Returns a new instance of Client.
5 6 7 |
# File 'lib/waqi/client.rb', line 5 def initialize(token:) @token = token end |
Instance Method Details
#city_feed(city_name) ⇒ Object
14 15 16 17 |
# File 'lib/waqi/client.rb', line 14 def city_feed(city_name) response = Service::City.new(city_name).get(token: @token) StationData.parse(response) end |
#geo_feed(lat, lon) ⇒ Object
19 20 21 22 |
# File 'lib/waqi/client.rb', line 19 def geo_feed(lat, lon) response = Service::Geolocation.new(lat,lon).get(token: @token) StationData.parse(response) end |
#local_feed ⇒ Object
24 25 26 27 |
# File 'lib/waqi/client.rb', line 24 def local_feed response = Service::City.new().get(token: @token) StationData.parse(response) end |
#map_stations(*bounds) ⇒ Object
29 30 31 32 |
# File 'lib/waqi/client.rb', line 29 def map_stations(*bounds) response = Service::Map.new(*bounds).get(token: @token) response.map { |data| StationPin.parse(data) } end |