Module: StatRaptor::Client::Adapters::RestClient

Defined in:
lib/statraptor/client/adapters/rest_client.rb

Class Method Summary collapse

Class Method Details

.request_api_response(method, path, params = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/statraptor/client/adapters/rest_client.rb', line 5

def self.request_api_response(method, path, params = {})
  params.merge!(:platform_credentials => StatRaptor.platform_credentials)
  verify_ssl = StatRaptor.disable_ssl_peer_verification ? false : true
  url = StatRaptor.full_uri(path)

  options = {
    :url => url,
    :method => method,
    :payload => params,
    :verify_ssl =>  StatRaptor.disable_ssl_peer_verification,
    :timeout => StatRaptor.timeout_in_seconds,
    :headers => Config::HTTP_HEADERS
  }

  ::RestClient::Request.execute(options){|response, request, result| response }
end