Module: OpenWeatherClient
- Defined in:
- lib/open_weather_client.rb,
lib/open_weather_client/caching.rb,
lib/open_weather_client/request.rb,
lib/open_weather_client/version.rb,
lib/open_weather_client/weather.rb,
lib/open_weather_client/configuration.rb,
lib/open_weather_client/caching/memory.rb
Overview
Get weather data from OpenWeatherMap
Defined Under Namespace
Classes: APIVersionNotSupportedError, AuthenticationError, Caching, Configuration, NotCurrentError, Request, Weather
Constant Summary collapse
- VERSION =
Version of OpenWeatherClient
'0.2.0'
Class Attribute Summary collapse
-
.cache ⇒ Caching
Get the singleton cache instance.
-
.configuration ⇒ Configuration
Get the singleton configuration instance.
Class Method Summary collapse
-
.configure {|configuration| ... } ⇒ Object
Configure OpenWeatherClient.
-
.gem_root ⇒ Object
Get the gem root.
-
.project_root ⇒ Object
Get the project root.
-
.reset ⇒ Object
Reset cache and configuration.
Class Attribute Details
.cache ⇒ Caching
Get the singleton cache instance
32 33 34 |
# File 'lib/open_weather_client.rb', line 32 def self.cache @cache ||= Caching.new end |
.configuration ⇒ Configuration
Get the singleton configuration instance
40 41 42 |
# File 'lib/open_weather_client.rb', line 40 def self.configuration @configuration ||= Configuration.new end |
Class Method Details
.configure {|configuration| ... } ⇒ Object
Configure OpenWeatherClient
53 54 55 |
# File 'lib/open_weather_client.rb', line 53 def self.configure yield configuration end |
.gem_root ⇒ Object
Get the gem root
68 69 70 71 72 73 |
# File 'lib/open_weather_client.rb', line 68 def self.gem_root spec = Gem::Specification.find_by_name('open_weather_client') spec.gem_dir rescue NoMethodError project_root end |
.project_root ⇒ Object
Get the project root
59 60 61 62 63 64 |
# File 'lib/open_weather_client.rb', line 59 def self.project_root return Rails.root if defined?(Rails) return Bundler.root if defined?(Bundler) Dir.pwd end |
.reset ⇒ Object
Reset cache and configuration
46 47 48 49 |
# File 'lib/open_weather_client.rb', line 46 def self.reset @cache = Caching.new @configuration = Configuration.new end |