Method: OpenWeatherMap::API#initialize
- Defined in:
- lib/openweathermap/api.rb
#initialize(api_key, lang = 'en', units = 'default') ⇒ API
Initialize the API object
35 36 37 38 39 40 41 42 43 |
# File 'lib/openweathermap/api.rb', line 35 def initialize(api_key, lang = 'en', units = 'default') @api_key = api_key raise OpenWeatherMap::Exceptions::UnknownLang, "unknown lang #{lang}" unless OpenWeatherMap::Constants::LANGS.include? lang @lang = lang raise OpenWeatherMap::Exceptions::UnknownUnits, "unknown units #{units}" unless OpenWeatherMap::Constants::UNITS.include? units @units = units end |