Class: Merge::Filestorage::FolderRequest

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

Overview

# The Folder Object

### Description
The `Folder` object is used to represent a collection of files and/or folders in
the workspace. Could be within a drive, if it exists.
### Usage Example
Fetch from the `GET /api/filestorage/v1/folders` endpoint and view their
folders.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: OMIT, folder_url: OMIT, size: OMIT, description: OMIT, parent_folder: OMIT, drive: OMIT, permissions: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) ⇒ Merge::Filestorage::FolderRequest

Parameters:

  • name (String) (defaults to: OMIT)

    The folder’s name.

  • folder_url (String) (defaults to: OMIT)

    The URL to access the folder.

  • size (Integer) (defaults to: OMIT)

    The folder’s size, in bytes.

  • description (String) (defaults to: OMIT)

    The folder’s description.

  • parent_folder (Merge::Filestorage::FolderRequestParentFolder) (defaults to: OMIT)

    The folder that the folder belongs to.

  • drive (Merge::Filestorage::FolderRequestDrive) (defaults to: OMIT)

    The drive that the folder belongs to.

  • permissions (Merge::Filestorage::FolderRequestPermissions) (defaults to: OMIT)

    The Permission object is used to represent a user’s or group’s access to a File or Folder. Permissions are unexpanded by default. Use the query param ‘expand=permissions` to see more details under `GET /folders`.

  • integration_params (Hash{String => Object}) (defaults to: OMIT)
  • linked_account_params (Hash{String => Object}) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 60

def initialize(name: OMIT, folder_url: OMIT, size: OMIT, description: OMIT, parent_folder: OMIT, drive: OMIT,
               permissions: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil)
  @name = name if name != OMIT
  @folder_url = folder_url if folder_url != OMIT
  @size = size if size != OMIT
  @description = description if description != OMIT
  @parent_folder = parent_folder if parent_folder != OMIT
  @drive = drive if drive != OMIT
  @permissions = permissions if permissions != OMIT
  @integration_params = integration_params if integration_params != OMIT
  @linked_account_params =  if  != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "name": name,
    "folder_url": folder_url,
    "size": size,
    "description": description,
    "parent_folder": parent_folder,
    "drive": drive,
    "permissions": permissions,
    "integration_params": integration_params,
    "linked_account_params": 
  }.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



40
41
42
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 40

def additional_properties
  @additional_properties
end

#descriptionString (readonly)

Returns The folder’s description.

Returns:

  • (String)

    The folder’s description.



26
27
28
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 26

def description
  @description
end

#driveMerge::Filestorage::FolderRequestDrive (readonly)

Returns The drive that the folder belongs to.

Returns:



30
31
32
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 30

def drive
  @drive
end

#folder_urlString (readonly)

Returns The URL to access the folder.

Returns:

  • (String)

    The URL to access the folder.



22
23
24
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 22

def folder_url
  @folder_url
end

#integration_paramsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


36
37
38
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 36

def integration_params
  @integration_params
end

#linked_account_paramsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


38
39
40
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 38

def 
  @linked_account_params
end

#nameString (readonly)

Returns The folder’s name.

Returns:

  • (String)

    The folder’s name.



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

def name
  @name
end

#parent_folderMerge::Filestorage::FolderRequestParentFolder (readonly)

Returns The folder that the folder belongs to.

Returns:



28
29
30
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 28

def parent_folder
  @parent_folder
end

#permissionsMerge::Filestorage::FolderRequestPermissions (readonly)

Returns The Permission object is used to represent a user’s or group’s access to a File or Folder. Permissions are unexpanded by default. Use the query param ‘expand=permissions` to see more details under `GET /folders`.

Returns:

  • (Merge::Filestorage::FolderRequestPermissions)

    The Permission object is used to represent a user’s or group’s access to a File or Folder. Permissions are unexpanded by default. Use the query param ‘expand=permissions` to see more details under `GET /folders`.



34
35
36
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 34

def permissions
  @permissions
end

#sizeInteger (readonly)

Returns The folder’s size, in bytes.

Returns:

  • (Integer)

    The folder’s size, in bytes.



24
25
26
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 24

def size
  @size
end

Class Method Details

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

Deserialize a JSON object to an instance of FolderRequest

Parameters:

  • json_object (String)

Returns:



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 91

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  name = parsed_json["name"]
  folder_url = parsed_json["folder_url"]
  size = parsed_json["size"]
  description = parsed_json["description"]
  if parsed_json["parent_folder"].nil?
    parent_folder = nil
  else
    parent_folder = parsed_json["parent_folder"].to_json
    parent_folder = Merge::Filestorage::FolderRequestParentFolder.from_json(json_object: parent_folder)
  end
  if parsed_json["drive"].nil?
    drive = nil
  else
    drive = parsed_json["drive"].to_json
    drive = Merge::Filestorage::FolderRequestDrive.from_json(json_object: drive)
  end
  if parsed_json["permissions"].nil?
    permissions = nil
  else
    permissions = parsed_json["permissions"].to_json
    permissions = Merge::Filestorage::FolderRequestPermissions.from_json(json_object: permissions)
  end
  integration_params = parsed_json["integration_params"]
   = parsed_json["linked_account_params"]
  new(
    name: name,
    folder_url: folder_url,
    size: size,
    description: description,
    parent_folder: parent_folder,
    drive: drive,
    permissions: permissions,
    integration_params: integration_params,
    linked_account_params: ,
    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)


145
146
147
148
149
150
151
152
153
154
155
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 145

def self.validate_raw(obj:)
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.folder_url&.is_a?(String) != false || raise("Passed value for field obj.folder_url is not the expected type, validation failed.")
  obj.size&.is_a?(Integer) != false || raise("Passed value for field obj.size is not the expected type, validation failed.")
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
  obj.parent_folder.nil? || Merge::Filestorage::FolderRequestParentFolder.validate_raw(obj: obj.parent_folder)
  obj.drive.nil? || Merge::Filestorage::FolderRequestDrive.validate_raw(obj: obj.drive)
  obj.permissions.nil? || Merge::Filestorage::FolderRequestPermissions.validate_raw(obj: obj.permissions)
  obj.integration_params&.is_a?(Hash) != false || raise("Passed value for field obj.integration_params is not the expected type, validation failed.")
  obj.&.is_a?(Hash) != false || raise("Passed value for field obj.linked_account_params is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of FolderRequest to a JSON object

Returns:

  • (String)


135
136
137
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 135

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