Class: Merge::Crm::FieldMappingInstanceResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/crm/types/field_mapping_instance_response.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model:, warnings:, errors:, logs: OMIT, additional_properties: nil) ⇒ Merge::Crm::FieldMappingInstanceResponse

Parameters:



35
36
37
38
39
40
41
42
43
44
# File 'lib/merge_ruby_client/crm/types/field_mapping_instance_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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



22
23
24
# File 'lib/merge_ruby_client/crm/types/field_mapping_instance_response.rb', line 22

def additional_properties
  @additional_properties
end

#errorsArray<Merge::Crm::ErrorValidationProblem> (readonly)



18
19
20
# File 'lib/merge_ruby_client/crm/types/field_mapping_instance_response.rb', line 18

def errors
  @errors
end

#logsArray<Merge::Crm::DebugModeLog> (readonly)

Returns:



20
21
22
# File 'lib/merge_ruby_client/crm/types/field_mapping_instance_response.rb', line 20

def logs
  @logs
end

#modelMerge::Crm::FieldMappingApiInstance (readonly)



14
15
16
# File 'lib/merge_ruby_client/crm/types/field_mapping_instance_response.rb', line 14

def model
  @model
end

#warningsArray<Merge::Crm::WarningValidationProblem> (readonly)



16
17
18
# File 'lib/merge_ruby_client/crm/types/field_mapping_instance_response.rb', line 16

def warnings
  @warnings
end

Class Method Details

.from_json(json_object:) ⇒ Merge::Crm::FieldMappingInstanceResponse

Deserialize a JSON object to an instance of FieldMappingInstanceResponse

Parameters:

  • json_object (String)

Returns:



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/crm/types/field_mapping_instance_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::Crm::FieldMappingApiInstance.from_json(json_object: model)
  end
  warnings = parsed_json["warnings"]&.map do |item|
    item = item.to_json
    Merge::Crm::WarningValidationProblem.from_json(json_object: item)
  end
  errors = parsed_json["errors"]&.map do |item|
    item = item.to_json
    Merge::Crm::ErrorValidationProblem.from_json(json_object: item)
  end
  logs = parsed_json["logs"]&.map do |item|
    item = item.to_json
    Merge::Crm::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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


93
94
95
96
97
98
# File 'lib/merge_ruby_client/crm/types/field_mapping_instance_response.rb', line 93

def self.validate_raw(obj:)
  Merge::Crm::FieldMappingApiInstance.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 FieldMappingInstanceResponse to a JSON object

Returns:

  • (String)


83
84
85
# File 'lib/merge_ruby_client/crm/types/field_mapping_instance_response.rb', line 83

def to_json(*_args)
  @_field_set&.to_json
end