Class: OAuth::AccessToken

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

Overview

The Access Token is used for the actual “real” web service calls thatyou perform against the server

Instance Attribute Summary

Attributes inherited from ConsumerToken

#consumer

Attributes inherited from Token

#secret, #token

Instance Method Summary collapse

Methods inherited from ConsumerToken

#initialize, #request, #sign!

Methods inherited from Token

#initialize, #to_query

Methods included from Helper

#escape, #generate_key

Constructor Details

This class inherits a constructor from OAuth::ConsumerToken

Instance Method Details

#delete(path, headers = {}) ⇒ Object

Make a regular delete request using AccessToken

@response=@token.delete('/people/123')
@response=@token.delete('/people/123',{'Accept'=>'application/xml'})


119
120
121
# File 'lib/oauth/token.rb', line 119

def delete(path,headers={})
  request(:delete,path,headers)
end

#get(path, headers = {}) ⇒ Object

Make a regular get request using AccessToken

@response=@token.get('/people')
@response=@token.get('/people',{'Accept'=>'application/xml'})


78
79
80
# File 'lib/oauth/token.rb', line 78

def get(path,headers={})
  request(:get,path,headers)
end

#head(path, headers = {}) ⇒ Object

Make a regular head request using AccessToken

@response=@token.head('/people')


86
87
88
# File 'lib/oauth/token.rb', line 86

def head(path,headers={})
  request(:head,path,headers)
end

#post(path, body = '', headers = {}) ⇒ Object

Make a regular post request using AccessToken

@response=@token.post('/people')
@response=@token.post('/people',{:name=>'Bob',:email=>'[email protected]'})
@response=@token.post('/people',{:name=>'Bob',:email=>'[email protected]'},{'Accept'=>'application/xml'})
@response=@token.post('/people',nil,{'Accept'=>'application/xml'})
@response=@token.post('/people',@person.to_xml,{'Accept'=>'application/xml','Content-Type' => 'application/xml'})


98
99
100
# File 'lib/oauth/token.rb', line 98

def post(path, body = '',headers={})
  request(:post,path,body,headers)
end

#put(path, body = '', headers = {}) ⇒ Object

Make a regular put request using AccessToken

@response=@token.put('/people/123')
@response=@token.put('/people/123',{:name=>'Bob',:email=>'[email protected]'})
@response=@token.put('/people/123',{:name=>'Bob',:email=>'[email protected]'},{'Accept'=>'application/xml'})
@response=@token.put('/people/123',nil,{'Accept'=>'application/xml'})
@response=@token.put('/people/123',@person.to_xml,{'Accept'=>'application/xml','Content-Type' => 'application/xml'})


110
111
112
# File 'lib/oauth/token.rb', line 110

def put(path, body = '', headers={})
  request(:put,path,body,headers)
end