Class: Merge::Filestorage::FieldMappingApiInstanceResponse

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file: OMIT, folder: OMIT, drive: OMIT, group: OMIT, user: OMIT, additional_properties: nil) ⇒ Merge::Filestorage::FieldMappingApiInstanceResponse

Parameters:



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance_response.rb', line 35

def initialize(file: OMIT, folder: OMIT, drive: OMIT, group: OMIT, user: OMIT, additional_properties: nil)
  @file = file if file != OMIT
  @folder = folder if folder != OMIT
  @drive = drive if drive != OMIT
  @group = group if group != OMIT
  @user = user if user != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "File": file,
    "Folder": folder,
    "Drive": drive,
    "Group": group,
    "User": user
  }.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



21
22
23
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance_response.rb', line 21

def additional_properties
  @additional_properties
end

#driveArray<Merge::Filestorage::FieldMappingApiInstance> (readonly)



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

def drive
  @drive
end

#fileArray<Merge::Filestorage::FieldMappingApiInstance> (readonly)



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

def file
  @file
end

#folderArray<Merge::Filestorage::FieldMappingApiInstance> (readonly)



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

def folder
  @folder
end

#groupArray<Merge::Filestorage::FieldMappingApiInstance> (readonly)



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

def group
  @group
end

#userArray<Merge::Filestorage::FieldMappingApiInstance> (readonly)



19
20
21
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance_response.rb', line 19

def user
  @user
end

Class Method Details

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

Deserialize a JSON object to an instance of FieldMappingApiInstanceResponse

Parameters:

  • json_object (String)

Returns:



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance_response.rb', line 57

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  file = parsed_json["File"]&.map do |item|
    item = item.to_json
    Merge::Filestorage::FieldMappingApiInstance.from_json(json_object: item)
  end
  folder = parsed_json["Folder"]&.map do |item|
    item = item.to_json
    Merge::Filestorage::FieldMappingApiInstance.from_json(json_object: item)
  end
  drive = parsed_json["Drive"]&.map do |item|
    item = item.to_json
    Merge::Filestorage::FieldMappingApiInstance.from_json(json_object: item)
  end
  group = parsed_json["Group"]&.map do |item|
    item = item.to_json
    Merge::Filestorage::FieldMappingApiInstance.from_json(json_object: item)
  end
  user = parsed_json["User"]&.map do |item|
    item = item.to_json
    Merge::Filestorage::FieldMappingApiInstance.from_json(json_object: item)
  end
  new(
    file: file,
    folder: folder,
    drive: drive,
    group: group,
    user: user,
    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)


103
104
105
106
107
108
109
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance_response.rb', line 103

def self.validate_raw(obj:)
  obj.file&.is_a?(Array) != false || raise("Passed value for field obj.file is not the expected type, validation failed.")
  obj.folder&.is_a?(Array) != false || raise("Passed value for field obj.folder is not the expected type, validation failed.")
  obj.drive&.is_a?(Array) != false || raise("Passed value for field obj.drive is not the expected type, validation failed.")
  obj.group&.is_a?(Array) != false || raise("Passed value for field obj.group is not the expected type, validation failed.")
  obj.user&.is_a?(Array) != false || raise("Passed value for field obj.user is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of FieldMappingApiInstanceResponse to a JSON object

Returns:

  • (String)


93
94
95
# File 'lib/merge_ruby_client/filestorage/types/field_mapping_api_instance_response.rb', line 93

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