lib/poms/api/client.rb in poms-2.1.3 vs lib/poms/api/client.rb in poms-2.2.0

- old
+ new

@@ -9,50 +9,22 @@ # module to implement the actual operations. Use the Client module to build # signed requests and execute them. # # @see Poms::Api::Drivers::NetHttp module Client - extend Drivers::NetHttp - module_function - def get(uri, credentials, headers = {}) - handle_response( - execute( - Auth.sign( - prepare_get(uri, headers), - credentials - ) - ) - ) + def execute(request) + handle_response(Drivers::NetHttp.execute(Auth.sign(request))) end - def post(uri, body, credentials, headers = {}) - handle_response( - execute( - Auth.sign( - prepare_post(uri, body, headers), - credentials - ) - ) - ) - end - 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 - - def prepare_get(uri, headers = {}) - Request.get(uri, nil, headers) - end - - def prepare_post(uri, body, headers = {}) - Request.post(uri, body, headers) end end end end