Sha256: 2bfaaf3b33fe825a639bf602a2728a886a7032832f4314ab6b530b5b833e5d1f

Contents?: true

Size: 795 Bytes

Versions: 2

Compression:

Stored size: 795 Bytes

Contents

module OAuthActiveResource

  class Connection < ActiveResource::Connection
    def initialize(oauth_connection, *args)    
      @oauth_connection = oauth_connection
      super(*args)
    end

    # an alternative for the get method, which doesnt tries to decode the response
    def get_without_decoding(path, headers = {})
      request(:get, path, build_request_headers(headers, :get))
    end
    
   private
    def request(method, path, *arguments)    
      if @oauth_connection == nil
        super(method, path, *arguments)
      else
        result = @oauth_connection.send(method, "#{site.scheme}://#{site.host}:#{site.port}#{path}", *arguments) 
        handle_response(result)
      end
    rescue Timeout::Error => e 
      raise TimeoutError.new(e.message)
    end   
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jwagener-oauth-active-resource-0.1.0 lib/oauth_active_resource/connection.rb
jwagener-oauth-active-resource-0.1.1 lib/oauth_active_resource/connection.rb