Class: Hachi::Models::User
Constant Summary collapse
- ROLES =
%w(read write admin).freeze
Instance Attribute Summary collapse
-
#login ⇒ Object
readonly
Returns the value of attribute login.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#roles ⇒ Object
readonly
Returns the value of attribute roles.
Instance Method Summary collapse
-
#initialize(login:, name:, roles:, password:) ⇒ User
constructor
A new instance of User.
- #payload ⇒ Object
Constructor Details
#initialize(login:, name:, roles:, password:) ⇒ User
Returns a new instance of User.
13 14 15 16 17 18 19 20 |
# File 'lib/hachi/models/user.rb', line 13 def initialize(login:, name:, roles:, password:) @login = login @name = name @roles = roles @password = password validate_roles end |
Instance Attribute Details
#login ⇒ Object (readonly)
Returns the value of attribute login.
6 7 8 |
# File 'lib/hachi/models/user.rb', line 6 def login @login end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/hachi/models/user.rb', line 7 def name @name end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
9 10 11 |
# File 'lib/hachi/models/user.rb', line 9 def password @password end |
#roles ⇒ Object (readonly)
Returns the value of attribute roles.
8 9 10 |
# File 'lib/hachi/models/user.rb', line 8 def roles @roles end |
Instance Method Details
#payload ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/hachi/models/user.rb', line 22 def payload { login: login, name: name, roles: roles, password: password }.compact end |