Class: UniversalRenderer::Client::HttpPool::ClientProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/universal_renderer/client/http_pool.rb

Instance Method Summary collapse

Constructor Details

#initialize(uri, timeout) ⇒ ClientProxy

Returns a new instance of ClientProxy.



15
16
17
18
# File 'lib/universal_renderer/client/http_pool.rb', line 15

def initialize(uri, timeout)
  @uri = uri
  @timeout = timeout
end

Instance Method Details

#request(http_request, &block) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/universal_renderer/client/http_pool.rb', line 20

def request(http_request, &block)
  if block
    HttpPool.request(@uri, @timeout, http_request) do |response, http|
      block.call(response, http)
    end
  else
    HttpPool.request(@uri, @timeout, http_request)
  end
end