class 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 9 def self.from_hash(consumer, hash) 10 token = new(consumer, hash[:oauth_token], hash[:oauth_token_secret]) 11 token.params = hash 12 token 13 end
new(consumer, token = "", secret = "")
click to toggle source
Calls superclass method
# File lib/oauth/tokens/consumer_token.rb 15 def initialize(consumer, token = "", secret = "") 16 super(token, secret) 17 @consumer = consumer 18 @params = {} 19 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 26 def request(http_method, path, *arguments) 27 @response = consumer.request(http_method, path, self, {}, *arguments) 28 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 31 def sign!(request, options = {}) 32 consumer.sign!(request, self, options) 33 end