module Milkbottle::Configurable

Attributes

anonymous_token[R]
api_endpoint[W]
api_key[RW]
connection_options[R]
external_auth_issuer[RW]
external_auth_key[RW]
jwt_token[R]
user_agent[R]

Public Class Methods

keys() click to toggle source
# File lib/milkbottle/configurable.rb, line 17
def keys
  @keys ||= [
    :anonymous_token,
    :api_endpoint,
    :api_key,
    :connection_options,
    :external_auth_issuer,
    :external_auth_key,
    :jwt_token,
    :user_agent
  ]
end

Public Instance Methods

api_endpoint() click to toggle source
# File lib/milkbottle/configurable.rb, line 44
def api_endpoint
  File.join(@api_endpoint, "")
end
audience() click to toggle source
# File lib/milkbottle/configurable.rb, line 48
def audience
  URI(@api_endpoint).host
end
configure() { |self| ... } click to toggle source
# File lib/milkbottle/configurable.rb, line 31
def configure
  yield self
end
reset!() click to toggle source

Reset configuration options to default values

# File lib/milkbottle/configurable.rb, line 36
def reset!
  Milkbottle::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", Milkbottle::Default.options[key])
  end
  self
end
Also aliased as: setup
setup()
Alias for: reset!

Private Instance Methods

options() click to toggle source
# File lib/milkbottle/configurable.rb, line 54
def options
  Hash[Milkbottle::Configurable.keys.map{|key| [key, instance_variable_get(:"@#{key}")]}]
end