Sha256: ec33e190b10ac43504b0260e05c30ab6f14b2910231aae697d3bb2d27fa73c3a

Contents?: true

Size: 820 Bytes

Versions: 12

Compression:

Stored size: 820 Bytes

Contents

require 'patron'

module Animoto
  module HTTPEngines
    class PatronAdapter < Animoto::HTTPEngines::Base
      
      # @return [String]
      def request method, url, body = nil, headers = {}, options = {}
        session = build_session options
        response = session.request method, url, headers, :data => body
        [response.status, response.body]
      end
      
      private
      
      # Builds the Session object.
      #
      # @param [Hash{Symbol=>Object}] options options for the Session
      # @return [Patron::Session] the Session object
      def build_session options
        session = ::Patron::Session.new
        session.timeout = options[:timeout]
        session.username = options[:username]
        session.password = options[:password]
        session
      end
    end    
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
animoto-1.5.6 ./lib/animoto/http_engines/patron_adapter.rb
animoto-1.5.5 ./lib/animoto/http_engines/patron_adapter.rb
animoto-1.5.4 ./lib/animoto/http_engines/patron_adapter.rb
animoto-1.5.3 ./lib/animoto/http_engines/patron_adapter.rb
animoto-1.5.2 ./lib/animoto/http_engines/patron_adapter.rb
animoto-1.5.1 ./lib/animoto/http_engines/patron_adapter.rb
animoto-1.5.0 ./lib/animoto/http_engines/patron_adapter.rb
animoto-1.3.1 ./lib/animoto/http_engines/patron_adapter.rb
animoto-1.3.0 ./lib/animoto/http_engines/patron_adapter.rb
animoto-1.2.0 ./lib/animoto/http_engines/patron_adapter.rb
animoto-1.1.1 ./lib/animoto/http_engines/patron_adapter.rb
animoto-1.1.0 ./lib/animoto/http_engines/patron_adapter.rb