Class: Quovo::Config
- Inherits:
-
Object
- Object
- Quovo::Config
- Defined in:
- lib/quovo/config.rb
Constant Summary collapse
- DEFAULT_ENDPOINT =
'https://api.quovo.com/v2'.freeze
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#password ⇒ Object
Returns the value of attribute password.
-
#request_timeout ⇒ Object
seconds.
-
#strip_sensitive_params ⇒ Object
Returns the value of attribute strip_sensitive_params.
-
#token_prefix ⇒ Object
Returns the value of attribute token_prefix.
-
#token_storage ⇒ Object
Returns the value of attribute token_storage.
-
#token_ttl ⇒ Object
seconds.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
- #[](option) ⇒ Object
- #default_memory_storage ⇒ Object
- #endpoint ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/quovo/config.rb', line 14 def initialize @username = nil @password = nil @token_ttl = 60 * 60 @request_timeout = 60 @token_prefix = 'QUOVO-ACCESS-TOKEN' @token_storage = default_memory_storage @debug = false @strip_sensitive_params = true end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
9 10 11 |
# File 'lib/quovo/config.rb', line 9 def debug @debug end |
#password ⇒ Object
Returns the value of attribute password.
4 5 6 |
# File 'lib/quovo/config.rb', line 4 def password @password end |
#request_timeout ⇒ Object
seconds
6 7 8 |
# File 'lib/quovo/config.rb', line 6 def request_timeout @request_timeout end |
#strip_sensitive_params ⇒ Object
Returns the value of attribute strip_sensitive_params.
10 11 12 |
# File 'lib/quovo/config.rb', line 10 def strip_sensitive_params @strip_sensitive_params end |
#token_prefix ⇒ Object
Returns the value of attribute token_prefix.
7 8 9 |
# File 'lib/quovo/config.rb', line 7 def token_prefix @token_prefix end |
#token_storage ⇒ Object
Returns the value of attribute token_storage.
8 9 10 |
# File 'lib/quovo/config.rb', line 8 def token_storage @token_storage end |
#token_ttl ⇒ Object
seconds
5 6 7 |
# File 'lib/quovo/config.rb', line 5 def token_ttl @token_ttl end |
#username ⇒ Object
Returns the value of attribute username.
3 4 5 |
# File 'lib/quovo/config.rb', line 3 def username @username end |
Class Method Details
.configurator ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/quovo/config.rb', line 33 def self.configurator @conf_mod ||= Module.new do def configure yield(config) end def config @config ||= Config.new end end end |
Instance Method Details
#[](option) ⇒ Object
29 30 31 |
# File 'lib/quovo/config.rb', line 29 def [](option) send(option) end |
#default_memory_storage ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/quovo/config.rb', line 45 def default_memory_storage Object.new.tap do |o| def o.storage @storage ||= {} end def o.read(key) storage[key] end def o.write(key, value) storage[key] = value end end end |
#endpoint ⇒ Object
25 26 27 |
# File 'lib/quovo/config.rb', line 25 def endpoint DEFAULT_ENDPOINT end |