Module: Fixer::Configuration
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[ :client_id, :client_secret, :adapter, :endpoint, :user_agent, :aws, :queue ].freeze
- DEFAULT_ADAPTER =
Adapters are whatever Faraday supports - I like excon alot, so I’m defaulting it
:excon- DEFAULT_ENDPOINT =
The api endpoint to get REST
'http://fixer.prx.dev/api/'.freeze
- DEFAULT_USER_AGENT =
The value sent in the http header for ‘User-Agent’ if none is set
"Fixer Ruby Gem #{Fixer::VERSION}".freeze
- DEFAULT_QUEUE =
sqs queue to write messages
'production_fixer_job_create'.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Convenience method to allow for global setting of configuration options.
- #options ⇒ Object
-
#reset! ⇒ Object
Reset configuration options to their defaults.
Class Method Details
.extended(base) ⇒ Object
35 36 37 |
# File 'lib/fixer/configuration.rb', line 35 def self.extended(base) base.reset! end |
.keys ⇒ Object
40 41 42 |
# File 'lib/fixer/configuration.rb', line 40 def keys VALID_OPTIONS_KEYS end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Convenience method to allow for global setting of configuration options
31 32 33 |
# File 'lib/fixer/configuration.rb', line 31 def configure yield self end |
#options ⇒ Object
45 46 47 48 49 |
# File 'lib/fixer/configuration.rb', line 45 def = {} VALID_OPTIONS_KEYS.each { |k| [k] = send(k) } end |
#reset! ⇒ Object
Reset configuration options to their defaults
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/fixer/configuration.rb', line 52 def reset! self.client_id = ENV['FIXER_CLIENT_ID'] self.client_secret = ENV['FIXER_CLIENT_SECRET'] self.adapter = DEFAULT_ADAPTER self.endpoint = ENV['FIXER_ENDPOINT'] || DEFAULT_ENDPOINT self.user_agent = DEFAULT_USER_AGENT self.aws = nil self.queue = ENV['FIXER_QUEUE'] || DEFAULT_QUEUE self end |