class Nucleo::Configuration
Attributes
access_token[RW]
api_host[RW]
cache_logger[RW]
connection_options[RW]
content_type[RW]
detailed_logger[RW]
Logging
logger[RW]
media_type[RW]
request_logger[RW]
user_agent[RW]
Request
Public Class Methods
keys()
click to toggle source
Returns the set of allowed configuration options
@return [Array<Symbol>] Configuration
Keys
# File lib/nucleo/configuration.rb, line 25 def self.keys @keys ||= [ :api_host, :access_token, :connection_options, :user_agent, :media_type, :content_type, :request_logger, :detailed_logger, :cache_logger, :logger ] end
new(attributes={})
click to toggle source
Create a new instance of the Configuration
Object
@param attributes [Hash] Hash of configuration keys and values
@return [Nucleo::Configuration] Instance of the object
# File lib/nucleo/configuration.rb, line 45 def initialize(attributes={}) self.class.keys.each do |key| instance_variable_set(:"@#{key}", (attributes[key] || Nucleo::Configurations::Default.options[key])) end end
Public Instance Methods
configure() { |self| ... }
click to toggle source
Allows you to configure the object after it's been initialized.
@return [Nucleo::Configuration] The configuration instance
# File lib/nucleo/configuration.rb, line 68 def configure(&block) yield(self) end
reset!()
click to toggle source
Allows you to reset your configuration back to the default state.
@return [Nucleo::Configuration] The configuration with Defaults applied
# File lib/nucleo/configuration.rb, line 76 def reset! self.class.keys.each do |key| instance_variable_set(:"@#{key}", Nucleo::Configurations::Default.options[key]) end end
Also aliased as: setup