Class: Merge::Filestorage::FolderRequest
- Inherits:
-
Object
- Object
- Merge::Filestorage::FolderRequest
- 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
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#description ⇒ String
readonly
The folder’s description.
-
#drive ⇒ Merge::Filestorage::FolderRequestDrive
readonly
The drive that the folder belongs to.
-
#folder_url ⇒ String
readonly
The URL to access the folder.
- #integration_params ⇒ Hash{String => Object} readonly
- #linked_account_params ⇒ Hash{String => Object} readonly
-
#name ⇒ String
readonly
The folder’s name.
-
#parent_folder ⇒ Merge::Filestorage::FolderRequestParentFolder
readonly
The folder that the folder belongs to.
-
#permissions ⇒ Merge::Filestorage::FolderRequestPermissions
readonly
The Permission object is used to represent a user’s or group’s access to a File or Folder.
-
#size ⇒ Integer
readonly
The folder’s size, in bytes.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Filestorage::FolderRequest
Deserialize a JSON object to an instance of FolderRequest.
-
.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.
Instance Method Summary collapse
- #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 constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of FolderRequest to a JSON object.
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
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 = if != OMIT @integration_params = integration_params if integration_params != OMIT @linked_account_params = linked_account_params if linked_account_params != OMIT @additional_properties = additional_properties @_field_set = { "name": name, "folder_url": folder_url, "size": size, "description": description, "parent_folder": parent_folder, "drive": drive, "permissions": , "integration_params": integration_params, "linked_account_params": linked_account_params }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns 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 |
#description ⇒ String (readonly)
Returns The folder’s description.
26 27 28 |
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 26 def description @description end |
#drive ⇒ Merge::Filestorage::FolderRequestDrive (readonly)
Returns The drive that the folder belongs to.
30 31 32 |
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 30 def drive @drive end |
#folder_url ⇒ String (readonly)
Returns 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_params ⇒ Hash{String => Object} (readonly)
36 37 38 |
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 36 def integration_params @integration_params end |
#linked_account_params ⇒ Hash{String => Object} (readonly)
38 39 40 |
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 38 def linked_account_params @linked_account_params end |
#name ⇒ String (readonly)
Returns The folder’s name.
20 21 22 |
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 20 def name @name end |
#parent_folder ⇒ Merge::Filestorage::FolderRequestParentFolder (readonly)
Returns The folder that the folder belongs to.
28 29 30 |
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 28 def parent_folder @parent_folder end |
#permissions ⇒ Merge::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`.
34 35 36 |
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 34 def @permissions end |
#size ⇒ Integer (readonly)
Returns 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
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? = nil else = parsed_json["permissions"].to_json = Merge::Filestorage::FolderRequestPermissions.from_json(json_object: ) end integration_params = parsed_json["integration_params"] linked_account_params = parsed_json["linked_account_params"] new( name: name, folder_url: folder_url, size: size, description: description, parent_folder: parent_folder, drive: drive, permissions: , integration_params: integration_params, linked_account_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.
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..nil? || Merge::Filestorage::FolderRequestPermissions.validate_raw(obj: obj.) obj.integration_params&.is_a?(Hash) != false || raise("Passed value for field obj.integration_params is not the expected type, validation failed.") obj.linked_account_params&.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
135 136 137 |
# File 'lib/merge_ruby_client/filestorage/types/folder_request.rb', line 135 def to_json(*_args) @_field_set&.to_json end |