Class: APIClientBuilder::PutRequest

Inherits:
Request
  • Object
show all
Defined in:
lib/api_client_builder/put_request.rb

Instance Attribute Summary

Attributes inherited from Request

#body, #error_handlers_collection, #response_handler, #type

Instance Method Summary collapse

Methods inherited from Request

#error_handlers, #initialize, #on_error

Constructor Details

This class inherits a constructor from APIClientBuilder::Request

Instance Method Details

#responseJSON

Yields the response body if the response was successful. Will call the response handlers if there was not a successful response.

Returns:

  • (JSON)

    the http response body



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/api_client_builder/put_request.rb', line 7

def response
  response = response_handler.put_request(@body)

  if response.success?
    response
  else
    error_handlers.each do |handler|
      handler.call(response, self)
    end
  end
end