Module: SBA::Configuration
- Included in:
- SBA
- Defined in:
- lib/sba/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[ :adapter, :endpoint, :user_agent, :proxy, :format].freeze
- VALID_FORMATS =
[ :json, :xml].freeze
- DEFAULT_ADAPTER =
Faraday.default_adapter
- DEFAULT_ENDPOINT =
nil
- DEFAULT_PROXY =
nil
- DEFAULT_FORMAT =
:json
- DEFAULT_USER_AGENT =
"SBA Ruby Gem #{SBA::VERSION}".freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
24 25 26 |
# File 'lib/sba/configuration.rb', line 24 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
28 29 30 |
# File 'lib/sba/configuration.rb', line 28 def configure yield self end |
#options ⇒ Object
32 33 34 |
# File 'lib/sba/configuration.rb', line 32 def VALID_OPTIONS_KEYS.inject({}){|o,k| o.merge!(k => send(k)) } end |
#reset ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/sba/configuration.rb', line 36 def reset self.adapter = DEFAULT_ADAPTER self.user_agent = DEFAULT_USER_AGENT self.endpoint = DEFAULT_ENDPOINT self.format = DEFAULT_FORMAT self.proxy = DEFAULT_FORMAT end |