Module: Poms::Api::Client

Defined in:
lib/poms/api/client.rb

Overview

The Client module isolates all HTTP interactions, regardless of the driver module to implement the actual operations. Use the Client module to build signed requests and execute them.

See Also:

Class Method Summary collapse

Class Method Details

.execute(request) ⇒ Object



16
17
18
# File 'lib/poms/api/client.rb', line 16

def execute(request)
  handle_response(Drivers::NetHttp.execute(Auth.sign(request)))
end

.handle_response(response) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/poms/api/client.rb', line 20

def handle_response(response)
  case response.code
  when 400..499 then raise Errors::HttpMissingError, response.code
  when 500..599 then raise Errors::HttpServerError, response.code
  else
    response
  end
end