Class: CTM::User
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#role ⇒ Object
Returns the value of attribute role.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(data, token = nil) ⇒ User
constructor
A new instance of User.
- #name ⇒ Object
- #save ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(data, token = nil) ⇒ User
Returns a new instance of User.
10 11 12 13 14 15 16 17 |
# File 'lib/ctm/user.rb', line 10 def initialize(data, token=nil) super(data, token) @id = data['id'] @first_name = data['first_name'] @last_name = data['last_name'] @email = data['email'] @role = data['role'] end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
4 5 6 |
# File 'lib/ctm/user.rb', line 4 def email @email end |
#first_name ⇒ Object
Returns the value of attribute first_name.
4 5 6 |
# File 'lib/ctm/user.rb', line 4 def first_name @first_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/ctm/user.rb', line 3 def id @id end |
#last_name ⇒ Object
Returns the value of attribute last_name.
4 5 6 |
# File 'lib/ctm/user.rb', line 4 def last_name @last_name end |
#role ⇒ Object
Returns the value of attribute role.
4 5 6 |
# File 'lib/ctm/user.rb', line 4 def role @role end |
Instance Method Details
#name ⇒ Object
6 7 8 |
# File 'lib/ctm/user.rb', line 6 def name "#{first_name} #{last_name}" end |
#save ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/ctm/user.rb', line 19 def save = { :first_name => @first_name, :last_name => @last_name, :email => @email, :role => @role } super() end |