Class: Tag
- Inherits:
-
Object
- Object
- Tag
- 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
-
#color ⇒ Object
Returns the value of attribute color.
-
#created ⇒ Object
Returns the value of attribute created.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#risk_modifier ⇒ Object
Returns the value of attribute risk_modifier.
-
#search_criteria ⇒ Object
Returns the value of attribute search_criteria.
-
#source ⇒ Object
Returns the value of attribute source.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, name:, color: 'default', created: nil, risk_modifier: nil, search_criteria: nil, source: 'custom', type: 'custom') ⇒ Tag
constructor
A new instance of Tag.
- #to_json(*_options) ⇒ Object
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
#color ⇒ Object
Returns the value of attribute color.
7 8 9 |
# File 'lib/domain/tag/model.rb', line 7 def color @color end |
#created ⇒ Object
Returns the value of attribute created.
7 8 9 |
# File 'lib/domain/tag/model.rb', line 7 def created @created end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/domain/tag/model.rb', line 7 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/domain/tag/model.rb', line 7 def name @name end |
#risk_modifier ⇒ Object
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_criteria ⇒ Object
Returns the value of attribute search_criteria.
7 8 9 |
# File 'lib/domain/tag/model.rb', line 7 def search_criteria @search_criteria end |
#source ⇒ Object
Returns the value of attribute source.
7 8 9 |
# File 'lib/domain/tag/model.rb', line 7 def source @source end |
#type ⇒ Object
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(*) { color:, created:, id:, name:, risk_modifier:, search_criteria:, type: } end |