Sha256: 4200f9821f3c0e82a2075fcc986e4fd0dd9e94dfac02c58f94191647c421555f

Contents?: true

Size: 648 Bytes

Versions: 6

Compression:

Stored size: 648 Bytes

Contents

require 'restclient'

module Animoto
  class HTTPEngine
    class RestClientAdapter < Animoto::HTTPEngine
      
      def request method, url, body = nil, headers = {}, options = {}
        response = ::RestClient::Request.execute({
          :method => method,
          :url => url,
          :headers => headers,
          :payload => body,
          :user => options[:username],
          :password => options[:password],
          :timeout => options[:timeout]
        })
        check_response response.code, response.body
        response.body
      end
      
    end
    
    adapter_map.merge! :rest_client => RestClientAdapter
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
animoto-0.0.0.alpha9 ./lib/animoto/http_engines/rest_client_adapter.rb
animoto-0.0.0.alpha8 ./lib/animoto/http_engines/rest_client_adapter.rb
animoto-0.0.0.alpha7 ./lib/animoto/http_engines/rest_client_adapter.rb
animoto-0.0.0.alpha6 ./lib/animoto/http_engines/rest_client_adapter.rb
animoto-0.0.0.alpha5 ./lib/animoto/http_engines/rest_client_adapter.rb
animoto-0.0.0.alpha4 ./lib/animoto/http_engines/rest_client_adapter.rb