Class: WalmartApIs::Issue
- Defined in:
- lib/walmart_ap_is/models/issue.rb
Overview
Issue Model.
Instance Attribute Summary collapse
-
#attribute_names ⇒ Array[String]
Affected attribute names.
-
#code ⇒ String
Machine-readable issue code.
-
#message ⇒ String
Human-readable issue message (locale-aware).
-
#severity ⇒ Severity
Human-readable issue message (locale-aware).
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(code:, message:, severity:, attribute_names: SKIP, additional_properties: nil) ⇒ Issue
constructor
A new instance of Issue.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(code:, message:, severity:, attribute_names: SKIP, additional_properties: nil) ⇒ Issue
Returns a new instance of Issue.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/walmart_ap_is/models/issue.rb', line 50 def initialize(code:, message:, severity:, attribute_names: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @code = code @message = @severity = severity @attribute_names = attribute_names unless attribute_names == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#attribute_names ⇒ Array[String]
Affected attribute names
26 27 28 |
# File 'lib/walmart_ap_is/models/issue.rb', line 26 def attribute_names @attribute_names end |
#code ⇒ String
Machine-readable issue code
14 15 16 |
# File 'lib/walmart_ap_is/models/issue.rb', line 14 def code @code end |
#message ⇒ String
Human-readable issue message (locale-aware)
18 19 20 |
# File 'lib/walmart_ap_is/models/issue.rb', line 18 def @message end |
#severity ⇒ Severity
Human-readable issue message (locale-aware)
22 23 24 |
# File 'lib/walmart_ap_is/models/issue.rb', line 22 def severity @severity end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/walmart_ap_is/models/issue.rb', line 63 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. code = hash.key?('code') ? hash['code'] : nil = hash.key?('message') ? hash['message'] : nil severity = hash.key?('severity') ? hash['severity'] : nil attribute_names = hash.key?('attributeNames') ? hash['attributeNames'] : 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. Issue.new(code: code, message: , severity: severity, attribute_names: attribute_names, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 |
# File 'lib/walmart_ap_is/models/issue.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['code'] = 'code' @_hash['message'] = 'message' @_hash['severity'] = 'severity' @_hash['attribute_names'] = 'attributeNames' @_hash end |
.nullables ⇒ Object
An array for nullable fields
46 47 48 |
# File 'lib/walmart_ap_is/models/issue.rb', line 46 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 |
# File 'lib/walmart_ap_is/models/issue.rb', line 39 def self.optionals %w[ attribute_names ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
96 97 98 99 100 101 |
# File 'lib/walmart_ap_is/models/issue.rb', line 96 def inspect class_name = self.class.name.split('::').last "<#{class_name} code: #{@code.inspect}, message: #{@message.inspect}, severity:"\ " #{@severity.inspect}, attribute_names: #{@attribute_names.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
89 90 91 92 93 |
# File 'lib/walmart_ap_is/models/issue.rb', line 89 def to_s class_name = self.class.name.split('::').last "<#{class_name} code: #{@code}, message: #{@message}, severity: #{@severity},"\ " attribute_names: #{@attribute_names}, additional_properties: #{@additional_properties}>" end |