Class: Merge::Filestorage::FieldMappingApiInstance

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/filestorage/types/field_mapping_api_instance.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: OMIT, is_integration_wide: OMIT, target_field: OMIT, remote_field: OMIT, additional_properties: nil) ⇒ Merge::Filestorage::FieldMappingApiInstance

Parameters:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance.rb', line 33

def initialize(id: OMIT, is_integration_wide: OMIT, target_field: OMIT, remote_field: OMIT,
               additional_properties: nil)
  @id = id if id != OMIT
  @is_integration_wide = is_integration_wide if is_integration_wide != OMIT
  @target_field = target_field if target_field != OMIT
  @remote_field = remote_field if remote_field != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "id": id,
    "is_integration_wide": is_integration_wide,
    "target_field": target_field,
    "remote_field": remote_field
  }.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



20
21
22
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance.rb', line 20

def additional_properties
  @additional_properties
end

#idString (readonly)

Returns:

  • (String)


12
13
14
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance.rb', line 12

def id
  @id
end

#is_integration_wideBoolean (readonly)

Returns:

  • (Boolean)


14
15
16
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance.rb', line 14

def is_integration_wide
  @is_integration_wide
end

#remote_fieldMerge::Filestorage::FieldMappingApiInstanceRemoteField (readonly)



18
19
20
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance.rb', line 18

def remote_field
  @remote_field
end

#target_fieldMerge::Filestorage::FieldMappingApiInstanceTargetField (readonly)



16
17
18
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance.rb', line 16

def target_field
  @target_field
end

Class Method Details

.from_json(json_object:) ⇒ Merge::Filestorage::FieldMappingApiInstance

Deserialize a JSON object to an instance of FieldMappingApiInstance

Parameters:

  • json_object (String)

Returns:



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/filestorage/types/field_mapping_api_instance.rb', line 54

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  is_integration_wide = parsed_json["is_integration_wide"]
  if parsed_json["target_field"].nil?
    target_field = nil
  else
    target_field = parsed_json["target_field"].to_json
    target_field = Merge::Filestorage::FieldMappingApiInstanceTargetField.from_json(json_object: target_field)
  end
  if parsed_json["remote_field"].nil?
    remote_field = nil
  else
    remote_field = parsed_json["remote_field"].to_json
    remote_field = Merge::Filestorage::FieldMappingApiInstanceRemoteField.from_json(json_object: remote_field)
  end
  new(
    id: id,
    is_integration_wide: is_integration_wide,
    target_field: target_field,
    remote_field: remote_field,
    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/filestorage/types/field_mapping_api_instance.rb', line 93

def self.validate_raw(obj:)
  obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.is_integration_wide&.is_a?(Boolean) != false || raise("Passed value for field obj.is_integration_wide is not the expected type, validation failed.")
  obj.target_field.nil? || Merge::Filestorage::FieldMappingApiInstanceTargetField.validate_raw(obj: obj.target_field)
  obj.remote_field.nil? || Merge::Filestorage::FieldMappingApiInstanceRemoteField.validate_raw(obj: obj.remote_field)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of FieldMappingApiInstance to a JSON object

Returns:

  • (String)


83
84
85
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance.rb', line 83

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