Sha256: dc904d5de80f03c649a59ba9bb441fe06fa1d08b49c932c62241fb9a202f931b

Contents?: true

Size: 646 Bytes

Versions: 3

Compression:

Stored size: 646 Bytes

Contents

require 'typhoeus'

module Animoto
  module HTTPEngines
    class TyphoeusAdapter < Animoto::HTTPEngines::Base
      
      # @return [String]
      def request method, url, body = nil, headers = {}, options = {}
        response = ::Typhoeus::Request.run(url, {
          :method => method,
          :body => body,
          :headers => headers,
          :timeout => options[:timeout],
          :username => options[:username],
          :password => options[:password]
        })
        check_response response.code, response.body
        response.body
      end   
    end
    
    adapter_map.merge! :typhoeus => TyphoeusAdapter
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
animoto-0.1.1.beta1 ./lib/animoto/http_engines/typhoeus_adapter.rb
animoto-0.1.0.beta1 ./lib/animoto/http_engines/typhoeus_adapter.rb
animoto-0.1.0.beta0 ./lib/animoto/http_engines/typhoeus_adapter.rb