Class: CrowiPage
- Inherits:
-
CrowiModelBase
- Object
- CrowiModelBase
- CrowiPage
- Defined in:
- lib/crowi/client/model/crowi_page.rb
Overview
Crowi Page model class
Constant Summary collapse
- GRANT_PUBLIC =
1.freeze
- GRANT_RESTRICTED =
2.freeze
- GRANT_SPECIFIED =
3.freeze
- GRANT_OWNER =
4.freeze
- STATUS_WIP =
'wip'.freeze
- STATUS_PUBLISHED =
'published'.freeze
- STATUS_DELETED =
'deleted'.freeze
- STATUS_DEPRECATED =
'deprecated'.freeze
Instance Attribute Summary collapse
-
#__v ⇒ Object
readonly
Returns the value of attribute __v.
-
#_id ⇒ Object
readonly
Returns the value of attribute _id.
-
#commentCount ⇒ Object
readonly
Returns the value of attribute commentCount.
-
#createdAt ⇒ Object
readonly
Returns the value of attribute createdAt.
-
#creator ⇒ Object
readonly
Returns the value of attribute creator.
-
#grant ⇒ Object
readonly
Returns the value of attribute grant.
-
#grantedUsers ⇒ Object
readonly
Returns the value of attribute grantedUsers.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#lastUpdateUser ⇒ Object
readonly
Returns the value of attribute lastUpdateUser.
-
#liker ⇒ Object
readonly
Returns the value of attribute liker.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#redirectTo ⇒ Object
readonly
Returns the value of attribute redirectTo.
-
#revision ⇒ Object
readonly
Returns the value of attribute revision.
-
#seenUsers ⇒ Object
readonly
Returns the value of attribute seenUsers.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#updatedAt ⇒ Object
readonly
Returns the value of attribute updatedAt.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ CrowiPage
constructor
Constract.
Constructor Details
#initialize(params = {}) ⇒ CrowiPage
Except running register method always called parse method.
Constract
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/crowi/client/model/crowi_page.rb', line 23 def initialize(params = {}) init_params = { _id: '', redirectTo: nil, updatedAt: '', lastUpdateUser: '', creator: nil, path: nil, __v: 0, revision: nil, createdAt: '', commentCount: 0, seenUsers: [], liker: [], grantedUsers: [], grant: 0, status: '', id: '' } params = init_params.merge(params.map { |k,v| [k.to_sym, v] }.to_h) if (params[:_id] == nil || params[:path] == nil || params[:id] == nil) raise ArgumentError.new('Parameters _id, path and id are required.') end # @note Parameters lastUpdateUser and creator have two patterns ID only or Object. CrowiModelFactory.instance.register({ page_updatedAt: Proc.new { |str| str != nil && DateTime.parse(str) }, page_lastUpdateUser: Proc.new { |param| param != nil && param.is_a?(String) ? param : CrowiUser.new(param) }, page_creator: Proc.new { |param| param != nil && param.is_a?(String) ? param : CrowiUser.new(param) }, page_createdAt: Proc.new { |str| str != nil && DateTime.parse(str) }, page_revision: Proc.new { |param| param != nil && CrowiPageRevision.new(param) }, }) maked_params = {} params.each do |k,v| maker = CrowiModelFactory.instance.maker('page_' + k.to_s) maked_params[k] = maker.call(v) end super(maked_params) end |
Instance Attribute Details
#__v ⇒ Object (readonly)
Returns the value of attribute __v.
15 16 17 |
# File 'lib/crowi/client/model/crowi_page.rb', line 15 def __v @__v end |
#_id ⇒ Object (readonly)
Returns the value of attribute _id.
15 16 17 |
# File 'lib/crowi/client/model/crowi_page.rb', line 15 def _id @_id end |
#commentCount ⇒ Object (readonly)
Returns the value of attribute commentCount.
15 16 17 |
# File 'lib/crowi/client/model/crowi_page.rb', line 15 def commentCount @commentCount end |
#createdAt ⇒ Object (readonly)
Returns the value of attribute createdAt.
15 16 17 |
# File 'lib/crowi/client/model/crowi_page.rb', line 15 def createdAt @createdAt end |
#creator ⇒ Object (readonly)
Returns the value of attribute creator.
15 16 17 |
# File 'lib/crowi/client/model/crowi_page.rb', line 15 def creator @creator end |
#grant ⇒ Object (readonly)
Returns the value of attribute grant.
15 16 17 |
# File 'lib/crowi/client/model/crowi_page.rb', line 15 def grant @grant end |
#grantedUsers ⇒ Object (readonly)
Returns the value of attribute grantedUsers.
15 16 17 |
# File 'lib/crowi/client/model/crowi_page.rb', line 15 def grantedUsers @grantedUsers end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
15 16 17 |
# File 'lib/crowi/client/model/crowi_page.rb', line 15 def id @id end |
#lastUpdateUser ⇒ Object (readonly)
Returns the value of attribute lastUpdateUser.
15 16 17 |
# File 'lib/crowi/client/model/crowi_page.rb', line 15 def lastUpdateUser @lastUpdateUser end |
#liker ⇒ Object (readonly)
Returns the value of attribute liker.
15 16 17 |
# File 'lib/crowi/client/model/crowi_page.rb', line 15 def liker @liker end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
15 16 17 |
# File 'lib/crowi/client/model/crowi_page.rb', line 15 def path @path end |
#redirectTo ⇒ Object (readonly)
Returns the value of attribute redirectTo.
15 16 17 |
# File 'lib/crowi/client/model/crowi_page.rb', line 15 def redirectTo @redirectTo end |
#revision ⇒ Object (readonly)
Returns the value of attribute revision.
15 16 17 |
# File 'lib/crowi/client/model/crowi_page.rb', line 15 def revision @revision end |
#seenUsers ⇒ Object (readonly)
Returns the value of attribute seenUsers.
15 16 17 |
# File 'lib/crowi/client/model/crowi_page.rb', line 15 def seenUsers @seenUsers end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
15 16 17 |
# File 'lib/crowi/client/model/crowi_page.rb', line 15 def status @status end |
#updatedAt ⇒ Object (readonly)
Returns the value of attribute updatedAt.
15 16 17 |
# File 'lib/crowi/client/model/crowi_page.rb', line 15 def updatedAt @updatedAt end |