Class: ApiReference::RequestValidationError
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::RequestValidationError
- Defined in:
- lib/api_reference/models/request_validation_error.rb
Overview
RequestValidationError Model.
Instance Attribute Summary collapse
-
#detail ⇒ String
TODO: Write general description for this method.
-
#status ⇒ Integer
readonly
TODO: Write general description for this method.
-
#title ⇒ String
TODO: Write general description for this method.
-
#type ⇒ String
readonly
TODO: Write general description for this method.
-
#validation_errors ⇒ Array[Object]
TODO: Write general description for this method.
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(validation_errors:, detail: SKIP, title: SKIP, additional_properties: nil) ⇒ RequestValidationError
constructor
A new instance of RequestValidationError.
-
#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(validation_errors:, detail: SKIP, title: SKIP, additional_properties: nil) ⇒ RequestValidationError
Returns a new instance of RequestValidationError.
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/api_reference/models/request_validation_error.rb', line 59 def initialize(validation_errors:, detail: SKIP, title: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @type = 'https://docs.withorb.com/reference/error-responses#400-request-validation-errors' @status = 400 @detail = detail unless detail == SKIP @title = title unless title == SKIP @validation_errors = validation_errors @additional_properties = additional_properties end |
Instance Attribute Details
#detail ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/api_reference/models/request_validation_error.rb', line 22 def detail @detail end |
#status ⇒ Integer (readonly)
TODO: Write general description for this method
18 19 20 |
# File 'lib/api_reference/models/request_validation_error.rb', line 18 def status @status end |
#title ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/api_reference/models/request_validation_error.rb', line 26 def title @title end |
#type ⇒ String (readonly)
TODO: Write general description for this method
14 15 16 |
# File 'lib/api_reference/models/request_validation_error.rb', line 14 def type @type end |
#validation_errors ⇒ Array[Object]
TODO: Write general description for this method
30 31 32 |
# File 'lib/api_reference/models/request_validation_error.rb', line 30 def validation_errors @validation_errors end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/api_reference/models/request_validation_error.rb', line 73 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. validation_errors = hash.key?('validation_errors') ? hash['validation_errors'] : nil detail = hash.key?('detail') ? hash['detail'] : SKIP title = hash.key?('title') ? hash['title'] : 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. RequestValidationError.new(validation_errors: validation_errors, detail: detail, title: title, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/api_reference/models/request_validation_error.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['type'] = 'type' @_hash['status'] = 'status' @_hash['detail'] = 'detail' @_hash['title'] = 'title' @_hash['validation_errors'] = 'validation_errors' @_hash end |
.nullables ⇒ Object
An array for nullable fields
52 53 54 55 56 57 |
# File 'lib/api_reference/models/request_validation_error.rb', line 52 def self.nullables %w[ detail title ] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 |
# File 'lib/api_reference/models/request_validation_error.rb', line 44 def self.optionals %w[ detail title ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
105 106 107 108 109 110 |
# File 'lib/api_reference/models/request_validation_error.rb', line 105 def inspect class_name = self.class.name.split('::').last "<#{class_name} type: #{@type.inspect}, status: #{@status.inspect}, detail:"\ " #{@detail.inspect}, title: #{@title.inspect}, validation_errors:"\ " #{@validation_errors.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
97 98 99 100 101 102 |
# File 'lib/api_reference/models/request_validation_error.rb', line 97 def to_s class_name = self.class.name.split('::').last "<#{class_name} type: #{@type}, status: #{@status}, detail: #{@detail}, title: #{@title},"\ " validation_errors: #{@validation_errors}, additional_properties:"\ " #{@additional_properties}>" end |