Module: TumblRb::Configuration
- Included in:
- TumblRb
- Defined in:
- lib/tumbl_rb/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[ :adapter, :api_version, :proxy, :consumer_oauth_key, :timeout, :open_timeout, :user_agent].freeze
- DEFAULT_ADAPTER =
Faraday.default_adapter
- DEFAULT_API_VERSION =
2
- DEFAULT_USER_AGENT =
"TumblRb Ruby Gem #{TumblRb::VERSION}".freeze
- DEFAULT_TIMEOUT =
10
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
22 23 24 |
# File 'lib/tumbl_rb/configuration.rb', line 22 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
26 27 28 |
# File 'lib/tumbl_rb/configuration.rb', line 26 def configure yield self end |
#options ⇒ Object
30 31 32 |
# File 'lib/tumbl_rb/configuration.rb', line 30 def VALID_OPTIONS_KEYS.inject({}){|o,k| o.merge!(k => send(k)) } end |
#reset ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/tumbl_rb/configuration.rb', line 34 def reset self.adapter = DEFAULT_ADAPTER self.api_version = DEFAULT_API_VERSION self.consumer_oauth_key = nil self.proxy = nil self.user_agent = DEFAULT_USER_AGENT self.timeout = DEFAULT_TIMEOUT self.open_timeout = DEFAULT_TIMEOUT end |