Class: Ropenweather::Client
- Inherits:
-
Object
- Object
- Ropenweather::Client
- Includes:
- Agent
- Defined in:
- lib/ropenweather/client.rb
Constant Summary collapse
- DEFAULT_BASE_URI =
'http://api.openweathermap.org/data/2.5'
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#base_uri ⇒ Object
Returns the value of attribute base_uri.
-
#lang ⇒ Object
Returns the value of attribute lang.
-
#units ⇒ Object
Returns the value of attribute units.
Instance Method Summary collapse
- #current_weather(city:, action: 'weather') ⇒ Object
-
#initialize(api_key:, base_uri: DEFAULT_BASE_URI, lang: 'en', units: 'metric') ⇒ Client
constructor
A new instance of Client.
Methods included from Agent
Constructor Details
#initialize(api_key:, base_uri: DEFAULT_BASE_URI, lang: 'en', units: 'metric') ⇒ Client
Returns a new instance of Client.
13 14 15 16 17 18 |
# File 'lib/ropenweather/client.rb', line 13 def initialize(api_key:, base_uri: DEFAULT_BASE_URI, lang: 'en', units: 'metric') self.api_key = api_key self.base_uri = base_uri self.lang = lang self.units = units end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
11 12 13 |
# File 'lib/ropenweather/client.rb', line 11 def api_key @api_key end |
#base_uri ⇒ Object
Returns the value of attribute base_uri.
11 12 13 |
# File 'lib/ropenweather/client.rb', line 11 def base_uri @base_uri end |
#lang ⇒ Object
Returns the value of attribute lang.
11 12 13 |
# File 'lib/ropenweather/client.rb', line 11 def lang @lang end |
#units ⇒ Object
Returns the value of attribute units.
11 12 13 |
# File 'lib/ropenweather/client.rb', line 11 def units @units end |
Instance Method Details
#current_weather(city:, action: 'weather') ⇒ Object
20 21 22 |
# File 'lib/ropenweather/client.rb', line 20 def current_weather(city:, action: 'weather') execute(city: city, action: action, config: config_params) end |