Module: Flowthings::Configuration
- Included in:
- Flowthings
- Defined in:
- lib/flowthings/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[:account_name, :account_token].freeze
- VALID_CONNECTION_KEYS =
[:endpoint, :user_agent, :secure, :platform_version]
- VALID_CONFIG_KEYS =
VALID_CONNECTION_KEYS + VALID_OPTIONS_KEYS
- DEFAULT_ENDPOINT =
"api.flowthings.io"
- DEFAULT_USER_AGENT =
"Flowthings API Ruby Gem #{Flowthings::VERSION}".freeze
- DEFAULT_ACCOUNT_TOKEN =
nil
- DEFAULT_ACCOUNT_NAME =
nil
- DEFAULT_SECURE =
true
- DEFAULT_PLATFORM_VERSION =
'v0.1'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
17 18 19 |
# File 'lib/flowthings/configuration.rb', line 17 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
31 32 33 |
# File 'lib/flowthings/configuration.rb', line 31 def configure yield self end |
#options ⇒ Object
35 36 37 |
# File 'lib/flowthings/configuration.rb', line 35 def Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten] end |
#reset ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/flowthings/configuration.rb', line 21 def reset self.endpoint = DEFAULT_ENDPOINT self.user_agent = DEFAULT_USER_AGENT self.secure = DEFAULT_SECURE self.platform_version = DEFAULT_PLATFORM_VERSION self.account_token = DEFAULT_ACCOUNT_TOKEN self.account_name = DEFAULT_ACCOUNT_NAME end |