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

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

Class Method Summary collapse

Class Method Details

.execute(request_description) ⇒ Object



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

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