Class: Necropsy::RejectedTarget

Inherits:
Data
  • Object
show all
Defined in:
lib/necropsy/models.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(definition_id:, reason:, evidence_ids: []) ⇒ RejectedTarget

Returns a new instance of RejectedTarget.



133
134
135
136
137
138
# File 'lib/necropsy/models.rb', line 133

def initialize(definition_id:, reason:, evidence_ids: [])
  definition_id = ModelNormalization.identifier(definition_id, 'definition_id')
  reason = ModelNormalization.identifier(reason, 'reason')
  evidence_ids = ModelNormalization.string_list(evidence_ids, 'evidence_id')
  super
end

Instance Attribute Details

#definition_idObject (readonly)

Returns the value of attribute definition_id

Returns:

  • (Object)

    the current value of definition_id



132
133
134
# File 'lib/necropsy/models.rb', line 132

def definition_id
  @definition_id
end

#evidence_idsObject (readonly)

Returns the value of attribute evidence_ids

Returns:

  • (Object)

    the current value of evidence_ids



132
133
134
# File 'lib/necropsy/models.rb', line 132

def evidence_ids
  @evidence_ids
end

#reasonObject (readonly)

Returns the value of attribute reason

Returns:

  • (Object)

    the current value of reason



132
133
134
# File 'lib/necropsy/models.rb', line 132

def reason
  @reason
end

Class Method Details

.from_h(attributes) ⇒ Object



140
141
142
143
144
145
146
147
# File 'lib/necropsy/models.rb', line 140

def self.from_h(attributes)
  data = ModelNormalization.attributes(attributes, name)
  new(
    definition_id: data.fetch('definition_id'),
    reason: data.fetch('reason'),
    evidence_ids: data.fetch('evidence_ids', [])
  )
end

Instance Method Details

#to_hObject



149
150
151
152
153
154
155
# File 'lib/necropsy/models.rb', line 149

def to_h
  {
    'definition_id' => definition_id,
    'reason' => reason,
    'evidence_ids' => evidence_ids
  }
end