Class: Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/domain/tag/model.rb

Overview

color can be ‘default’, ‘blue’, ‘green’, ‘orange’, ‘red’, ‘purple’ type can be location, owner, criticality, custom source can built-in, custom

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name:, color: 'default', created: nil, risk_modifier: nil, search_criteria: nil, source: 'custom', type: 'custom') ⇒ Tag

Returns a new instance of Tag.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/domain/tag/model.rb', line 16

def initialize(
  id:,
  name:,
  color: 'default',
  created: nil,
  risk_modifier: nil,
  search_criteria: nil,
  source: 'custom',
  type: 'custom'
)
  @id = id
  @name = name
  @color = color
  @source = source
  @created = created
  @type = type
  @risk_modifier = risk_modifier
  @search_criteria = search_criteria
end

Instance Attribute Details

#colorObject

Returns the value of attribute color.



7
8
9
# File 'lib/domain/tag/model.rb', line 7

def color
  @color
end

#createdObject

Returns the value of attribute created.



7
8
9
# File 'lib/domain/tag/model.rb', line 7

def created
  @created
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/domain/tag/model.rb', line 7

def id
  @id
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/domain/tag/model.rb', line 7

def name
  @name
end

#risk_modifierObject

Returns the value of attribute risk_modifier.



7
8
9
# File 'lib/domain/tag/model.rb', line 7

def risk_modifier
  @risk_modifier
end

#search_criteriaObject

Returns the value of attribute search_criteria.



7
8
9
# File 'lib/domain/tag/model.rb', line 7

def search_criteria
  @search_criteria
end

#sourceObject

Returns the value of attribute source.



7
8
9
# File 'lib/domain/tag/model.rb', line 7

def source
  @source
end

#typeObject

Returns the value of attribute type.



7
8
9
# File 'lib/domain/tag/model.rb', line 7

def type
  @type
end

Class Method Details

.from_json(data) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/domain/tag/model.rb', line 36

def self.from_json(data)
  Tag.new(
    color: data['color'],
    created: data['created'],
    id: data['id'],
    name: data['name'],
    risk_modifier: data['riskModifier'],
    search_criteria: data['searchCriteria'],
    type: data['type']
  )
end

Instance Method Details

#to_json(*_options) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/domain/tag/model.rb', line 48

def to_json(*_options)
  {
    color:,
    created:,
    id:,
    name:,
    risk_modifier:,
    search_criteria:,
    type:
  }
end