Class: CrowiPageRevision

Inherits:
CrowiModelBase show all
Defined in:
lib/crowi/client/model/crowi_page_revision.rb

Overview

Crowi Page revision model class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ CrowiPageRevision

TODO:

Except running register method always called parse method.

Constractor

Parameters:

  • User (Hash)

    model shown as hash



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/crowi/client/model/crowi_page_revision.rb', line 10

def initialize(params = {})
  init_params = {
    _id: '', author: nil, body: nil, path: nil, __v: 0, createdAt: nil,
    format: ''
  }

  params = init_params.merge(params.map { |k,v| [k.to_sym, v] }.to_h)
  if (params[:_id] == nil ||  params[:path] == nil)
    raise ArgumentError.new('Parameters _id and path are required.')
  end

  CrowiModelFactory.instance.register({
    page_revision_createdAt: Proc.new { |date_str|
                                        date_str != nil && DateTime.parse(date_str) },
  })
  maked_params = {}
  params.each do |k,v|
    maker = CrowiModelFactory.instance.maker('page_revision_' + k.to_s)
    maked_params[k] = maker.call(v)
  end
  super(maked_params)
end

Instance Attribute Details

#__vObject (readonly)

Returns the value of attribute __v.



5
6
7
# File 'lib/crowi/client/model/crowi_page_revision.rb', line 5

def __v
  @__v
end

#_idObject (readonly)

Returns the value of attribute _id.



5
6
7
# File 'lib/crowi/client/model/crowi_page_revision.rb', line 5

def _id
  @_id
end

#authorObject (readonly)

Returns the value of attribute author.



5
6
7
# File 'lib/crowi/client/model/crowi_page_revision.rb', line 5

def author
  @author
end

#bodyObject (readonly)

Returns the value of attribute body.



5
6
7
# File 'lib/crowi/client/model/crowi_page_revision.rb', line 5

def body
  @body
end

#createdAtObject (readonly)

Returns the value of attribute createdAt.



5
6
7
# File 'lib/crowi/client/model/crowi_page_revision.rb', line 5

def createdAt
  @createdAt
end

#formatObject (readonly)

Returns the value of attribute format.



5
6
7
# File 'lib/crowi/client/model/crowi_page_revision.rb', line 5

def format
  @format
end

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/crowi/client/model/crowi_page_revision.rb', line 5

def path
  @path
end