Sha256: 8f30a73ee7016bc57b55578f2d3dca64fdbd9550005c8539925fef26e177aec6
Contents?: true
Size: 1.12 KB
Versions: 12
Compression:
Stored size: 1.12 KB
Contents
module Wwo module Configuration # Default API endpoint DEFAULT_FREE_ENDPOINT = 'https://api.worldweatheronline.com/free/v2' DEFAULT_PREMIUM_ENDPOINT = 'https://api.worldweatheronline.com/premium/v1' # Forecast API endpoint attr_writer :api_endpoint # API key attr_writer :api_key # Cache Object attr_writer :api_cache_store # Cache Object attr_writer :use_premium_api # Default parameters attr_accessor :default_params # Example: # # Wwo.configure do |configuration| # configuration.use_peremium_api = true # configuration.api_key = 'this-is-your-api-key' # end def configure yield self end # API endpoint def api_endpoint @api_endpoint.nil? ? ( use_premium_api? ? DEFAULT_PREMIUM_ENDPOINT : DEFAULT_FREE_ENDPOINT ) : @api_endpoint end # API key def api_key @api_key end def use_premium_api @use_premium_api end # API Cache Object def api_cache_store @api_cache_store end private def use_premium_api? use_premium_api == true end end end
Version data entries
12 entries across 12 versions & 1 rubygems