Sha256: fd4d21251a98cf765845472432856714703cb0dfdbfc1cb237ec8a9a25bc8a3d
Contents?: true
Size: 1.26 KB
Versions: 4
Compression:
Stored size: 1.26 KB
Contents
require 'logger' module WialonApi module Configuration OPTION_NAMES = [ :wialon_host, :http_verb, :max_retries, :faraday_options, :adapter, :logger, :log_requests, :log_errors, :log_responses ] attr_accessor(*OPTION_NAMES) alias_method :log_requests?, :log_requests alias_method :log_errors?, :log_errors alias_method :log_responses?, :log_responses DEFAULT_WIALON_HOST = 'https://hst-api.wialon.com/wialon/ajax.html' DEFAULT_HTTP_VERB = :post DEFAULT_MAX_RETRIES = 1 DEFAULT_ADAPTER = Faraday.default_adapter DEFAULT_LOGGER_OPTIONS = { requests: true, errors: true, responses: false } def configure yield self if block_given? self end def reset @wialon_host = DEFAULT_WIALON_HOST @http_verb = DEFAULT_HTTP_VERB @max_retries = DEFAULT_MAX_RETRIES @faraday_options = {} @adapter = DEFAULT_ADAPTER @logger = ::Logger.new(STDOUT) @log_requests = DEFAULT_LOGGER_OPTIONS[:requests] @log_errors = DEFAULT_LOGGER_OPTIONS[:errors] @log_responses = DEFAULT_LOGGER_OPTIONS[:responses] end def self.extended(base) base.reset end end end
Version data entries
4 entries across 4 versions & 1 rubygems