Class: Dependabot::Nuget::DependencyDetails

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, version:, type:, evaluation:, target_frameworks:, is_dev_dependency:, is_direct:, is_transitive:, is_override:, is_update:) ⇒ DependencyDetails

Returns a new instance of DependencyDetails.



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/dependabot/nuget/discovery/dependency_details.rb', line 50

def initialize(name:, version:, type:, evaluation:, target_frameworks:, is_dev_dependency:, is_direct:,
               is_transitive:, is_override:, is_update:)
  @name = name
  @version = version
  @type = type
  @evaluation = evaluation
  @target_frameworks = target_frameworks
  @is_dev_dependency = is_dev_dependency
  @is_direct = is_direct
  @is_transitive = is_transitive
  @is_override = is_override
  @is_update = is_update
end

Instance Attribute Details

#evaluationObject (readonly)

Returns the value of attribute evaluation.



74
75
76
# File 'lib/dependabot/nuget/discovery/dependency_details.rb', line 74

def evaluation
  @evaluation
end

#is_dev_dependencyObject (readonly)

Returns the value of attribute is_dev_dependency.



80
81
82
# File 'lib/dependabot/nuget/discovery/dependency_details.rb', line 80

def is_dev_dependency
  @is_dev_dependency
end

#is_directObject (readonly)

Returns the value of attribute is_direct.



83
84
85
# File 'lib/dependabot/nuget/discovery/dependency_details.rb', line 83

def is_direct
  @is_direct
end

#is_overrideObject (readonly)

Returns the value of attribute is_override.



89
90
91
# File 'lib/dependabot/nuget/discovery/dependency_details.rb', line 89

def is_override
  @is_override
end

#is_transitiveObject (readonly)

Returns the value of attribute is_transitive.



86
87
88
# File 'lib/dependabot/nuget/discovery/dependency_details.rb', line 86

def is_transitive
  @is_transitive
end

#is_updateObject (readonly)

Returns the value of attribute is_update.



92
93
94
# File 'lib/dependabot/nuget/discovery/dependency_details.rb', line 92

def is_update
  @is_update
end

#nameObject (readonly)

Returns the value of attribute name.



65
66
67
# File 'lib/dependabot/nuget/discovery/dependency_details.rb', line 65

def name
  @name
end

#target_frameworksObject (readonly)

Returns the value of attribute target_frameworks.



77
78
79
# File 'lib/dependabot/nuget/discovery/dependency_details.rb', line 77

def target_frameworks
  @target_frameworks
end

#typeObject (readonly)

Returns the value of attribute type.



71
72
73
# File 'lib/dependabot/nuget/discovery/dependency_details.rb', line 71

def type
  @type
end

#versionObject (readonly)

Returns the value of attribute version.



68
69
70
# File 'lib/dependabot/nuget/discovery/dependency_details.rb', line 68

def version
  @version
end

Class Method Details

.from_json(json) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/dependabot/nuget/discovery/dependency_details.rb', line 13

def self.from_json(json)
  name = T.let(json.fetch("Name"), String)
  version = T.let(json.fetch("Version"), T.nilable(String))
  type = T.let(json.fetch("Type"), String)
  evaluation = EvaluationDetails
               .from_json(T.let(json.fetch("EvaluationResult"), T.nilable(T::Hash[String, T.untyped])))
  target_frameworks = T.let(json.fetch("TargetFrameworks"), T.nilable(T::Array[String]))
  is_dev_dependency = T.let(json.fetch("IsDevDependency"), T::Boolean)
  is_direct = T.let(json.fetch("IsDirect"), T::Boolean)
  is_transitive = T.let(json.fetch("IsTransitive"), T::Boolean)
  is_override = T.let(json.fetch("IsOverride"), T::Boolean)
  is_update = T.let(json.fetch("IsUpdate"), T::Boolean)

  DependencyDetails.new(name: name,
                        version: version,
                        type: type,
                        evaluation: evaluation,
                        target_frameworks: target_frameworks,
                        is_dev_dependency: is_dev_dependency,
                        is_direct: is_direct,
                        is_transitive: is_transitive,
                        is_override: is_override,
                        is_update: is_update)
end