Method: Code42::Connection#make_request

Defined in:
lib/code42/connection.rb

#make_request(method, *args, &block) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/code42/connection.rb', line 79

def make_request(method, *args, &block)
  begin
    @last_response = response = self.send(method, *args, &block)
    ActiveSupport::Notifications.instrument('code42.request', {
      method:   method,
      args:     args,
      response: response
    })
  rescue Faraday::Error::ConnectionFailed
    raise Code42::Error::ConnectionFailed
  end
  check_for_errors(response)
  response.body
end