Class: Animoto::HTTPEngines::RestClientAdapter

Inherits:
Base
  • Object
show all
Defined in:
lib/animoto/http_engines/rest_client_adapter.rb

Instance Method Summary collapse

Instance Method Details

#request(method, url, body = nil, headers = {}, options = {}) ⇒ String

Returns:

  • (String)


8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/animoto/http_engines/rest_client_adapter.rb', line 8

def request method, url, body = nil, headers = {}, options = {}
  RestClient.proxy = options[:proxy]
  response = ::RestClient::Request.execute({
    :method => method,
    :url => url,
    :headers => headers,
    :payload => body,
    :user => options[:username],
    :password => options[:password],
    :timeout => options[:timeout]
  })
  [response.code, response.body]
end