Class OAuth::ConsumerToken
In: lib/oauth/tokens/consumer_token.rb
Parent: Token

Superclass for tokens used by OAuth Clients

Methods

from_hash   new   request   sign!  

Attributes

consumer  [RW] 
params  [RW] 
response  [R] 

Public Class methods

[Source]

# File lib/oauth/tokens/consumer_token.rb, line 7
    def self.from_hash(consumer, hash)
      token = self.new(consumer, hash[:oauth_token], hash[:oauth_token_secret])
      token.params = hash
      token
    end

[Source]

# File lib/oauth/tokens/consumer_token.rb, line 13
    def initialize(consumer, token="", secret="")
      super(token, secret)
      @consumer = consumer
      @params   = {}
    end

Public Instance methods

Make a signed request using given http_method to the path

  @token.request(:get,  '/people')
  @token.request(:post, '/people', @person.to_xml, { 'Content-Type' => 'application/xml' })

[Source]

# File lib/oauth/tokens/consumer_token.rb, line 24
    def request(http_method, path, *arguments)
      @response = consumer.request(http_method, path, self, {}, *arguments)
    end

Sign a request generated elsewhere using Net:HTTP::Post.new or friends

[Source]

# File lib/oauth/tokens/consumer_token.rb, line 29
    def sign!(request, options = {})
      consumer.sign!(request, self, options)
    end

[Validate]