Class: OAuth::RequestToken

Inherits:
ConsumerToken show all
Defined in:
lib/oauth/tokens/request_token.rb

Overview

The RequestToken is used for the initial Request. This is normally created by the Consumer object.

Instance Attribute Summary

Attributes inherited from ConsumerToken

#consumer, #params, #response

Attributes inherited from Token

#secret, #token

Instance Method Summary collapse

Methods inherited from ConsumerToken

from_hash, #initialize, #request, #sign!

Methods inherited from Token

#initialize, #to_query

Methods included from Helper

#escape, #generate_key, #generate_timestamp, #normalize, #parse_header, #unescape

Constructor Details

This class inherits a constructor from OAuth::ConsumerToken

Instance Method Details

#authorize_url(params = nil) ⇒ Object

Generate an authorization URL for user authorization



7
8
9
10
# File 'lib/oauth/tokens/request_token.rb', line 7

def authorize_url(params = nil)
  params = (params || {}).merge(:oauth_token => self.token)
  build_authorize_url(consumer.authorize_url, params)
end

#get_access_token(options = {}) ⇒ Object

exchange for AccessToken on server



13
14
15
16
# File 'lib/oauth/tokens/request_token.rb', line 13

def get_access_token(options = {})
  response = consumer.token_request(consumer.http_method, (consumer.access_token_url? ? consumer.access_token_url : consumer.access_token_path), self, options)
  OAuth::AccessToken.from_hash(consumer, response)
end