Class: Merge::Filestorage::ErrorValidationProblem
- Inherits:
-
Object
- Object
- Merge::Filestorage::ErrorValidationProblem
- Defined in:
- lib/merge_ruby_client/filestorage/types/error_validation_problem.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #detail ⇒ String readonly
- #problem_type ⇒ String readonly
- #source ⇒ Merge::Filestorage::ValidationProblemSource readonly
- #title ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Filestorage::ErrorValidationProblem
Deserialize a JSON object to an instance of ErrorValidationProblem.
-
.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(title:, detail:, problem_type:, source: OMIT, additional_properties: nil) ⇒ Merge::Filestorage::ErrorValidationProblem constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ErrorValidationProblem to a JSON object.
Constructor Details
#initialize(title:, detail:, problem_type:, source: OMIT, additional_properties: nil) ⇒ Merge::Filestorage::ErrorValidationProblem
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/merge_ruby_client/filestorage/types/error_validation_problem.rb', line 32 def initialize(title:, detail:, problem_type:, source: OMIT, additional_properties: nil) @source = source if source != OMIT @title = title @detail = detail @problem_type = problem_type @additional_properties = additional_properties @_field_set = { "source": source, "title": title, "detail": detail, "problem_type": problem_type }.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/merge_ruby_client/filestorage/types/error_validation_problem.rb', line 19 def additional_properties @additional_properties end |
#detail ⇒ String (readonly)
15 16 17 |
# File 'lib/merge_ruby_client/filestorage/types/error_validation_problem.rb', line 15 def detail @detail end |
#problem_type ⇒ String (readonly)
17 18 19 |
# File 'lib/merge_ruby_client/filestorage/types/error_validation_problem.rb', line 17 def problem_type @problem_type end |
#source ⇒ Merge::Filestorage::ValidationProblemSource (readonly)
11 12 13 |
# File 'lib/merge_ruby_client/filestorage/types/error_validation_problem.rb', line 11 def source @source end |
#title ⇒ String (readonly)
13 14 15 |
# File 'lib/merge_ruby_client/filestorage/types/error_validation_problem.rb', line 13 def title @title end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Filestorage::ErrorValidationProblem
Deserialize a JSON object to an instance of ErrorValidationProblem
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/merge_ruby_client/filestorage/types/error_validation_problem.rb', line 52 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["source"].nil? source = nil else source = parsed_json["source"].to_json source = Merge::Filestorage::ValidationProblemSource.from_json(json_object: source) end title = parsed_json["title"] detail = parsed_json["detail"] problem_type = parsed_json["problem_type"] new( source: source, title: title, detail: detail, problem_type: problem_type, 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 |
# File 'lib/merge_ruby_client/filestorage/types/error_validation_problem.rb', line 86 def self.validate_raw(obj:) obj.source.nil? || Merge::Filestorage::ValidationProblemSource.validate_raw(obj: obj.source) obj.title.is_a?(String) != false || raise("Passed value for field obj.title is not the expected type, validation failed.") obj.detail.is_a?(String) != false || raise("Passed value for field obj.detail is not the expected type, validation failed.") obj.problem_type.is_a?(String) != false || raise("Passed value for field obj.problem_type is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ErrorValidationProblem to a JSON object
76 77 78 |
# File 'lib/merge_ruby_client/filestorage/types/error_validation_problem.rb', line 76 def to_json(*_args) @_field_set&.to_json end |