Module: DMM::Configuration
- Included in:
- DMM
- Defined in:
- lib/ruby-dmm/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[ :adapter, :user_agent, :api_endpoint, ].freeze
- DEFAULT_ADAPTER =
Faraday.default_adapter
- DEFAULT_USER_AGENT =
"ruby-dmm gem #{DMM::VERSION}".freeze
- DEFAULT_API_ENDPOINT =
ENV['DMM_API_ENDPOINT'] || 'http://affiliate-api.dmm.com'.freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
19 20 21 |
# File 'lib/ruby-dmm/configuration.rb', line 19 def self.extended(base) base.reset end |
Instance Method Details
#api_endpoint=(value) ⇒ Object
31 32 33 |
# File 'lib/ruby-dmm/configuration.rb', line 31 def api_endpoint=(value) @api_endpoint = File.join(value, '') end |
#configure {|_self| ... } ⇒ Object
23 24 25 |
# File 'lib/ruby-dmm/configuration.rb', line 23 def configure yield self end |
#options ⇒ Object
27 28 29 |
# File 'lib/ruby-dmm/configuration.rb', line 27 def VALID_OPTIONS_KEYS.inject({}) { |h, k| h.merge(k => send(k)) } end |
#reset ⇒ Object
35 36 37 38 39 |
# File 'lib/ruby-dmm/configuration.rb', line 35 def reset self.adapter = DEFAULT_ADAPTER self.user_agent = DEFAULT_USER_AGENT self.api_endpoint = DEFAULT_API_ENDPOINT end |