| 1 | ########################################### | ||||||||||||||||||||||||||||
| 2 | package Net::Google::Drive::Simple::Item; | ||||||||||||||||||||||||||||
| 3 | ########################################### | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 11 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 11 | our $VERSION = '3.01'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | sub new { | ||||||||||||||||||||||||||||
| 11 | 5 | ▶ | my ( $pkg, $data ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 5 | ▶ | die q[new is expecting one hashref] unless ref $data eq 'HASH'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 3 | return bless { data => $data }, $pkg; | |||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | sub is_folder { | ||||||||||||||||||||||||||||
| 19 | 6 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
is_folder: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 6 | my $mimeType = $self->mimeType; | |||||||||||||||||||||||||||
| 22 | 6 | ▶ | $mimeType = '' unless defined $mimeType; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | 6 | ▶ | return $mimeType eq 'application/vnd.google-apps.folder' ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | sub is_file { | ||||||||||||||||||||||||||||
| 27 | 3 | ▶ | return $_[0]->is_folder ? 0 : 1; | ||||||||||||||||||||||||||
|
Subroutine
is_file: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | ▶ | sub DESTROY { } | |||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | sub AUTOLOAD { | ||||||||||||||||||||||||||||
| 33 | 25 | ▶ | our $AUTOLOAD; | ||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=6 SCAR=18.2
| |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 25 | my $self = shift; | |||||||||||||||||||||||||||
| 36 | 25 | my $key = $AUTOLOAD; | |||||||||||||||||||||||||||
| 37 | 25 | $key =~ s/.*:://; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 25 | my $data = $self->{data}; | |||||||||||||||||||||||||||
| 40 | 25 | ▶ | die unless $data && ref $data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$data and ref $data
MC/DC0%0/2
$data and ref $data
$data
ref $data
Truth table33%1/3
A and B
A= $dataB= ref $data
| |||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 25 | ▶ | return $data->{$key} if exists $data->{$key}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | # catching typos :-) | ||||||||||||||||||||||||||||
| 45 | 6 | my $lc_key = lc $key; | |||||||||||||||||||||||||||
| 46 | 6 | ▶ | if ( $lc_key ne $key ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | 5 | my $mapping = $self->_mapping(); | |||||||||||||||||||||||||||
| 48 | 5 | ▶ | return $data->{ $mapping->{$lc_key} } if exists $mapping->{$lc_key}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 1 | die "Cannot find any attribute named '$key' for " . ref($self); | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | sub _mapping { | ||||||||||||||||||||||||||||
| 55 | 5 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_mapping: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 5 | ▶ | return $self->{_mapping} if defined $self->{_mapping}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | 2 | $self->{_mapping} = { map { lc($_) => $_ } keys %{ $self->{data} } }; | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 2 | return $self->{_mapping}; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 11 | 1; | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | __END__ | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | =head1 NAME | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | Net::Google::Drive::Simple::Item - Representation of a Google Drive File | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | use feature 'say'; | ||||||||||||||||||||||||||||
| 75 | use Net::Google::Drive::Simple; | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | # requires a ~/.google-drive.yml file with an access token, | ||||||||||||||||||||||||||||
| 78 | # see description from Net::Google::Drive::Simple | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | my $gd = Net::Google::Drive::Simple->new(); | ||||||||||||||||||||||||||||
| 81 | my $children = $gd->children( "/" ); # or any other folder /path/location | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | foreach my $item ( @$children ) { | ||||||||||||||||||||||||||||
| 84 | # $item is one Net::Google::Drive::Simple::Item object | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | if ( $item->is_folder ) { | ||||||||||||||||||||||||||||
| 87 | say "** ", $item->title, " is a folder"; | ||||||||||||||||||||||||||||
| 88 | } else { | ||||||||||||||||||||||||||||
| 89 | say $item->title, " is a file ", $item->mimeType; | ||||||||||||||||||||||||||||
| 90 | eval { # originalFilename not necessary available for all files | ||||||||||||||||||||||||||||
| 91 | say $item->originalFilename(), " can be downloaded at ", $item->downloadUrl(); | ||||||||||||||||||||||||||||
| 92 | }; | ||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | Net::Google::Drive::Simple::Item provides a class to manipulate the | ||||||||||||||||||||||||||||
| 99 | File methadata from Google Drive API. | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | https://developers.google.com/drive/api/v3/reference/files | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | =head2 GETTING STARTED | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | This class should not be used directly, and you should use | ||||||||||||||||||||||||||||
| 106 | L<Net::Google::Drive::Simple> as shown in the synopsis. | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | =head1 METHODS | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | =over 4 | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | =item C<new( $data )> | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | Constructor, creates one object which hold on hash ref C<$data> | ||||||||||||||||||||||||||||
| 115 | to manipulate the metadata for a file. | ||||||||||||||||||||||||||||
| 116 | All the keys from the hash below as documented in L<Google Drive API Doc|https://developers.google.com/drive/api/v3/reference/files> | ||||||||||||||||||||||||||||
| 117 | are mapped using AUTOLOAD so you can use helpers for every first level entry like these: | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | $file->kind; | ||||||||||||||||||||||||||||
| 120 | $file->id; | ||||||||||||||||||||||||||||
| 121 | $file->name; | ||||||||||||||||||||||||||||
| 122 | $file->mimeType; | ||||||||||||||||||||||||||||
| 123 | .... | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | { | ||||||||||||||||||||||||||||
| 126 | "kind": "drive#file", | ||||||||||||||||||||||||||||
| 127 | "id": string, | ||||||||||||||||||||||||||||
| 128 | "name": string, | ||||||||||||||||||||||||||||
| 129 | "mimeType": string, | ||||||||||||||||||||||||||||
| 130 | "description": string, | ||||||||||||||||||||||||||||
| 131 | "starred": boolean, | ||||||||||||||||||||||||||||
| 132 | "trashed": boolean, | ||||||||||||||||||||||||||||
| 133 | "explicitlyTrashed": boolean, | ||||||||||||||||||||||||||||
| 134 | "trashingUser": { | ||||||||||||||||||||||||||||
| 135 | "kind": "drive#user", | ||||||||||||||||||||||||||||
| 136 | "displayName": string, | ||||||||||||||||||||||||||||
| 137 | "photoLink": string, | ||||||||||||||||||||||||||||
| 138 | "me": boolean, | ||||||||||||||||||||||||||||
| 139 | "permissionId": string, | ||||||||||||||||||||||||||||
| 140 | "emailAddress": string | ||||||||||||||||||||||||||||
| 141 | }, | ||||||||||||||||||||||||||||
| 142 | "trashedTime": datetime, | ||||||||||||||||||||||||||||
| 143 | "parents": [ | ||||||||||||||||||||||||||||
| 144 | string | ||||||||||||||||||||||||||||
| 145 | ], | ||||||||||||||||||||||||||||
| 146 | "properties": { | ||||||||||||||||||||||||||||
| 147 | (key): string | ||||||||||||||||||||||||||||
| 148 | }, | ||||||||||||||||||||||||||||
| 149 | "appProperties": { | ||||||||||||||||||||||||||||
| 150 | (key): string | ||||||||||||||||||||||||||||
| 151 | }, | ||||||||||||||||||||||||||||
| 152 | "spaces": [ | ||||||||||||||||||||||||||||
| 153 | string | ||||||||||||||||||||||||||||
| 154 | ], | ||||||||||||||||||||||||||||
| 155 | "version": long, | ||||||||||||||||||||||||||||
| 156 | "webContentLink": string, | ||||||||||||||||||||||||||||
| 157 | "webViewLink": string, | ||||||||||||||||||||||||||||
| 158 | "iconLink": string, | ||||||||||||||||||||||||||||
| 159 | "hasThumbnail": boolean, | ||||||||||||||||||||||||||||
| 160 | "thumbnailLink": string, | ||||||||||||||||||||||||||||
| 161 | "thumbnailVersion": long, | ||||||||||||||||||||||||||||
| 162 | "viewedByMe": boolean, | ||||||||||||||||||||||||||||
| 163 | "viewedByMeTime": datetime, | ||||||||||||||||||||||||||||
| 164 | "createdTime": datetime, | ||||||||||||||||||||||||||||
| 165 | "modifiedTime": datetime, | ||||||||||||||||||||||||||||
| 166 | "modifiedByMeTime": datetime, | ||||||||||||||||||||||||||||
| 167 | "modifiedByMe": boolean, | ||||||||||||||||||||||||||||
| 168 | "sharedWithMeTime": datetime, | ||||||||||||||||||||||||||||
| 169 | "sharingUser": { | ||||||||||||||||||||||||||||
| 170 | "kind": "drive#user", | ||||||||||||||||||||||||||||
| 171 | "displayName": string, | ||||||||||||||||||||||||||||
| 172 | "photoLink": string, | ||||||||||||||||||||||||||||
| 173 | "me": boolean, | ||||||||||||||||||||||||||||
| 174 | "permissionId": string, | ||||||||||||||||||||||||||||
| 175 | "emailAddress": string | ||||||||||||||||||||||||||||
| 176 | }, | ||||||||||||||||||||||||||||
| 177 | "owners": [ | ||||||||||||||||||||||||||||
| 178 | { | ||||||||||||||||||||||||||||
| 179 | "kind": "drive#user", | ||||||||||||||||||||||||||||
| 180 | "displayName": string, | ||||||||||||||||||||||||||||
| 181 | "photoLink": string, | ||||||||||||||||||||||||||||
| 182 | "me": boolean, | ||||||||||||||||||||||||||||
| 183 | "permissionId": string, | ||||||||||||||||||||||||||||
| 184 | "emailAddress": string | ||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | ], | ||||||||||||||||||||||||||||
| 187 | "teamDriveId": string, | ||||||||||||||||||||||||||||
| 188 | "driveId": string, | ||||||||||||||||||||||||||||
| 189 | "lastModifyingUser": { | ||||||||||||||||||||||||||||
| 190 | "kind": "drive#user", | ||||||||||||||||||||||||||||
| 191 | "displayName": string, | ||||||||||||||||||||||||||||
| 192 | "photoLink": string, | ||||||||||||||||||||||||||||
| 193 | "me": boolean, | ||||||||||||||||||||||||||||
| 194 | "permissionId": string, | ||||||||||||||||||||||||||||
| 195 | "emailAddress": string | ||||||||||||||||||||||||||||
| 196 | }, | ||||||||||||||||||||||||||||
| 197 | "shared": boolean, | ||||||||||||||||||||||||||||
| 198 | "ownedByMe": boolean, | ||||||||||||||||||||||||||||
| 199 | "capabilities": { | ||||||||||||||||||||||||||||
| 200 | "canAddChildren": boolean, | ||||||||||||||||||||||||||||
| 201 | "canChangeCopyRequiresWriterPermission": boolean, | ||||||||||||||||||||||||||||
| 202 | "canChangeViewersCanCopyContent": boolean, | ||||||||||||||||||||||||||||
| 203 | "canComment": boolean, | ||||||||||||||||||||||||||||
| 204 | "canCopy": boolean, | ||||||||||||||||||||||||||||
| 205 | "canDelete": boolean, | ||||||||||||||||||||||||||||
| 206 | "canDeleteChildren": boolean, | ||||||||||||||||||||||||||||
| 207 | "canDownload": boolean, | ||||||||||||||||||||||||||||
| 208 | "canEdit": boolean, | ||||||||||||||||||||||||||||
| 209 | "canListChildren": boolean, | ||||||||||||||||||||||||||||
| 210 | "canModifyContent": boolean, | ||||||||||||||||||||||||||||
| 211 | "canMoveChildrenOutOfTeamDrive": boolean, | ||||||||||||||||||||||||||||
| 212 | "canMoveChildrenOutOfDrive": boolean, | ||||||||||||||||||||||||||||
| 213 | "canMoveChildrenWithinTeamDrive": boolean, | ||||||||||||||||||||||||||||
| 214 | "canMoveChildrenWithinDrive": boolean, | ||||||||||||||||||||||||||||
| 215 | "canMoveItemIntoTeamDrive": boolean, | ||||||||||||||||||||||||||||
| 216 | "canMoveItemOutOfTeamDrive": boolean, | ||||||||||||||||||||||||||||
| 217 | "canMoveItemOutOfDrive": boolean, | ||||||||||||||||||||||||||||
| 218 | "canMoveItemWithinTeamDrive": boolean, | ||||||||||||||||||||||||||||
| 219 | "canMoveItemWithinDrive": boolean, | ||||||||||||||||||||||||||||
| 220 | "canMoveTeamDriveItem": boolean, | ||||||||||||||||||||||||||||
| 221 | "canReadRevisions": boolean, | ||||||||||||||||||||||||||||
| 222 | "canReadTeamDrive": boolean, | ||||||||||||||||||||||||||||
| 223 | "canReadDrive": boolean, | ||||||||||||||||||||||||||||
| 224 | "canRemoveChildren": boolean, | ||||||||||||||||||||||||||||
| 225 | "canRename": boolean, | ||||||||||||||||||||||||||||
| 226 | "canShare": boolean, | ||||||||||||||||||||||||||||
| 227 | "canTrash": boolean, | ||||||||||||||||||||||||||||
| 228 | "canTrashChildren": boolean, | ||||||||||||||||||||||||||||
| 229 | "canUntrash": boolean | ||||||||||||||||||||||||||||
| 230 | }, | ||||||||||||||||||||||||||||
| 231 | "viewersCanCopyContent": boolean, | ||||||||||||||||||||||||||||
| 232 | "copyRequiresWriterPermission": boolean, | ||||||||||||||||||||||||||||
| 233 | "writersCanShare": boolean, | ||||||||||||||||||||||||||||
| 234 | "permissions": [ | ||||||||||||||||||||||||||||
| 235 | permissions Resource | ||||||||||||||||||||||||||||
| 236 | ], | ||||||||||||||||||||||||||||
| 237 | "permissionIds": [ | ||||||||||||||||||||||||||||
| 238 | string | ||||||||||||||||||||||||||||
| 239 | ], | ||||||||||||||||||||||||||||
| 240 | "hasAugmentedPermissions": boolean, | ||||||||||||||||||||||||||||
| 241 | "folderColorRgb": string, | ||||||||||||||||||||||||||||
| 242 | "originalFilename": string, | ||||||||||||||||||||||||||||
| 243 | "fullFileExtension": string, | ||||||||||||||||||||||||||||
| 244 | "fileExtension": string, | ||||||||||||||||||||||||||||
| 245 | "md5Checksum": string, | ||||||||||||||||||||||||||||
| 246 | "size": long, | ||||||||||||||||||||||||||||
| 247 | "quotaBytesUsed": long, | ||||||||||||||||||||||||||||
| 248 | "headRevisionId": string, | ||||||||||||||||||||||||||||
| 249 | "contentHints": { | ||||||||||||||||||||||||||||
| 250 | "thumbnail": { | ||||||||||||||||||||||||||||
| 251 | "image": bytes, | ||||||||||||||||||||||||||||
| 252 | "mimeType": string | ||||||||||||||||||||||||||||
| 253 | }, | ||||||||||||||||||||||||||||
| 254 | "indexableText": string | ||||||||||||||||||||||||||||
| 255 | }, | ||||||||||||||||||||||||||||
| 256 | "imageMediaMetadata": { | ||||||||||||||||||||||||||||
| 257 | "width": integer, | ||||||||||||||||||||||||||||
| 258 | "height": integer, | ||||||||||||||||||||||||||||
| 259 | "rotation": integer, | ||||||||||||||||||||||||||||
| 260 | "location": { | ||||||||||||||||||||||||||||
| 261 | "latitude": double, | ||||||||||||||||||||||||||||
| 262 | "longitude": double, | ||||||||||||||||||||||||||||
| 263 | "altitude": double | ||||||||||||||||||||||||||||
| 264 | }, | ||||||||||||||||||||||||||||
| 265 | "time": string, | ||||||||||||||||||||||||||||
| 266 | "cameraMake": string, | ||||||||||||||||||||||||||||
| 267 | "cameraModel": string, | ||||||||||||||||||||||||||||
| 268 | "exposureTime": float, | ||||||||||||||||||||||||||||
| 269 | "aperture": float, | ||||||||||||||||||||||||||||
| 270 | "flashUsed": boolean, | ||||||||||||||||||||||||||||
| 271 | "focalLength": float, | ||||||||||||||||||||||||||||
| 272 | "isoSpeed": integer, | ||||||||||||||||||||||||||||
| 273 | "meteringMode": string, | ||||||||||||||||||||||||||||
| 274 | "sensor": string, | ||||||||||||||||||||||||||||
| 275 | "exposureMode": string, | ||||||||||||||||||||||||||||
| 276 | "colorSpace": string, | ||||||||||||||||||||||||||||
| 277 | "whiteBalance": string, | ||||||||||||||||||||||||||||
| 278 | "exposureBias": float, | ||||||||||||||||||||||||||||
| 279 | "maxApertureValue": float, | ||||||||||||||||||||||||||||
| 280 | "subjectDistance": integer, | ||||||||||||||||||||||||||||
| 281 | "lens": string | ||||||||||||||||||||||||||||
| 282 | }, | ||||||||||||||||||||||||||||
| 283 | "videoMediaMetadata": { | ||||||||||||||||||||||||||||
| 284 | "width": integer, | ||||||||||||||||||||||||||||
| 285 | "height": integer, | ||||||||||||||||||||||||||||
| 286 | "durationMillis": long | ||||||||||||||||||||||||||||
| 287 | }, | ||||||||||||||||||||||||||||
| 288 | "isAppAuthorized": boolean, | ||||||||||||||||||||||||||||
| 289 | "exportLinks": { | ||||||||||||||||||||||||||||
| 290 | (key): string | ||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | =item C<$file-E<gt>is_folder> | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | Return a boolean '1' or '0' to indicate if the current file | ||||||||||||||||||||||||||||
| 297 | is one folder or not. (this is using the mimeType value). | ||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | $iterm->is_folder | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | =item C<$file-E<gt>is_file> | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | Return a boolean '1' or '0' to indicate if the current file | ||||||||||||||||||||||||||||
| 304 | is a regular file (not a folder). | ||||||||||||||||||||||||||||
| 305 | (this is using the mimeType value). | ||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | $iterm->is_file or ! $iterm->is_folder | ||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | =item C<$file-E<gt>kind> | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | Identifies what kind of resource this is. Value: the fixed string "drive#file". | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | =item C<$file-E<gt>id> | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | The ID of the file. | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | =item C<$file-E<gt>name> | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | The name of the file. This is not necessarily unique within a folder. | ||||||||||||||||||||||||||||
| 320 | Note that for immutable items such as the top level folders of shared drives, My Drive root folder, | ||||||||||||||||||||||||||||
| 321 | and Application Data folder the name is constant. | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | =item C<$file-E<gt>mimeType> | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | The MIME type of the file. | ||||||||||||||||||||||||||||
| 326 | Google Drive will attempt to automatically detect an appropriate value from uploaded content if no value is provided. The value cannot be changed unless a new revision is uploaded. | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | If a file is created with a Google Doc MIME type, the uploaded content will be imported if possible. The supported import formats are published in the About resource. | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | =item C<$file-E<gt>description> | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | A short description of the file. | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | =item C<$file-E<gt>starred> | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | boolean - Whether the user has starred the file. | ||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||
| 338 | =item C<$file-E<gt>trashed> | ||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | boolean - Whether the file has been trashed, either explicitly or from a trashed parent folder. Only the owner may trash a file, and other users cannot see files in the owner's trash. | ||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||
| 342 | =item C<$file-E<gt>explicitlyTrashed> | ||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | boolean - Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder. | ||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | =item C<$file-E<gt>version> | ||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the user. | ||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | =item C<$file-E<gt>createdTime> | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | The time at which the file was created (RFC 3339 date-time). | ||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | =item C<$file-E<gt>modifiedTime> | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | The last time the file was modified by anyone (RFC 3339 date-time). | ||||||||||||||||||||||||||||
| 357 | Note that setting modifiedTime will also update modifiedByMeTime for the user. | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | =item C<$file-E<gt>size> | ||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | The size of the file's content in bytes. This is only applicable to files with binary content in Google Drive. | ||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | =item C<$file-E<gt>capabilities> | ||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | Capabilities the current user has on this file. Each capability corresponds to a fine-grained action that a user may take. | ||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||
| 367 | =item more... | ||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||
| 369 | Please refer to the official documentation | ||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | https://developers.google.com/drive/api/v3/reference/files | ||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | for more informations about the possible fields. | ||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||
| 375 | =back | ||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | =head1 Tips | ||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||
| 379 | =head2 AUTOLOAD | ||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | The implemented AUTOLOAD function is case insensitive. | ||||||||||||||||||||||||||||
| 382 | The following functions C<$iterm->id>, C<$iterm->ID> and C<$iterm->Id> | ||||||||||||||||||||||||||||
| 383 | for example are all equivalent and return the 'id' for the file. | ||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | When trying to access to an unknown field, the code will die/throw an exception. | ||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | eval { $item->DoNotExist } and $@ =~ m{"Cannot find any attribute named 'DoNotExist'} | ||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||
| 390 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||
| 392 | 2019, Nicolas R. <cpan@atoomic.org> | ||||||||||||||||||||||||||||