Module: Manticore::Facade::ClassMethods

Defined in:
lib/manticore/facade.rb

Instance Method Summary collapse

Instance Method Details

#include_http_client(options = {}, &block) ⇒ Object

Adds basic synchronous Manticore::Client functionality to the receiver.

Parameters:

  • options (defaults to: {})

    Hash Options to be passed to the underlying shared client, if it has not been created yet.

Returns:

  • nil



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/manticore/facade.rb', line 26

def include_http_client(options = {}, &block)
  if shared_pool = options.delete(:shared_pool)
    @manticore_facade = Manticore.instance_variable_get("@manticore_facade")
  else
    @manticore_facade = Manticore::Client.new(options, &block)
  end
  class << self
    extend Forwardable
    def_delegators "@manticore_facade", :get, :head, :put, :post, :delete, :options, :patch
  end
  nil
end