Class: OAuth::ConsumerToken

### Home Classes Methods

### In Files

- lib/oauth/tokens/consumer_token.rb

### Parent

Token

### Methods

- ::from_hash
- ::new
- #request
- #sign!

### Files

- LICENSE
- README.rdoc
- TODO

### Class/Module Index

Quicksearch

- OAuth
- OAuth::AccessToken
- OAuth::CLI
- OAuth::Client
- OAuth::Client::Helper
- OAuth::Consumer
- OAuth::ConsumerToken
- OAuth::Error
- OAuth::Helper
- OAuth::OAuthTestHelper
- OAuth::Problem
- OAuth::RequestProxy
- OAuth::RequestProxy::ActionControllerRequest
- OAuth::RequestProxy::Base
- OAuth::RequestProxy::Curl
- OAuth::RequestProxy::Curl::Easy
- OAuth::RequestProxy::EventMachine
- OAuth::RequestProxy::EventMachine::HttpRequest
- OAuth::RequestProxy::JabberRequest
- OAuth::RequestProxy::MockRequest
- OAuth::RequestProxy::Net
- OAuth::RequestProxy::Net::HTTP
- OAuth::RequestProxy::Net::HTTP::HTTPRequest
- OAuth::RequestProxy::RackRequest
- OAuth::RequestProxy::Typhoeus
- OAuth::RequestProxy::Typhoeus::Request
- OAuth::RequestProxy::UnknownRequestType
- OAuth::RequestToken
- OAuth::Server
- OAuth::ServerToken
- OAuth::Signature
- OAuth::Signature::Base
- OAuth::Signature::HMAC
- OAuth::Signature::HMAC::Base
- OAuth::Signature::HMAC::MD5
- OAuth::Signature::HMAC::RMD160
- OAuth::Signature::HMAC::SHA1
- OAuth::Signature::HMAC::SHA2
- OAuth::Signature::MD5
- OAuth::Signature::PLAINTEXT
- OAuth::Signature::RSA
- OAuth::Signature::RSA::SHA1
- OAuth::Signature::SHA1
- OAuth::Signature::UnknownSignatureMethod
- OAuth::Token
- OAuth::Unauthorized
- ActionController
- ActionController::Base
- ActionController::TestRequest
- Digest
- Digest::HMAC
- EventMachine
- EventMachine::HttpClient
- Net
- Net::HTTPGenericRequest
- Object
- String

No matching classes.

# OAuth::ConsumerToken

Superclass for tokens used by OAuth Clients

### Attributes

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

### Public Class Methods

from_hash(consumer, hash) click to toggle 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

new(consumer, token="", secret="") click to toggle 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

request(http_method, path, *arguments) click to toggle source

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' })

    # 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!(request, options = {}) click to toggle source

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

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.