Class: Nem::Model::MosaicDefinition

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Nem::Mixin::Assignable
Defined in:
lib/nem/model/mosaic_definition.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Nem::Mixin::Assignable

#initialize

Instance Attribute Details

#creatorObject (readonly)

Returns the value of attribute creator.



14
15
16
# File 'lib/nem/model/mosaic_definition.rb', line 14

def creator
  @creator
end

#descriptionObject (readonly)

Returns the value of attribute description.



14
15
16
# File 'lib/nem/model/mosaic_definition.rb', line 14

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



14
15
16
# File 'lib/nem/model/mosaic_definition.rb', line 14

def id
  @id
end

#levyObject (readonly)

Returns the value of attribute levy.



14
15
16
# File 'lib/nem/model/mosaic_definition.rb', line 14

def levy
  @levy
end

#meta_idObject (readonly)

Returns the value of attribute meta_id.



14
15
16
# File 'lib/nem/model/mosaic_definition.rb', line 14

def meta_id
  @meta_id
end

#propertiesObject (readonly)

Returns the value of attribute properties.



14
15
16
# File 'lib/nem/model/mosaic_definition.rb', line 14

def properties
  @properties
end

Class Method Details

.new_from_mosaic_definition(hash) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/nem/model/mosaic_definition.rb', line 21

def self.new_from_mosaic_definition(hash)
  id = MosaicId.new_from_mosaic_id(hash[:id])
  props = MosaicProperties.new_from_mosaic_properties(hash[:properties])
  levy = MosaicLevy.new_from_mosaic_levy(hash[:levy])
  new(
    creator: hash[:creator],
    description: hash[:description],
    id: id,
    properties: props,
    levy: levy
  )
end

.new_from_mosaic_definition_meta_data_pair(hash) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/nem/model/mosaic_definition.rb', line 34

def self.(hash)
  meta = hash[:meta]
  mosaic = hash[:mosaic]
  id = MosaicId.new_from_mosaic_id(mosaic[:id])
  props = MosaicProperties.new_from_mosaic_properties(mosaic[:properties])
  levy = MosaicLevy.new_from_mosaic_levy(mosaic[:levy])
  new(
    meta_id: meta[:id],
    creator: mosaic[:creator],
    description: mosaic[:description],
    id: id,
    properties: props,
    levy: levy
  )
end

Instance Method Details

#has_levy?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/nem/model/mosaic_definition.rb', line 50

def has_levy?
  ! @levy.empty?
end

#to_hashObject



54
55
56
57
58
59
60
61
62
# File 'lib/nem/model/mosaic_definition.rb', line 54

def to_hash
  {
    creator: creator,
    id: id.to_hash,
    description: description,
    properties: properties.to_hash,
    levy: levy.to_hash
  }
end