Class: OAuth::ConsumerToken
Overview
Superclass for tokens used by OAuth Clients
Direct Known Subclasses
Instance Attribute Summary collapse
-
#consumer ⇒ Object
Returns the value of attribute consumer.
Attributes inherited from Token
Instance Method Summary collapse
-
#initialize(consumer, token, secret) ⇒ ConsumerToken
constructor
A new instance of ConsumerToken.
-
#request(http_method, path, *arguments) ⇒ Object
Make a signed request using given http_method to the path.
-
#sign!(request, options = {}) ⇒ Object
Sign a request generated elsewhere using Net:HTTP::Post.new or friends.
Methods inherited from Token
Methods included from Helper
Constructor Details
#initialize(consumer, token, secret) ⇒ ConsumerToken
Returns a new instance of ConsumerToken.
33 34 35 36 |
# File 'lib/oauth/token.rb', line 33 def initialize(consumer,token,secret) super token,secret @consumer=consumer end |
Instance Attribute Details
#consumer ⇒ Object
Returns the value of attribute consumer.
31 32 33 |
# File 'lib/oauth/token.rb', line 31 def consumer @consumer end |
Instance Method Details
#request(http_method, path, *arguments) ⇒ Object
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' })
43 44 45 |
# File 'lib/oauth/token.rb', line 43 def request(http_method,path,*arguments) response=consumer.request(http_method,path,self,{},*arguments) end |
#sign!(request, options = {}) ⇒ Object
Sign a request generated elsewhere using Net:HTTP::Post.new or friends
48 49 50 |
# File 'lib/oauth/token.rb', line 48 def sign!(request, = {}) consumer.sign!(request,self,) end |