Class: ECMBlockchain::AssetModel
- Inherits:
-
Object
- Object
- ECMBlockchain::AssetModel
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/ecm-blockchain-api/models/asset_model.rb
Instance Attribute Summary collapse
-
#access ⇒ Object
Returns the value of attribute access.
-
#content ⇒ Object
Returns the value of attribute content.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#createdBy ⇒ Object
Returns the value of attribute createdBy.
-
#events ⇒ Object
Returns the value of attribute events.
-
#file ⇒ Object
Returns the value of attribute file.
-
#groupId ⇒ Object
Returns the value of attribute groupId.
-
#lastInteraction ⇒ Object
Returns the value of attribute lastInteraction.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#title ⇒ Object
Returns the value of attribute title.
-
#txId ⇒ Object
Returns the value of attribute txId.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Class Method Summary collapse
Instance Method Summary collapse
- #error ⇒ Object
-
#initialize(data = {}) ⇒ AssetModel
constructor
A new instance of AssetModel.
- #success? ⇒ Boolean
Constructor Details
#initialize(data = {}) ⇒ AssetModel
Returns a new instance of AssetModel.
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ecm-blockchain-api/models/asset_model.rb', line 32 def initialize(data={}) @uuid = data.fetch(:uuid) { nil } @txId = data.fetch(:txId) { nil } @groupId = data.fetch(:groupId) { nil } @title = data.fetch(:title) { nil } @summary = data.fetch(:summary) { nil } @createdBy = data.fetch(:createdBy) { nil } @owner = data.fetch(:owner) { nil } @file = ECMBlockchain::DataFile.new(data.fetch(:file) { }) @content = ECMBlockchain::DataContent.new(data.fetch(:content) { }) end |
Instance Attribute Details
#access ⇒ Object
Returns the value of attribute access.
8 9 10 |
# File 'lib/ecm-blockchain-api/models/asset_model.rb', line 8 def access @access end |
#content ⇒ Object
Returns the value of attribute content.
8 9 10 |
# File 'lib/ecm-blockchain-api/models/asset_model.rb', line 8 def content @content end |
#created_at ⇒ Object
Returns the value of attribute created_at.
8 9 10 |
# File 'lib/ecm-blockchain-api/models/asset_model.rb', line 8 def created_at @created_at end |
#createdBy ⇒ Object
Returns the value of attribute createdBy.
8 9 10 |
# File 'lib/ecm-blockchain-api/models/asset_model.rb', line 8 def createdBy @createdBy end |
#events ⇒ Object
Returns the value of attribute events.
8 9 10 |
# File 'lib/ecm-blockchain-api/models/asset_model.rb', line 8 def events @events end |
#file ⇒ Object
Returns the value of attribute file.
8 9 10 |
# File 'lib/ecm-blockchain-api/models/asset_model.rb', line 8 def file @file end |
#groupId ⇒ Object
Returns the value of attribute groupId.
8 9 10 |
# File 'lib/ecm-blockchain-api/models/asset_model.rb', line 8 def groupId @groupId end |
#lastInteraction ⇒ Object
Returns the value of attribute lastInteraction.
8 9 10 |
# File 'lib/ecm-blockchain-api/models/asset_model.rb', line 8 def lastInteraction @lastInteraction end |
#owner ⇒ Object
Returns the value of attribute owner.
8 9 10 |
# File 'lib/ecm-blockchain-api/models/asset_model.rb', line 8 def owner @owner end |
#summary ⇒ Object
Returns the value of attribute summary.
8 9 10 |
# File 'lib/ecm-blockchain-api/models/asset_model.rb', line 8 def summary @summary end |
#title ⇒ Object
Returns the value of attribute title.
8 9 10 |
# File 'lib/ecm-blockchain-api/models/asset_model.rb', line 8 def title @title end |
#txId ⇒ Object
Returns the value of attribute txId.
8 9 10 |
# File 'lib/ecm-blockchain-api/models/asset_model.rb', line 8 def txId @txId end |
#uuid ⇒ Object
Returns the value of attribute uuid.
8 9 10 |
# File 'lib/ecm-blockchain-api/models/asset_model.rb', line 8 def uuid @uuid end |
Class Method Details
.verify(data = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ecm-blockchain-api/models/asset_model.rb', line 15 def verify(data={}) asset = self.new(data) raise ECMBlockchain::Error.raise_error( OpenStruct.new( code: 422, body: { error: { message: asset.errors..first, details: '' } }.to_json ) ) unless asset.valid? asset end |
Instance Method Details
#error ⇒ Object
48 49 50 |
# File 'lib/ecm-blockchain-api/models/asset_model.rb', line 48 def error nil end |
#success? ⇒ Boolean
44 45 46 |
# File 'lib/ecm-blockchain-api/models/asset_model.rb', line 44 def success? true end |