Class: CrowiAttachment
- Inherits:
-
CrowiModelBase
- Object
- CrowiModelBase
- CrowiAttachment
- Defined in:
- lib/crowi/client/model/crowi_attachment.rb
Overview
Crowi Attachment model class
Instance Attribute Summary collapse
-
#__v ⇒ Object
readonly
Returns the value of attribute __v.
-
#_id ⇒ Object
readonly
Returns the value of attribute _id.
-
#createdAt ⇒ Object
readonly
Returns the value of attribute createdAt.
-
#creator ⇒ Object
readonly
Returns the value of attribute creator.
-
#fileFormat ⇒ Object
readonly
Returns the value of attribute fileFormat.
-
#fileName ⇒ Object
readonly
Returns the value of attribute fileName.
-
#filePath ⇒ Object
readonly
Returns the value of attribute filePath.
-
#fileSize ⇒ Object
readonly
Returns the value of attribute fileSize.
-
#originalName ⇒ Object
readonly
Returns the value of attribute originalName.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ CrowiAttachment
constructor
Constractor.
Constructor Details
#initialize(params = {}) ⇒ CrowiAttachment
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 33 |
# File 'lib/crowi/client/model/crowi_attachment.rb', line 11 def initialize(params = {}) init_params = { _id: nil, fileFormat: '', fileName: '', originalName: '', filePath: nil, creator: nil, page: '', __v: 0, createdAt: '', fileSize: 0, url: '' } params = init_params.merge(params.map { |k,v| [k.to_sym, v] }.to_h) if (params[:_id] == nil) raise ArgumentError.new('Parameters id is required.') end CrowiModelFactory.instance.register({ attachment_creator: Proc.new { |param| param != nil && param.is_a?(String) ? param : CrowiUser.new(param) }, attachment_createdAt: Proc.new { |date_str| date_str != nil && DateTime.parse(date_str) }, }) maked_params = {} params.each do |k,v| maker = CrowiModelFactory.instance.maker('attachment_' + 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.
5 6 7 |
# File 'lib/crowi/client/model/crowi_attachment.rb', line 5 def __v @__v end |
#_id ⇒ Object (readonly)
Returns the value of attribute _id.
5 6 7 |
# File 'lib/crowi/client/model/crowi_attachment.rb', line 5 def _id @_id end |
#createdAt ⇒ Object (readonly)
Returns the value of attribute createdAt.
5 6 7 |
# File 'lib/crowi/client/model/crowi_attachment.rb', line 5 def createdAt @createdAt end |
#creator ⇒ Object (readonly)
Returns the value of attribute creator.
5 6 7 |
# File 'lib/crowi/client/model/crowi_attachment.rb', line 5 def creator @creator end |
#fileFormat ⇒ Object (readonly)
Returns the value of attribute fileFormat.
5 6 7 |
# File 'lib/crowi/client/model/crowi_attachment.rb', line 5 def fileFormat @fileFormat end |
#fileName ⇒ Object (readonly)
Returns the value of attribute fileName.
5 6 7 |
# File 'lib/crowi/client/model/crowi_attachment.rb', line 5 def fileName @fileName end |
#filePath ⇒ Object (readonly)
Returns the value of attribute filePath.
5 6 7 |
# File 'lib/crowi/client/model/crowi_attachment.rb', line 5 def filePath @filePath end |
#fileSize ⇒ Object (readonly)
Returns the value of attribute fileSize.
5 6 7 |
# File 'lib/crowi/client/model/crowi_attachment.rb', line 5 def fileSize @fileSize end |
#originalName ⇒ Object (readonly)
Returns the value of attribute originalName.
5 6 7 |
# File 'lib/crowi/client/model/crowi_attachment.rb', line 5 def originalName @originalName end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
5 6 7 |
# File 'lib/crowi/client/model/crowi_attachment.rb', line 5 def page @page end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/crowi/client/model/crowi_attachment.rb', line 5 def url @url end |