Class: Gusto::EntityErrorObject
- Inherits:
-
Object
- Object
- Gusto::EntityErrorObject
- Defined in:
- lib/fern_gusto/types/entity_error_object.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#category ⇒ Object
readonly
errors.
-
#error_key ⇒ Object
readonly
attribute/parameter related to the error.
-
#errors ⇒ Object
readonly
levels of nested errors.
-
#message ⇒ Object
readonly
end user.
-
#metadata ⇒ Object
readonly
example, to identify an entity ‘entity_type` and `entity_uuid` will be provided.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(error_key: OMIT, category: OMIT, message: OMIT, metadata: OMIT, errors: OMIT, additional_properties: nil) ⇒ Gusto::EntityErrorObject constructor
- #to_json ⇒ String
Constructor Details
#initialize(error_key: OMIT, category: OMIT, message: OMIT, metadata: OMIT, errors: OMIT, additional_properties: nil) ⇒ Gusto::EntityErrorObject
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/fern_gusto/types/entity_error_object.rb', line 47 def initialize(error_key: OMIT, category: OMIT, message: OMIT, metadata: OMIT, errors: OMIT, additional_properties: nil) @error_key = error_key if error_key != OMIT @category = category if category != OMIT @message = if != OMIT @metadata = if != OMIT @errors = errors if errors != OMIT @additional_properties = additional_properties @_field_set = { "error_key": error_key, "category": category, "message": , "metadata": , "errors": errors }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
26 27 28 |
# File 'lib/fern_gusto/types/entity_error_object.rb', line 26 def additional_properties @additional_properties end |
#category ⇒ Object (readonly)
errors.
15 16 17 |
# File 'lib/fern_gusto/types/entity_error_object.rb', line 15 def category @category end |
#error_key ⇒ Object (readonly)
attribute/parameter related to the error.
10 11 12 |
# File 'lib/fern_gusto/types/entity_error_object.rb', line 10 def error_key @error_key end |
#errors ⇒ Object (readonly)
levels of nested errors.
24 25 26 |
# File 'lib/fern_gusto/types/entity_error_object.rb', line 24 def errors @errors end |
#message ⇒ Object (readonly)
end user.
18 19 20 |
# File 'lib/fern_gusto/types/entity_error_object.rb', line 18 def @message end |
#metadata ⇒ Object (readonly)
example, to identify an entity ‘entity_type` and `entity_uuid` will be provided.
21 22 23 |
# File 'lib/fern_gusto/types/entity_error_object.rb', line 21 def @metadata end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::EntityErrorObject
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/fern_gusto/types/entity_error_object.rb', line 62 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) error_key = parsed_json["error_key"] category = parsed_json["category"] = parsed_json["message"] = parsed_json["metadata"] errors = parsed_json["errors"]&.map do | item | item = item.to_json Gusto::EntityErrorObjectErrorsItem.from_json(json_object: item) end new( error_key: error_key, category: category, message: , metadata: , errors: errors, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
94 95 96 97 98 99 100 |
# File 'lib/fern_gusto/types/entity_error_object.rb', line 94 def self.validate_raw(obj:) obj.error_key&.is_a?(String) != false || raise("Passed value for field obj.error_key is not the expected type, validation failed.") obj.category&.is_a?(String) != false || raise("Passed value for field obj.category 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.") obj.&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.") obj.errors&.is_a?(Array) != false || raise("Passed value for field obj.errors is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
85 86 87 |
# File 'lib/fern_gusto/types/entity_error_object.rb', line 85 def to_json @_field_set&.to_json end |