Class: CrowiUser
- Inherits:
-
CrowiModelBase
- Object
- CrowiModelBase
- CrowiUser
- Defined in:
- lib/crowi/client/model/crowi_user.rb
Overview
Crowi User model class
Instance Attribute Summary collapse
-
#_id ⇒ Object
readonly
Returns the value of attribute _id.
-
#admin ⇒ Object
readonly
Returns the value of attribute admin.
-
#createdAt ⇒ Object
readonly
Returns the value of attribute createdAt.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#isGravatarEnabled ⇒ Object
readonly
Returns the value of attribute isGravatarEnabled.
-
#lang ⇒ Object
readonly
Returns the value of attribute lang.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ CrowiUser
constructor
Constractor.
Constructor Details
#initialize(params = {}) ⇒ CrowiUser
Except running register method always called parse method.
Constractor
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/crowi/client/model/crowi_user.rb', line 11 def initialize(params = {}) init_params = { _id: nil, email: nil, username: nil, name: '', admin: false, createdAt: '', status: 0, lang: '', isGravatarEnabled: false } params = init_params.merge(params.map { |k,v| [k.to_sym, v] }.to_h) if (params[:_id] == nil || params[:email] == nil || params[:username] == nil) raise ArgumentError.new('Parameters id and email and name are required.') end CrowiModelFactory.instance.register({ user_createdAt: Proc.new { |date_str| date_str != nil && DateTime.parse(date_str) }, }) maked_params = {} params.each do |k,v| maker = CrowiModelFactory.instance.maker('user_' + k.to_s) maked_params[k] = maker.call(v) end super(maked_params) end |
Instance Attribute Details
#_id ⇒ Object (readonly)
Returns the value of attribute _id.
5 6 7 |
# File 'lib/crowi/client/model/crowi_user.rb', line 5 def _id @_id end |
#admin ⇒ Object (readonly)
Returns the value of attribute admin.
5 6 7 |
# File 'lib/crowi/client/model/crowi_user.rb', line 5 def admin @admin end |
#createdAt ⇒ Object (readonly)
Returns the value of attribute createdAt.
5 6 7 |
# File 'lib/crowi/client/model/crowi_user.rb', line 5 def createdAt @createdAt end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
5 6 7 |
# File 'lib/crowi/client/model/crowi_user.rb', line 5 def email @email end |
#isGravatarEnabled ⇒ Object (readonly)
Returns the value of attribute isGravatarEnabled.
5 6 7 |
# File 'lib/crowi/client/model/crowi_user.rb', line 5 def isGravatarEnabled @isGravatarEnabled end |
#lang ⇒ Object (readonly)
Returns the value of attribute lang.
5 6 7 |
# File 'lib/crowi/client/model/crowi_user.rb', line 5 def lang @lang end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/crowi/client/model/crowi_user.rb', line 5 def name @name end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/crowi/client/model/crowi_user.rb', line 5 def status @status end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
5 6 7 |
# File 'lib/crowi/client/model/crowi_user.rb', line 5 def username @username end |