Class: ChimeraHttpClient::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/chimera_http_client/base.rb

Direct Known Subclasses

Connection, Queue

Constant Summary collapse

USER_AGENT =
"ChimeraHttpClient (by mediafinger)".freeze

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/chimera_http_client/base.rb', line 5

def initialize(options = {})
  fail(ChimeraHttpClient::ParameterMissingError, "base_url expected, but not given") if options[:base_url].nil?

  @base_url = options.fetch(:base_url)
  @deserializer = default_deserializer.merge(options.fetch(:deserializer, {}))
  @logger = options[:logger]
  @monitor = options[:monitor]
  @timeout = options[:timeout]

  Typhoeus::Config.cache = options[:cache]
  Typhoeus::Config.memoize = false # hydra setting, prevents a possible memory leak
  Typhoeus::Config.user_agent = options.fetch(:user_agent, USER_AGENT)
  Typhoeus::Config.verbose = options.fetch(:verbose, false)
end