Class: SemgrepWebApp::ProtosAiV1AutotriageFeedback

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

Overview

ProtosAiV1AutotriageFeedback 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(autotriage_id: SKIP, note: SKIP, rating: SKIP, additional_properties: nil) ⇒ ProtosAiV1AutotriageFeedback

Returns a new instance of ProtosAiV1AutotriageFeedback.



50
51
52
53
54
55
56
57
58
59
# File 'lib/semgrep_web_app/models/protos_ai_v1_autotriage_feedback.rb', line 50

def initialize(autotriage_id: SKIP, note: SKIP, rating: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @autotriage_id = autotriage_id unless autotriage_id == SKIP
  @note = note unless note == SKIP
  @rating = rating unless rating == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#autotriage_idString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/semgrep_web_app/models/protos_ai_v1_autotriage_feedback.rb', line 14

def autotriage_id
  @autotriage_id
end

#noteString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/semgrep_web_app/models/protos_ai_v1_autotriage_feedback.rb', line 18

def note
  @note
end

#ratingRating

value description
RATING_GOOD Autotriage rated positively by a user.
RATING_BAD Autotriage rated negatively by a user.

Returns:



25
26
27
# File 'lib/semgrep_web_app/models/protos_ai_v1_autotriage_feedback.rb', line 25

def rating
  @rating
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/semgrep_web_app/models/protos_ai_v1_autotriage_feedback.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  autotriage_id = hash.key?('autotriageId') ? hash['autotriageId'] : SKIP
  note = hash.key?('note') ? hash['note'] : SKIP
  rating = hash.key?('rating') ? hash['rating'] : 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.
  ProtosAiV1AutotriageFeedback.new(autotriage_id: autotriage_id,
                                   note: note,
                                   rating: rating,
                                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



28
29
30
31
32
33
34
# File 'lib/semgrep_web_app/models/protos_ai_v1_autotriage_feedback.rb', line 28

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['autotriage_id'] = 'autotriageId'
  @_hash['note'] = 'note'
  @_hash['rating'] = 'rating'
  @_hash
end

.nullablesObject

An array for nullable fields



46
47
48
# File 'lib/semgrep_web_app/models/protos_ai_v1_autotriage_feedback.rb', line 46

def self.nullables
  []
end

.optionalsObject

An array for optional fields



37
38
39
40
41
42
43
# File 'lib/semgrep_web_app/models/protos_ai_v1_autotriage_feedback.rb', line 37

def self.optionals
  %w[
    autotriage_id
    note
    rating
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



92
93
94
95
96
# File 'lib/semgrep_web_app/models/protos_ai_v1_autotriage_feedback.rb', line 92

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} autotriage_id: #{@autotriage_id.inspect}, note: #{@note.inspect}, rating:"\
  " #{@rating.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



85
86
87
88
89
# File 'lib/semgrep_web_app/models/protos_ai_v1_autotriage_feedback.rb', line 85

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} autotriage_id: #{@autotriage_id}, note: #{@note}, rating: #{@rating},"\
  " additional_properties: #{@additional_properties}>"
end