module SmswayApi::Configuration
General configuration module.
@note `SmswayApi::Configuration` extends `Smsway` so these methods should be called from the latter.
Constants
- 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/smsway_api/configuration.rb, line 56 def self.extended(base) base.reset end
Public Instance Methods
configure() { |self| ... }
click to toggle source
A global configuration set via the block. @example
SmswayApi.configure do |config| config.adapter = :net_http config.logger = Rails.logger end
# File lib/smsway_api/configuration.rb, line 41 def configure yield self if block_given? self end
reset()
click to toggle source
Reset all configuration options to defaults.
# File lib/smsway_api/configuration.rb, line 47 def reset @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] end