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.
10 11 12 13 14 15 16 17 |
# File 'lib/hachi/models/user.rb', line 10 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.
6 7 8 |
# File 'lib/hachi/models/user.rb', line 6 def name @name end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
6 7 8 |
# File 'lib/hachi/models/user.rb', line 6 def password @password end |
#roles ⇒ Object (readonly)
Returns the value of attribute roles.
6 7 8 |
# File 'lib/hachi/models/user.rb', line 6 def roles @roles end |
Instance Method Details
#payload ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/hachi/models/user.rb', line 19 def payload { login: login, name: name, roles: roles, password: password }.compact end |