Class: SemgrepWebApp::ListDependenciesRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/semgrep_web_app/models/list_dependencies_request.rb

Overview

ListDependenciesRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(deployment_id:, cursor: SKIP, dependency_filter: SKIP, page_size: SKIP, additional_properties: nil) ⇒ ListDependenciesRequest

Returns a new instance of ListDependenciesRequest.



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/semgrep_web_app/models/list_dependencies_request.rb', line 54

def initialize(deployment_id:, cursor: SKIP, dependency_filter: SKIP,
               page_size: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @cursor = cursor unless cursor == SKIP
  @dependency_filter = dependency_filter unless dependency_filter == SKIP
  @deployment_id = deployment_id
  @page_size = page_size unless page_size == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#cursorString

Cursor to paginate through the dependencies. Provide a cursor value from the response to retrieve the next page.

Returns:

  • (String)


15
16
17
# File 'lib/semgrep_web_app/models/list_dependencies_request.rb', line 15

def cursor
  @cursor
end

#dependency_filterProtosScaV1DependencyFilter

Object to provide dependency details to filter by.



19
20
21
# File 'lib/semgrep_web_app/models/list_dependencies_request.rb', line 19

def dependency_filter
  @dependency_filter
end

#deployment_idString

Deployment ID (numeric). Example: 123. Can be found at /deployments, or in your Settings in the web UI.

Returns:

  • (String)


24
25
26
# File 'lib/semgrep_web_app/models/list_dependencies_request.rb', line 24

def deployment_id
  @deployment_id
end

#page_sizeInteger

Number of dependencies per page. Default: 1000, min: 1, max: 10000.

Returns:

  • (Integer)


28
29
30
# File 'lib/semgrep_web_app/models/list_dependencies_request.rb', line 28

def page_size
  @page_size
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/semgrep_web_app/models/list_dependencies_request.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  deployment_id = hash.key?('deploymentId') ? hash['deploymentId'] : nil
  cursor = hash.key?('cursor') ? hash['cursor'] : SKIP
  dependency_filter = ProtosScaV1DependencyFilter.from_hash(hash['dependencyFilter']) if
    hash['dependencyFilter']
  page_size = hash.key?('pageSize') ? hash['pageSize'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  ListDependenciesRequest.new(deployment_id: deployment_id,
                              cursor: cursor,
                              dependency_filter: dependency_filter,
                              page_size: page_size,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



31
32
33
34
35
36
37
38
# File 'lib/semgrep_web_app/models/list_dependencies_request.rb', line 31

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['cursor'] = 'cursor'
  @_hash['dependency_filter'] = 'dependencyFilter'
  @_hash['deployment_id'] = 'deploymentId'
  @_hash['page_size'] = 'pageSize'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/semgrep_web_app/models/list_dependencies_request.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



41
42
43
44
45
46
47
# File 'lib/semgrep_web_app/models/list_dependencies_request.rb', line 41

def self.optionals
  %w[
    cursor
    dependency_filter
    page_size
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



101
102
103
104
105
106
# File 'lib/semgrep_web_app/models/list_dependencies_request.rb', line 101

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} cursor: #{@cursor.inspect}, dependency_filter:"\
  " #{@dependency_filter.inspect}, deployment_id: #{@deployment_id.inspect}, page_size:"\
  " #{@page_size.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



93
94
95
96
97
98
# File 'lib/semgrep_web_app/models/list_dependencies_request.rb', line 93

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} cursor: #{@cursor}, dependency_filter: #{@dependency_filter},"\
  " deployment_id: #{@deployment_id}, page_size: #{@page_size}, additional_properties:"\
  " #{@additional_properties}>"
end