module ESPN::Configuration
Public: All methods useful for configuration. This module should be extended in the ESPN
module, so ESPN
can be configured.
Examples
module ESPN extend Configuration end
Constants
- DEFAULT_ADAPTER
Public: The default adapter used for requests.
- DEFAULT_API_VERSION
Public: The default API Version.
- DEFAULT_TIMEOUT
Public: The default timeout for HTTP Requests.
- DEFAULT_USER_AGENT
Public: The default user agent.
- VALID_OPTIONS_KEYS
Public: Array of all configuration options for an
ESPN::Client
.
Attributes
Public: Gets/Sets the Symbol adapter.
Public: Gets/Sets the String api key.
Public: Gets/Sets the Fixnum api version.
Public: Gets/Sets the Fixnum open timeout.
Public: Gets/Sets the String proxy.
Public: Gets/Sets the Fixnum timeout.
Public: Gets/Sets the String user agent.
Public Class Methods
Internal: Hook when this module is extended in another, we call reset
.
Returns nothing.
# File lib/espn/configuration.rb, line 56 def self.extended(base) base.reset end
Public Instance Methods
Public: The ability to configure ESPN
default options.
Examples
ESPN.configure do |c| c.api_key = 'abc123' end
Yields ESPN::Configuration
.
# File lib/espn/configuration.rb, line 69 def configure yield self end
Public: Get all valid options with their defaults.
Returns a Hash.
# File lib/espn/configuration.rb, line 76 def options VALID_OPTIONS_KEYS.inject({}){|o,k| o.merge!(k => send(k)) } end
Public: Reset all valid options to their defaults.
Returns nothing.
# File lib/espn/configuration.rb, line 83 def reset self.adapter = DEFAULT_ADAPTER self.api_version = DEFAULT_API_VERSION self.user_agent = DEFAULT_USER_AGENT self.timeout = DEFAULT_TIMEOUT self.open_timeout = DEFAULT_TIMEOUT self.api_key = nil self.proxy = nil end