Class: Agree2::User
- Inherits:
-
Object
- Object
- Agree2::User
- Defined in:
- lib/agree2/user.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #agreements ⇒ Object
- #delete(path, options = {}) ⇒ Object
- #get(path, options = {}) ⇒ Object
- #head(path, options = {}) ⇒ Object
-
#initialize(client, key, secret) ⇒ User
constructor
A new instance of User.
-
#path ⇒ Object
:nodoc:.
- #post(path, data = nil, options = {}) ⇒ Object
- #put(path, data = nil, options = {}) ⇒ Object
-
#secret ⇒ Object
The AccessToken secret.
- #templates ⇒ Object
-
#token ⇒ Object
The AccessToken token.
Constructor Details
#initialize(client, key, secret) ⇒ User
Returns a new instance of User.
5 6 7 8 |
# File 'lib/agree2/user.rb', line 5 def initialize(client,key,secret) @client=client @access_token=OAuth::AccessToken.new @client.consumer,key,secret end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
4 5 6 |
# File 'lib/agree2/user.rb', line 4 def access_token @access_token end |
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/agree2/user.rb', line 4 def client @client end |
Instance Method Details
#agreements ⇒ Object
10 11 12 |
# File 'lib/agree2/user.rb', line 10 def agreements @agreements||=Agree2::ProxyCollection.new self,'/agreements','Agreement' end |
#delete(path, options = {}) ⇒ Object
34 35 36 |
# File 'lib/agree2/user.rb', line 34 def delete(path,={}) handle_response @access_token.delete(path,) end |
#get(path, options = {}) ⇒ Object
18 19 20 |
# File 'lib/agree2/user.rb', line 18 def get(path,={}) handle_response @access_token.get(path,{'Accept'=>'application/json'}.merge()) end |
#head(path, options = {}) ⇒ Object
22 23 24 |
# File 'lib/agree2/user.rb', line 22 def head(path,={}) handle_response @access_token.head(path,) end |
#path ⇒ Object
:nodoc:
50 51 52 |
# File 'lib/agree2/user.rb', line 50 def path #:nodoc: "" end |
#post(path, data = nil, options = {}) ⇒ Object
26 27 28 |
# File 'lib/agree2/user.rb', line 26 def post(path,data=nil,={}) handle_response @access_token.post(path,(data ? data.to_json : nil),AGREE2_JSON_HEADERS.merge()) end |
#put(path, data = nil, options = {}) ⇒ Object
30 31 32 |
# File 'lib/agree2/user.rb', line 30 def put(path,data=nil,={}) handle_response @access_token.put(path,(data ? data.to_json : nil),AGREE2_JSON_HEADERS.merge() ) end |
#secret ⇒ Object
The AccessToken secret
46 47 48 |
# File 'lib/agree2/user.rb', line 46 def secret @access_token.secret end |
#templates ⇒ Object
14 15 16 |
# File 'lib/agree2/user.rb', line 14 def templates @templates||=Agree2::ProxyCollection.new self,'/masters','Template' end |
#token ⇒ Object
The AccessToken token
41 42 43 |
# File 'lib/agree2/user.rb', line 41 def token @access_token.token end |