Class: Merge::Filestorage::FieldMappingApiInstanceRemoteField

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(remote_key_name:, schema:, remote_endpoint_info:, additional_properties: nil) ⇒ Merge::Filestorage::FieldMappingApiInstanceRemoteField

Parameters:



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance_remote_field.rb', line 29

def initialize(remote_key_name:, schema:, remote_endpoint_info:, additional_properties: nil)
  @remote_key_name = remote_key_name
  @schema = schema
  @remote_endpoint_info = remote_endpoint_info
  @additional_properties = additional_properties
  @_field_set = {
    "remote_key_name": remote_key_name,
    "schema": schema,
    "remote_endpoint_info": remote_endpoint_info
  }
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



17
18
19
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance_remote_field.rb', line 17

def additional_properties
  @additional_properties
end

#remote_endpoint_infoMerge::Filestorage::FieldMappingApiInstanceRemoteFieldRemoteEndpointInfo (readonly)



15
16
17
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance_remote_field.rb', line 15

def remote_endpoint_info
  @remote_endpoint_info
end

#remote_key_nameString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance_remote_field.rb', line 11

def remote_key_name
  @remote_key_name
end

#schemaHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


13
14
15
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance_remote_field.rb', line 13

def schema
  @schema
end

Class Method Details

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

Deserialize a JSON object to an instance of FieldMappingApiInstanceRemoteField

Parameters:

  • json_object (String)

Returns:



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance_remote_field.rb', line 45

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  remote_key_name = parsed_json["remote_key_name"]
  schema = parsed_json["schema"]
  if parsed_json["remote_endpoint_info"].nil?
    remote_endpoint_info = nil
  else
    remote_endpoint_info = parsed_json["remote_endpoint_info"].to_json
    remote_endpoint_info = Merge::Filestorage::FieldMappingApiInstanceRemoteFieldRemoteEndpointInfo.from_json(json_object: remote_endpoint_info)
  end
  new(
    remote_key_name: remote_key_name,
    schema: schema,
    remote_endpoint_info: remote_endpoint_info,
    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)


77
78
79
80
81
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance_remote_field.rb', line 77

def self.validate_raw(obj:)
  obj.remote_key_name.is_a?(String) != false || raise("Passed value for field obj.remote_key_name is not the expected type, validation failed.")
  obj.schema.is_a?(Hash) != false || raise("Passed value for field obj.schema is not the expected type, validation failed.")
  Merge::Filestorage::FieldMappingApiInstanceRemoteFieldRemoteEndpointInfo.validate_raw(obj: obj.remote_endpoint_info)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of FieldMappingApiInstanceRemoteField to a JSON object

Returns:

  • (String)


67
68
69
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance_remote_field.rb', line 67

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