Module: EdgeCast::Config
- Included in:
- EdgeCast
- Defined in:
- lib/edge_cast/config.rb
Overview
Defines constants and methods related to configuration
Constant Summary collapse
- DEFAULT_ADAPTER =
The HTTP connection adapter that will be used to connect if none is set
:net_http- DEFAULT_CONNECTION_OPTIONS =
The Faraday connection options if none is set
{}
- DEFAULT_HOST =
'api.edgecast.com'- DEFAULT_API_TOKEN =
The oauth token if none is set
nil- DEFAULT_USER_AGENT =
The value sent in the ‘User-Agent’ header if none is set
"EdgeCast Ruby Gem #{EdgeCast::VERSION}"- VALID_OPTIONS_KEYS =
An array of valid keys in the options hash when configuring a EdgeCast::Client
[ :adapter, :connection_options, :account_number, :api_token, :user_agent ]
Class Method Summary collapse
-
.extended(base) ⇒ Object
When this module is extended, set all configuration options to their default values.
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block.
-
#options ⇒ Object
Create a hash of options and their values.
-
#reset ⇒ Object
Reset all configuration options to defaults.
Class Method Details
.extended(base) ⇒ Object
When this module is extended, set all configuration options to their default values
33 34 35 |
# File 'lib/edge_cast/config.rb', line 33 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block
38 39 40 41 |
# File 'lib/edge_cast/config.rb', line 38 def configure yield self self end |
#options ⇒ Object
Create a hash of options and their values
44 45 46 |
# File 'lib/edge_cast/config.rb', line 44 def VALID_OPTIONS_KEYS.inject({}) { |opts, k| opts[k] = send(k); opts } end |
#reset ⇒ Object
Reset all configuration options to defaults
49 50 51 52 53 54 55 |
# File 'lib/edge_cast/config.rb', line 49 def reset self.adapter = DEFAULT_ADAPTER self. = DEFAULT_CONNECTION_OPTIONS self.api_token = DEFAULT_API_TOKEN self.user_agent = DEFAULT_USER_AGENT self end |