Class: Protolink::User
- Inherits:
-
Object
- Object
- Protolink::User
- Defined in:
- lib/protolink/user.rb
Instance Attribute Summary collapse
-
#avatar_url ⇒ Object
readonly
Returns the value of attribute avatar_url.
-
#communication_token ⇒ Object
readonly
Returns the value of attribute communication_token.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#external_profile_url ⇒ Object
readonly
Returns the value of attribute external_profile_url.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#login ⇒ Object
readonly
Returns the value of attribute login.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node_id ⇒ Object
readonly
Returns the value of attribute node_id.
Instance Method Summary collapse
-
#auth_token ⇒ Object
get token for autologin.
- #delete! ⇒ Object
-
#initialize(connection, attributes = {}) ⇒ User
constructor
A new instance of User.
Constructor Details
#initialize(connection, attributes = {}) ⇒ User
Returns a new instance of User.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/protolink/user.rb', line 5 def initialize(connection, attributes = {}) @connection = connection @id = attributes['id'] @name = attributes['name'] @login = attributes['login'] @email = attributes['email'] @avatar_url = attributes['avatar_url'] @node_id = attributes['node_id'] @external_profile_url = attributes['external_profile_url'] @communication_token = attributes['communication_token'] @loaded = false end |
Instance Attribute Details
#avatar_url ⇒ Object (readonly)
Returns the value of attribute avatar_url.
3 4 5 |
# File 'lib/protolink/user.rb', line 3 def avatar_url @avatar_url end |
#communication_token ⇒ Object (readonly)
Returns the value of attribute communication_token.
3 4 5 |
# File 'lib/protolink/user.rb', line 3 def communication_token @communication_token end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
3 4 5 |
# File 'lib/protolink/user.rb', line 3 def email @email end |
#external_profile_url ⇒ Object (readonly)
Returns the value of attribute external_profile_url.
3 4 5 |
# File 'lib/protolink/user.rb', line 3 def external_profile_url @external_profile_url end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/protolink/user.rb', line 3 def id @id end |
#login ⇒ Object (readonly)
Returns the value of attribute login.
3 4 5 |
# File 'lib/protolink/user.rb', line 3 def login @login end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/protolink/user.rb', line 3 def name @name end |
#node_id ⇒ Object (readonly)
Returns the value of attribute node_id.
3 4 5 |
# File 'lib/protolink/user.rb', line 3 def node_id @node_id end |
Instance Method Details
#auth_token ⇒ Object
get token for autologin
19 20 21 |
# File 'lib/protolink/user.rb', line 19 def auth_token connection.get("/api/v1/users/#{self.id}/auth_token.json")["token"] end |
#delete! ⇒ Object
23 24 25 |
# File 'lib/protolink/user.rb', line 23 def delete! connection.delete("/api/v1/users/#{self.id}") end |