class Ropenweather::Client

Constants

DEFAULT_BASE_URI

Attributes

api_key[RW]
base_uri[RW]
lang[RW]
units[RW]

Public Class Methods

new(api_key:, base_uri: DEFAULT_BASE_URI, lang: 'en', units: 'metric') click to toggle source
# 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

Public Instance Methods

current_weather(city:, action: 'weather') click to toggle source
# File lib/ropenweather/client.rb, line 20
def current_weather(city:, action: 'weather')
  execute(city: city, action: action, config: config_params)
end

Private Instance Methods

config_params() click to toggle source
# File lib/ropenweather/client.rb, line 26
def config_params
  { appid: api_key, lang: lang, units: units }
end