class Endpointer::Performers::Get

Public Instance Methods

execute(request, resource) click to toggle source
# File lib/endpointer/performers/get.rb, line 10
def execute(request, resource)
  execute_method(resource.method, request, resource)
end

Private Instance Methods

execute_method(method, request, resource) click to toggle source
# File lib/endpointer/performers/get.rb, line 16
def execute_method(method, request, resource)
  begin
    response = RestClient::Request.execute(method: method, url: construct_uri(request, resource), headers: create_headers(request, resource))
  rescue RestClient::ExceptionWithResponse => e
    response = e.response
  end

  request_body = request.body.read
  request.body.rewind
  Endpointer::ResponsePresenter.new.present(status: response.code, body: response.body, headers: response.headers, request_body: request_body, resource: resource)
end