Class: Paid::ApiError
- Inherits:
-
Object
- Object
- Paid::ApiError
- Defined in:
- lib/paid_ruby/types/api_error.rb
Overview
An API error response from the Paid API
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
- #details ⇒ String readonly
-
#message ⇒ String
readonly
A human-readable message providing more details about the error.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(message: OMIT, code: OMIT, details: OMIT, additional_properties: nil) ⇒ Paid::ApiError constructor
- #to_json ⇒ String
Constructor Details
#initialize(message: OMIT, code: OMIT, details: OMIT, additional_properties: nil) ⇒ Paid::ApiError
27 28 29 30 31 32 33 34 35 |
# File 'lib/paid_ruby/types/api_error.rb', line 27 def initialize(message: OMIT, code: OMIT, details: OMIT, additional_properties: nil) @message = if != OMIT @code = code if code != OMIT @details = details if details != OMIT @additional_properties = additional_properties @_field_set = { "message": , "code": code, "details": details }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
15 16 17 |
# File 'lib/paid_ruby/types/api_error.rb', line 15 def additional_properties @additional_properties end |
#code ⇒ String (readonly)
11 12 13 |
# File 'lib/paid_ruby/types/api_error.rb', line 11 def code @code end |
#details ⇒ String (readonly)
13 14 15 |
# File 'lib/paid_ruby/types/api_error.rb', line 13 def details @details end |
#message ⇒ String (readonly)
Returns A human-readable message providing more details about the error.
9 10 11 |
# File 'lib/paid_ruby/types/api_error.rb', line 9 def @message end |
Class Method Details
.from_json(json_object:) ⇒ Paid::ApiError
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/paid_ruby/types/api_error.rb', line 40 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) = parsed_json["message"] code = parsed_json["code"] details = parsed_json["details"] new( message: , code: code, details: details, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
65 66 67 68 69 |
# File 'lib/paid_ruby/types/api_error.rb', line 65 def self.validate_raw(obj:) obj.&.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.") obj.code&.is_a?(String) != false || raise("Passed value for field obj.code is not the expected type, validation failed.") obj.details&.is_a?(String) != false || raise("Passed value for field obj.details is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
56 57 58 |
# File 'lib/paid_ruby/types/api_error.rb', line 56 def to_json @_field_set&.to_json end |