Class: Merge::Hris::TimeOffResponse
- Inherits:
-
Object
- Object
- Merge::Hris::TimeOffResponse
- Defined in:
- lib/merge_ruby_client/hris/types/time_off_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #errors ⇒ Array<Merge::Hris::ErrorValidationProblem> readonly
- #logs ⇒ Array<Merge::Hris::DebugModeLog> readonly
- #model ⇒ Merge::Hris::TimeOff readonly
- #warnings ⇒ Array<Merge::Hris::WarningValidationProblem> readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Hris::TimeOffResponse
Deserialize a JSON object to an instance of TimeOffResponse.
-
.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(model:, warnings:, errors:, logs: OMIT, additional_properties: nil) ⇒ Merge::Hris::TimeOffResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of TimeOffResponse to a JSON object.
Constructor Details
#initialize(model:, warnings:, errors:, logs: OMIT, additional_properties: nil) ⇒ Merge::Hris::TimeOffResponse
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/merge_ruby_client/hris/types/time_off_response.rb', line 35 def initialize(model:, warnings:, errors:, logs: OMIT, additional_properties: nil) @model = model @warnings = warnings @errors = errors @logs = logs if logs != OMIT @additional_properties = additional_properties @_field_set = { "model": model, "warnings": warnings, "errors": errors, "logs": logs }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
22 23 24 |
# File 'lib/merge_ruby_client/hris/types/time_off_response.rb', line 22 def additional_properties @additional_properties end |
#errors ⇒ Array<Merge::Hris::ErrorValidationProblem> (readonly)
18 19 20 |
# File 'lib/merge_ruby_client/hris/types/time_off_response.rb', line 18 def errors @errors end |
#logs ⇒ Array<Merge::Hris::DebugModeLog> (readonly)
20 21 22 |
# File 'lib/merge_ruby_client/hris/types/time_off_response.rb', line 20 def logs @logs end |
#model ⇒ Merge::Hris::TimeOff (readonly)
14 15 16 |
# File 'lib/merge_ruby_client/hris/types/time_off_response.rb', line 14 def model @model end |
#warnings ⇒ Array<Merge::Hris::WarningValidationProblem> (readonly)
16 17 18 |
# File 'lib/merge_ruby_client/hris/types/time_off_response.rb', line 16 def warnings @warnings end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Hris::TimeOffResponse
Deserialize a JSON object to an instance of TimeOffResponse
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/merge_ruby_client/hris/types/time_off_response.rb', line 50 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["model"].nil? model = nil else model = parsed_json["model"].to_json model = Merge::Hris::TimeOff.from_json(json_object: model) end warnings = parsed_json["warnings"]&.map do |item| item = item.to_json Merge::Hris::WarningValidationProblem.from_json(json_object: item) end errors = parsed_json["errors"]&.map do |item| item = item.to_json Merge::Hris::ErrorValidationProblem.from_json(json_object: item) end logs = parsed_json["logs"]&.map do |item| item = item.to_json Merge::Hris::DebugModeLog.from_json(json_object: item) end new( model: model, warnings: warnings, errors: errors, logs: logs, 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.
93 94 95 96 97 98 |
# File 'lib/merge_ruby_client/hris/types/time_off_response.rb', line 93 def self.validate_raw(obj:) Merge::Hris::TimeOff.validate_raw(obj: obj.model) obj.warnings.is_a?(Array) != false || raise("Passed value for field obj.warnings 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.") obj.logs&.is_a?(Array) != false || raise("Passed value for field obj.logs is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of TimeOffResponse to a JSON object
83 84 85 |
# File 'lib/merge_ruby_client/hris/types/time_off_response.rb', line 83 def to_json(*_args) @_field_set&.to_json end |