Module: Poms::Api::Drivers::NetHttp

Included in:
Client
Defined in:
lib/poms/api/drivers/net_http.rb

Overview

The NetHttp driver is a special module that can be used to implement the HTTP operations in the Client module. This is done by including a driver module into the client.

This module isolates all knowledge of Net::HTTP.

See Also:

Constant Summary collapse

NET_HTTP_ERRORS =
[
  Timeout::Error,
  Errno::EINVAL,
  Errno::ECONNRESET,
  EOFError,
  Net::HTTPBadResponse,
  Net::HTTPHeaderSyntaxError,
  Net::ProtocolError
].freeze

Instance Method Summary collapse

Instance Method Details

#execute(request_description) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/poms/api/drivers/net_http.rb', line 26

def execute(request_description)
  response = attempt_request(
    request_description.uri,
    prepare_request(request_description)
  )
  Response.new(response.code, response.body, response.to_hash)
end