Class: Pinnacle::BadRequestErrorBodyError
- Inherits:
-
Object
- Object
- Pinnacle::BadRequestErrorBodyError
- Defined in:
- lib/rcs/types/bad_request_error_body_error.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #code ⇒ String readonly
- #expected ⇒ String readonly
- #message ⇒ String readonly
- #path ⇒ Array<String> readonly
- #received ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Pinnacle::BadRequestErrorBodyError
Deserialize a JSON object to an instance of BadRequestErrorBodyError.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(code: OMIT, expected: OMIT, received: OMIT, path: OMIT, message: OMIT, additional_properties: nil) ⇒ Pinnacle::BadRequestErrorBodyError constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of BadRequestErrorBodyError to a JSON object.
Constructor Details
#initialize(code: OMIT, expected: OMIT, received: OMIT, path: OMIT, message: OMIT, additional_properties: nil) ⇒ Pinnacle::BadRequestErrorBodyError
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rcs/types/bad_request_error_body_error.rb', line 33 def initialize(code: OMIT, expected: OMIT, received: OMIT, path: OMIT, message: OMIT, additional_properties: nil) @code = code if code != OMIT @expected = expected if expected != OMIT @received = received if received != OMIT @path = path if path != OMIT @message = if != OMIT @additional_properties = additional_properties @_field_set = { "code": code, "expected": expected, "received": received, "path": path, "message": }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
19 20 21 |
# File 'lib/rcs/types/bad_request_error_body_error.rb', line 19 def additional_properties @additional_properties end |
#code ⇒ String (readonly)
9 10 11 |
# File 'lib/rcs/types/bad_request_error_body_error.rb', line 9 def code @code end |
#expected ⇒ String (readonly)
11 12 13 |
# File 'lib/rcs/types/bad_request_error_body_error.rb', line 11 def expected @expected end |
#message ⇒ String (readonly)
17 18 19 |
# File 'lib/rcs/types/bad_request_error_body_error.rb', line 17 def @message end |
#path ⇒ Array<String> (readonly)
15 16 17 |
# File 'lib/rcs/types/bad_request_error_body_error.rb', line 15 def path @path end |
#received ⇒ String (readonly)
13 14 15 |
# File 'lib/rcs/types/bad_request_error_body_error.rb', line 13 def received @received end |
Class Method Details
.from_json(json_object:) ⇒ Pinnacle::BadRequestErrorBodyError
Deserialize a JSON object to an instance of BadRequestErrorBodyError
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/rcs/types/bad_request_error_body_error.rb', line 55 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) code = parsed_json["code"] expected = parsed_json["expected"] received = parsed_json["received"] path = parsed_json["path"] = parsed_json["message"] new( code: code, expected: expected, received: received, path: path, message: , additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
86 87 88 89 90 91 92 |
# File 'lib/rcs/types/bad_request_error_body_error.rb', line 86 def self.validate_raw(obj:) obj.code&.is_a?(String) != false || raise("Passed value for field obj.code is not the expected type, validation failed.") obj.expected&.is_a?(String) != false || raise("Passed value for field obj.expected is not the expected type, validation failed.") obj.received&.is_a?(String) != false || raise("Passed value for field obj.received is not the expected type, validation failed.") obj.path&.is_a?(Array) != false || raise("Passed value for field obj.path is not the expected type, validation failed.") obj.&.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of BadRequestErrorBodyError to a JSON object
76 77 78 |
# File 'lib/rcs/types/bad_request_error_body_error.rb', line 76 def to_json(*_args) @_field_set&.to_json end |