module Picfit::Configuration

Constants

DEFAULT_BASE_URL
DEFAULT_METHOD
DEFAULT_QUERY_STRING
DEFAULT_SECRET_KEY
VALID_OPTIONS_KEYS

An array of valid keys in the options hash

Public Class Methods

extended(base) click to toggle source

When this module is extended, set all configuration options to their default values

# File lib/picfit/configuration.rb, line 19
def self.extended(base)
  base.reset
end

Public Instance Methods

configure() { |self| ... } click to toggle source

Convenience method to allow configuration options to be set in a block

# File lib/picfit/configuration.rb, line 24
def configure
  yield self
end
options() click to toggle source

Create a hash of options and their values

# File lib/picfit/configuration.rb, line 29
def options
  VALID_OPTIONS_KEYS.inject({}) do |option, key|
    option.merge!(key => send(key))
  end
end
reset() click to toggle source

Reset all configuration options to defaults

# File lib/picfit/configuration.rb, line 36
def reset
  self.base_url       = DEFAULT_BASE_URL
  self.method         = DEFAULT_METHOD
  self.secret_key     = DEFAULT_SECRET_KEY
  self.query_string   = DEFAULT_QUERY_STRING
end