class Quovo::Config

Constants

DEFAULT_ENDPOINT

Attributes

debug[RW]
password[RW]
request_timeout[RW]
strip_sensitive_params[RW]
token_prefix[RW]
token_storage[RW]
token_ttl[RW]
username[RW]

Public Class Methods

configurator() click to toggle source
# 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
new() click to toggle source
# 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

Public Instance Methods

[](option) click to toggle source
# File lib/quovo/config.rb, line 29
def [](option)
  send(option)
end
config() click to toggle source
# File lib/quovo/config.rb, line 39
def config
  @config ||= Config.new
end
configure() { |config| ... } click to toggle source
# File lib/quovo/config.rb, line 35
def configure
  yield(config)
end
default_memory_storage() click to toggle source
# 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() click to toggle source
# File lib/quovo/config.rb, line 25
def endpoint
  DEFAULT_ENDPOINT
end