Module: Diablo3Api::Configuration
- Included in:
- Diablo3Api
- Defined in:
- lib/diablo3_api/configuration.rb
Constant Summary collapse
- VALID_CONFIG_KEYS =
[:endpoint, :user_agent, :method, :format].freeze
- DEFAULT_ENDPOINT =
'http://us.battle.net/api/d3'
- DEFAULT_METHOD =
:get
- DEFAULT_USER_AGENT =
"diablo3_api Ruby Gem #{Diablo3Api::VERSION}".freeze
- DEFAULT_FORMAT =
:json
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
12 13 14 |
# File 'lib/diablo3_api/configuration.rb', line 12 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
23 24 25 |
# File 'lib/diablo3_api/configuration.rb', line 23 def configure yield self end |
#options ⇒ Object
27 28 29 |
# File 'lib/diablo3_api/configuration.rb', line 27 def Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ] end |
#reset ⇒ Object
16 17 18 19 20 21 |
# File 'lib/diablo3_api/configuration.rb', line 16 def reset self.endpoint = DEFAULT_ENDPOINT self.method = DEFAULT_METHOD self.user_agent = DEFAULT_USER_AGENT self.format = DEFAULT_FORMAT end |