Class: Waqi::Client

Inherits:
Object
  • Object
show all
Includes:
Resource::CityFeed, Resource::HttpRequest
Defined in:
lib/waqi/client.rb

Constant Summary collapse

BASE_URL =
'https://api.waqi.info/'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Resource::HttpRequest

#default_url, #get

Methods included from Resource::CityFeed

#get_city_feed, #get_geo_feed, #get_geo_feed_by_ip, #map_station, #search_station

Constructor Details

#initialize(api_key:, adapter: Faraday.default_adapter) ⇒ Client

Returns a new instance of Client.



15
16
17
18
19
# File 'lib/waqi/client.rb', line 15

def initialize(api_key:, adapter: Faraday.default_adapter)
    @api_key = api_key
    @adapter = adapter
    connection
end

Instance Attribute Details

#adapterObject (readonly)

Returns the value of attribute adapter.



13
14
15
# File 'lib/waqi/client.rb', line 13

def adapter
  @adapter
end

#api_keyObject (readonly)

Returns the value of attribute api_key.



13
14
15
# File 'lib/waqi/client.rb', line 13

def api_key
  @api_key
end