Class: Dependabot::Nuget::EvaluationDetails

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/nuget/discovery/evaluation_details.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result_type:, original_value:, evaluated_value:, root_property_name:, error_message:) ⇒ EvaluationDetails

Returns a new instance of EvaluationDetails.



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/dependabot/nuget/discovery/evaluation_details.rb', line 35

def initialize(result_type:,
               original_value:,
               evaluated_value:,
               root_property_name:,
               error_message:)
  @result_type = result_type
  @original_value = original_value
  @evaluated_value = evaluated_value
  @root_property_name = root_property_name
  @error_message = error_message
end

Instance Attribute Details

#error_messageObject (readonly)

Returns the value of attribute error_message.



60
61
62
# File 'lib/dependabot/nuget/discovery/evaluation_details.rb', line 60

def error_message
  @error_message
end

#evaluated_valueObject (readonly)

Returns the value of attribute evaluated_value.



54
55
56
# File 'lib/dependabot/nuget/discovery/evaluation_details.rb', line 54

def evaluated_value
  @evaluated_value
end

#original_valueObject (readonly)

Returns the value of attribute original_value.



51
52
53
# File 'lib/dependabot/nuget/discovery/evaluation_details.rb', line 51

def original_value
  @original_value
end

#result_typeObject (readonly)

Returns the value of attribute result_type.



48
49
50
# File 'lib/dependabot/nuget/discovery/evaluation_details.rb', line 48

def result_type
  @result_type
end

#root_property_nameObject (readonly)

Returns the value of attribute root_property_name.



57
58
59
# File 'lib/dependabot/nuget/discovery/evaluation_details.rb', line 57

def root_property_name
  @root_property_name
end

Class Method Details

.from_json(json) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/dependabot/nuget/discovery/evaluation_details.rb', line 12

def self.from_json(json)
  return nil if json.nil?

  result_type = T.let(json.fetch("ResultType"), String)
  original_value = T.let(json.fetch("OriginalValue"), String)
  evaluated_value = T.let(json.fetch("EvaluatedValue"), String)
  root_property_name = T.let(json.fetch("RootPropertyName", nil), T.nilable(String))
  error_message = T.let(json.fetch("ErrorMessage", nil), T.nilable(String))

  EvaluationDetails.new(result_type: result_type,
                        original_value: original_value,
                        evaluated_value: evaluated_value,
                        root_property_name: root_property_name,
                        error_message: error_message)
end