module VkontakteApi::Configuration

General configuration module.

@note `VkontakteApi::Configuration` extends `VkontakteApi` so these methods should be called from the latter.

Constants

DEFAULT_ADAPTER

Default HTTP adapter.

DEFAULT_HTTP_VERB

Default HTTP verb for API methods.

DEFAULT_LOGGER_OPTIONS

Logger default options.

DEFAULT_MAX_RETRIES

Default max retries count.

OPTION_NAMES

Available options.

Public Class Methods

extended(base) click to toggle source

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

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

Public Instance Methods

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

A global configuration set via the block. @example

VkontakteApi.configure do |config|
  config.adapter = :net_http
  config.logger  = Rails.logger
end
# File lib/vkontakte_api/configuration.rb, line 52
def configure
  yield self if block_given?
  self
end
reset() click to toggle source

Reset all configuration options to defaults.

# File lib/vkontakte_api/configuration.rb, line 58
def reset
  @adapter         = DEFAULT_ADAPTER
  @http_verb       = DEFAULT_HTTP_VERB
  @faraday_options = {}
  @max_retries     = DEFAULT_MAX_RETRIES
  @logger          = ::Logger.new(STDOUT)
  @log_requests    = DEFAULT_LOGGER_OPTIONS[:requests]
  @log_errors      = DEFAULT_LOGGER_OPTIONS[:errors]
  @log_responses   = DEFAULT_LOGGER_OPTIONS[:responses]
  @api_version     = nil
end