Class: Google::Apis::DriveV2::File

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
generated/google/apis/drive_v2/classes.rb,
generated/google/apis/drive_v2/representations.rb,
generated/google/apis/drive_v2/representations.rb

Overview

The metadata for a file.

Defined Under Namespace

Classes: ImageMediaMetadata, IndexableText, Labels, Thumbnail, VideoMediaMetadata

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::JsonObjectSupport

#to_json

Methods included from Core::Hashable

process_value, #to_h

Constructor Details

#initialize(**args) ⇒ File

Returns a new instance of File.


1537
1538
1539
# File 'generated/google/apis/drive_v2/classes.rb', line 1537

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

A link for opening the file in a relevant Google editor or viewer. Corresponds to the JSON property alternateLink

Returns:

  • (String)

1201
1202
1203
# File 'generated/google/apis/drive_v2/classes.rb', line 1201

def alternate_link
  @alternate_link
end

#app_data_contentsBoolean Also known as: app_data_contents?

Whether this file is in the Application Data folder. Corresponds to the JSON property appDataContents

Returns:

  • (Boolean)

1206
1207
1208
# File 'generated/google/apis/drive_v2/classes.rb', line 1206

def app_data_contents
  @app_data_contents
end

#can_commentBoolean Also known as: can_comment?

Whether the current user can comment on the file. Corresponds to the JSON property canComment

Returns:

  • (Boolean)

1212
1213
1214
# File 'generated/google/apis/drive_v2/classes.rb', line 1212

def can_comment
  @can_comment
end

#can_read_revisionsBoolean Also known as: can_read_revisions?

Whether the current user has read access to the Revisions resource of the file. Corresponds to the JSON property canReadRevisions

Returns:

  • (Boolean)

1218
1219
1220
# File 'generated/google/apis/drive_v2/classes.rb', line 1218

def can_read_revisions
  @can_read_revisions
end

#copyableBoolean Also known as: copyable?

Whether the file can be copied by the current user. Corresponds to the JSON property copyable

Returns:

  • (Boolean)

1224
1225
1226
# File 'generated/google/apis/drive_v2/classes.rb', line 1224

def copyable
  @copyable
end

#created_dateDateTime

Create time for this file (formatted RFC 3339 timestamp). Corresponds to the JSON property createdDate

Returns:

  • (DateTime)

1230
1231
1232
# File 'generated/google/apis/drive_v2/classes.rb', line 1230

def created_date
  @created_date
end

A link to open this file with the user's default app for this file. Only populated when the drive.apps.readonly scope is used. Corresponds to the JSON property defaultOpenWithLink

Returns:

  • (String)

1236
1237
1238
# File 'generated/google/apis/drive_v2/classes.rb', line 1236

def default_open_with_link
  @default_open_with_link
end

#descriptionString

A short description of the file. Corresponds to the JSON property description

Returns:

  • (String)

1241
1242
1243
# File 'generated/google/apis/drive_v2/classes.rb', line 1241

def description
  @description
end

#download_urlString

Corresponds to the JSON property downloadUrl

Returns:

  • (String)

1246
1247
1248
# File 'generated/google/apis/drive_v2/classes.rb', line 1246

def download_url
  @download_url
end

#editableBoolean Also known as: editable?

Whether the file can be edited by the current user. Corresponds to the JSON property editable

Returns:

  • (Boolean)

1251
1252
1253
# File 'generated/google/apis/drive_v2/classes.rb', line 1251

def editable
  @editable
end

A link for embedding the file. Corresponds to the JSON property embedLink

Returns:

  • (String)

1257
1258
1259
# File 'generated/google/apis/drive_v2/classes.rb', line 1257

def embed_link
  @embed_link
end

#etagString

ETag of the file. Corresponds to the JSON property etag

Returns:

  • (String)

1262
1263
1264
# File 'generated/google/apis/drive_v2/classes.rb', line 1262

def etag
  @etag
end

#explicitly_trashedBoolean Also known as: explicitly_trashed?

Whether this file has been explicitly trashed, as opposed to recursively trashed. Corresponds to the JSON property explicitlyTrashed

Returns:

  • (Boolean)

1268
1269
1270
# File 'generated/google/apis/drive_v2/classes.rb', line 1268

def explicitly_trashed
  @explicitly_trashed
end

Links for exporting Google Docs to specific formats. Corresponds to the JSON property exportLinks

Returns:

  • (Hash<String,String>)

1274
1275
1276
# File 'generated/google/apis/drive_v2/classes.rb', line 1274

def export_links
  @export_links
end

#file_extensionString

The final component of fullFileExtension with trailing text that does not appear to be part of the extension removed. This field is only populated for files with content stored in Drive; it is not populated for Google Docs or shortcut files. Corresponds to the JSON property fileExtension

Returns:

  • (String)

1282
1283
1284
# File 'generated/google/apis/drive_v2/classes.rb', line 1282

def file_extension
  @file_extension
end

#file_sizeString

The size of the file in bytes. This field is only populated for files with content stored in Drive; it is not populated for Google Docs or shortcut files. Corresponds to the JSON property fileSize

Returns:

  • (String)

1288
1289
1290
# File 'generated/google/apis/drive_v2/classes.rb', line 1288

def file_size
  @file_size
end

#folder_color_rgbString

Folder color as an RGB hex string if the file is a folder. The list of supported colors is available in the folderColorPalette field of the About resource. If an unsupported color is specified, it will be changed to the closest color in the palette. Corresponds to the JSON property folderColorRgb

Returns:

  • (String)

1296
1297
1298
# File 'generated/google/apis/drive_v2/classes.rb', line 1296

def folder_color_rgb
  @folder_color_rgb
end

#full_file_extensionString

The full file extension; extracted from the title. May contain multiple concatenated extensions, such as "tar.gz". Removing an extension from the title does not clear this field; however, changing the extension on the title does update this field. This field is only populated for files with content stored in Drive; it is not populated for Google Docs or shortcut files. Corresponds to the JSON property fullFileExtension

Returns:

  • (String)

1305
1306
1307
# File 'generated/google/apis/drive_v2/classes.rb', line 1305

def full_file_extension
  @full_file_extension
end

#head_revision_idString

The ID of the file's head revision. This field is only populated for files with content stored in Drive; it is not populated for Google Docs or shortcut files. Corresponds to the JSON property headRevisionId

Returns:

  • (String)

1312
1313
1314
# File 'generated/google/apis/drive_v2/classes.rb', line 1312

def head_revision_id
  @head_revision_id
end

A link to the file's icon. Corresponds to the JSON property iconLink

Returns:

  • (String)

1317
1318
1319
# File 'generated/google/apis/drive_v2/classes.rb', line 1317

def icon_link
  @icon_link
end

#idString

The ID of the file. Corresponds to the JSON property id

Returns:

  • (String)

1322
1323
1324
# File 'generated/google/apis/drive_v2/classes.rb', line 1322

def id
  @id
end

#image_media_metadataGoogle::Apis::DriveV2::File::ImageMediaMetadata

Metadata about image media. This will only be present for image types, and its contents will depend on what can be parsed from the image content. Corresponds to the JSON property imageMediaMetadata


1328
1329
1330
# File 'generated/google/apis/drive_v2/classes.rb', line 1328

def 
  @image_media_metadata
end

#indexable_textGoogle::Apis::DriveV2::File::IndexableText

Indexable text attributes for the file (can only be written) Corresponds to the JSON property indexableText


1333
1334
1335
# File 'generated/google/apis/drive_v2/classes.rb', line 1333

def indexable_text
  @indexable_text
end

#is_app_authorizedBoolean Also known as: is_app_authorized?

Whether the file was created or opened by the requesting app. Corresponds to the JSON property isAppAuthorized

Returns:

  • (Boolean)

1338
1339
1340
# File 'generated/google/apis/drive_v2/classes.rb', line 1338

def is_app_authorized
  @is_app_authorized
end

#kindString

The type of file. This is always drive#file. Corresponds to the JSON property kind

Returns:

  • (String)

1344
1345
1346
# File 'generated/google/apis/drive_v2/classes.rb', line 1344

def kind
  @kind
end

#labelsGoogle::Apis::DriveV2::File::Labels

A group of labels for the file. Corresponds to the JSON property labels


1349
1350
1351
# File 'generated/google/apis/drive_v2/classes.rb', line 1349

def labels
  @labels
end

#last_modifying_userGoogle::Apis::DriveV2::User

Information about a Drive user. Corresponds to the JSON property lastModifyingUser


1354
1355
1356
# File 'generated/google/apis/drive_v2/classes.rb', line 1354

def last_modifying_user
  @last_modifying_user
end

#last_modifying_user_nameString

Name of the last user to modify this file. Corresponds to the JSON property lastModifyingUserName

Returns:

  • (String)

1359
1360
1361
# File 'generated/google/apis/drive_v2/classes.rb', line 1359

def last_modifying_user_name
  @last_modifying_user_name
end

#last_viewed_by_me_dateDateTime

Last time this file was viewed by the user (formatted RFC 3339 timestamp). Corresponds to the JSON property lastViewedByMeDate

Returns:

  • (DateTime)

1364
1365
1366
# File 'generated/google/apis/drive_v2/classes.rb', line 1364

def last_viewed_by_me_date
  @last_viewed_by_me_date
end

#marked_viewed_by_me_dateDateTime

Deprecated. Corresponds to the JSON property markedViewedByMeDate

Returns:

  • (DateTime)

1369
1370
1371
# File 'generated/google/apis/drive_v2/classes.rb', line 1369

def marked_viewed_by_me_date
  @marked_viewed_by_me_date
end

#md5_checksumString

An MD5 checksum for the content of this file. This field is only populated for files with content stored in Drive; it is not populated for Google Docs or shortcut files. Corresponds to the JSON property md5Checksum

Returns:

  • (String)

1376
1377
1378
# File 'generated/google/apis/drive_v2/classes.rb', line 1376

def md5_checksum
  @md5_checksum
end

#mime_typeString

The MIME type of the file. This is only mutable on update when uploading new content. This field can be left blank, and the mimetype will be determined from the uploaded content's MIME type. Corresponds to the JSON property mimeType

Returns:

  • (String)

1383
1384
1385
# File 'generated/google/apis/drive_v2/classes.rb', line 1383

def mime_type
  @mime_type
end

#modified_by_me_dateDateTime

Last time this file was modified by the user (formatted RFC 3339 timestamp). Note that setting modifiedDate will also update the modifiedByMe date for the user which set the date. Corresponds to the JSON property modifiedByMeDate

Returns:

  • (DateTime)

1390
1391
1392
# File 'generated/google/apis/drive_v2/classes.rb', line 1390

def modified_by_me_date
  @modified_by_me_date
end

#modified_dateDateTime

Last time this file was modified by anyone (formatted RFC 3339 timestamp). This is only mutable on update when the setModifiedDate parameter is set. Corresponds to the JSON property modifiedDate

Returns:

  • (DateTime)

1396
1397
1398
# File 'generated/google/apis/drive_v2/classes.rb', line 1396

def modified_date
  @modified_date
end

A map of the id of each of the user's apps to a link to open this file with that app. Only populated when the drive.apps.readonly scope is used. Corresponds to the JSON property openWithLinks

Returns:

  • (Hash<String,String>)

1402
1403
1404
# File 'generated/google/apis/drive_v2/classes.rb', line 1402

def open_with_links
  @open_with_links
end

#original_filenameString

The original filename of the uploaded content if available, or else the original value of the title field. This is only available for files with binary content in Drive. Corresponds to the JSON property originalFilename

Returns:

  • (String)

1409
1410
1411
# File 'generated/google/apis/drive_v2/classes.rb', line 1409

def original_filename
  @original_filename
end

#owned_by_meBoolean Also known as: owned_by_me?

Whether the file is owned by the current user. Corresponds to the JSON property ownedByMe

Returns:

  • (Boolean)

1414
1415
1416
# File 'generated/google/apis/drive_v2/classes.rb', line 1414

def owned_by_me
  @owned_by_me
end

#owner_namesArray<String>

Name(s) of the owner(s) of this file. Corresponds to the JSON property ownerNames

Returns:

  • (Array<String>)

1420
1421
1422
# File 'generated/google/apis/drive_v2/classes.rb', line 1420

def owner_names
  @owner_names
end

#ownersArray<Google::Apis::DriveV2::User>

The owner(s) of this file. Corresponds to the JSON property owners

Returns:


1425
1426
1427
# File 'generated/google/apis/drive_v2/classes.rb', line 1425

def owners
  @owners
end

#parentsArray<Google::Apis::DriveV2::ParentReference>

Collection of parent folders which contain this file. Setting this field will put the file in all of the provided folders. On insert, if no folders are provided, the file will be placed in the default root folder. Corresponds to the JSON property parents


1433
1434
1435
# File 'generated/google/apis/drive_v2/classes.rb', line 1433

def parents
  @parents
end

#permissionsArray<Google::Apis::DriveV2::Permission>

The list of permissions for users with access to this file. Corresponds to the JSON property permissions


1438
1439
1440
# File 'generated/google/apis/drive_v2/classes.rb', line 1438

def permissions
  @permissions
end

#propertiesArray<Google::Apis::DriveV2::Property>

The list of properties. Corresponds to the JSON property properties


1443
1444
1445
# File 'generated/google/apis/drive_v2/classes.rb', line 1443

def properties
  @properties
end

#quota_bytes_usedString

The number of quota bytes used by this file. Corresponds to the JSON property quotaBytesUsed

Returns:

  • (String)

1448
1449
1450
# File 'generated/google/apis/drive_v2/classes.rb', line 1448

def quota_bytes_used
  @quota_bytes_used
end

A link back to this file. Corresponds to the JSON property selfLink

Returns:

  • (String)

1453
1454
1455
# File 'generated/google/apis/drive_v2/classes.rb', line 1453

def self_link
  @self_link
end

#shareableBoolean Also known as: shareable?

Whether the file's sharing settings can be modified by the current user. Corresponds to the JSON property shareable

Returns:

  • (Boolean)

1458
1459
1460
# File 'generated/google/apis/drive_v2/classes.rb', line 1458

def shareable
  @shareable
end

#sharedBoolean Also known as: shared?

Whether the file has been shared. Corresponds to the JSON property shared

Returns:

  • (Boolean)

1464
1465
1466
# File 'generated/google/apis/drive_v2/classes.rb', line 1464

def shared
  @shared
end

#shared_with_me_dateDateTime

Time at which this file was shared with the user (formatted RFC 3339 timestamp) . Corresponds to the JSON property sharedWithMeDate

Returns:

  • (DateTime)

1471
1472
1473
# File 'generated/google/apis/drive_v2/classes.rb', line 1471

def shared_with_me_date
  @shared_with_me_date
end

#sharing_userGoogle::Apis::DriveV2::User

Information about a Drive user. Corresponds to the JSON property sharingUser


1476
1477
1478
# File 'generated/google/apis/drive_v2/classes.rb', line 1476

def sharing_user
  @sharing_user
end

#spacesArray<String>

The list of spaces which contain the file. Supported values are 'drive', ' appDataFolder' and 'photos'. Corresponds to the JSON property spaces

Returns:

  • (Array<String>)

1482
1483
1484
# File 'generated/google/apis/drive_v2/classes.rb', line 1482

def spaces
  @spaces
end

#thumbnailGoogle::Apis::DriveV2::File::Thumbnail

Thumbnail for the file. Only accepted on upload and for files that are not already thumbnailed by Google. Corresponds to the JSON property thumbnail


1488
1489
1490
# File 'generated/google/apis/drive_v2/classes.rb', line 1488

def thumbnail
  @thumbnail
end

A short-lived link to the file's thumbnail. Typically lasts on the order of hours. Corresponds to the JSON property thumbnailLink

Returns:

  • (String)

1494
1495
1496
# File 'generated/google/apis/drive_v2/classes.rb', line 1494

def thumbnail_link
  @thumbnail_link
end

#titleString

The title of this file. Corresponds to the JSON property title

Returns:

  • (String)

1499
1500
1501
# File 'generated/google/apis/drive_v2/classes.rb', line 1499

def title
  @title
end

#user_permissionGoogle::Apis::DriveV2::Permission

A permission for a file. Corresponds to the JSON property userPermission


1504
1505
1506
# File 'generated/google/apis/drive_v2/classes.rb', line 1504

def user_permission
  @user_permission
end

#versionString

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 requesting user. Corresponds to the JSON property version

Returns:

  • (String)

1511
1512
1513
# File 'generated/google/apis/drive_v2/classes.rb', line 1511

def version
  @version
end

#video_media_metadataGoogle::Apis::DriveV2::File::VideoMediaMetadata

Metadata about video media. This will only be present for video types. Corresponds to the JSON property videoMediaMetadata


1516
1517
1518
# File 'generated/google/apis/drive_v2/classes.rb', line 1516

def 
  @video_media_metadata
end

A link for downloading the content of the file in a browser using cookie based authentication. In cases where the content is shared publicly, the content can be downloaded without any credentials. Corresponds to the JSON property webContentLink

Returns:

  • (String)

1523
1524
1525
# File 'generated/google/apis/drive_v2/classes.rb', line 1523

def web_content_link
  @web_content_link
end

A link only available on public folders for viewing their static web assets ( HTML, CSS, JS, etc) via Google Drive's Website Hosting. Corresponds to the JSON property webViewLink

Returns:

  • (String)

1529
1530
1531
# File 'generated/google/apis/drive_v2/classes.rb', line 1529

def web_view_link
  @web_view_link
end

#writers_can_shareBoolean Also known as: writers_can_share?

Whether writers can share the document with other users. Corresponds to the JSON property writersCanShare

Returns:

  • (Boolean)

1534
1535
1536
# File 'generated/google/apis/drive_v2/classes.rb', line 1534

def writers_can_share
  @writers_can_share
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object


1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
# File 'generated/google/apis/drive_v2/classes.rb', line 1542

def update!(**args)
  @alternate_link = args[:alternate_link] if args.key?(:alternate_link)
  @app_data_contents = args[:app_data_contents] if args.key?(:app_data_contents)
  @can_comment = args[:can_comment] if args.key?(:can_comment)
  @can_read_revisions = args[:can_read_revisions] if args.key?(:can_read_revisions)
  @copyable = args[:copyable] if args.key?(:copyable)
  @created_date = args[:created_date] if args.key?(:created_date)
  @default_open_with_link = args[:default_open_with_link] if args.key?(:default_open_with_link)
  @description = args[:description] if args.key?(:description)
  @download_url = args[:download_url] if args.key?(:download_url)
  @editable = args[:editable] if args.key?(:editable)
  @embed_link = args[:embed_link] if args.key?(:embed_link)
  @etag = args[:etag] if args.key?(:etag)
  @explicitly_trashed = args[:explicitly_trashed] if args.key?(:explicitly_trashed)
  @export_links = args[:export_links] if args.key?(:export_links)
  @file_extension = args[:file_extension] if args.key?(:file_extension)
  @file_size = args[:file_size] if args.key?(:file_size)
  @folder_color_rgb = args[:folder_color_rgb] if args.key?(:folder_color_rgb)
  @full_file_extension = args[:full_file_extension] if args.key?(:full_file_extension)
  @head_revision_id = args[:head_revision_id] if args.key?(:head_revision_id)
  @icon_link = args[:icon_link] if args.key?(:icon_link)
  @id = args[:id] if args.key?(:id)
  @image_media_metadata = args[:image_media_metadata] if args.key?(:image_media_metadata)
  @indexable_text = args[:indexable_text] if args.key?(:indexable_text)
  @is_app_authorized = args[:is_app_authorized] if args.key?(:is_app_authorized)
  @kind = args[:kind] if args.key?(:kind)
  @labels = args[:labels] if args.key?(:labels)
  @last_modifying_user = args[:last_modifying_user] if args.key?(:last_modifying_user)
  @last_modifying_user_name = args[:last_modifying_user_name] if args.key?(:last_modifying_user_name)
  @last_viewed_by_me_date = args[:last_viewed_by_me_date] if args.key?(:last_viewed_by_me_date)
  @marked_viewed_by_me_date = args[:marked_viewed_by_me_date] if args.key?(:marked_viewed_by_me_date)
  @md5_checksum = args[:md5_checksum] if args.key?(:md5_checksum)
  @mime_type = args[:mime_type] if args.key?(:mime_type)
  @modified_by_me_date = args[:modified_by_me_date] if args.key?(:modified_by_me_date)
  @modified_date = args[:modified_date] if args.key?(:modified_date)
  @open_with_links = args[:open_with_links] if args.key?(:open_with_links)
  @original_filename = args[:original_filename] if args.key?(:original_filename)
  @owned_by_me = args[:owned_by_me] if args.key?(:owned_by_me)
  @owner_names = args[:owner_names] if args.key?(:owner_names)
  @owners = args[:owners] if args.key?(:owners)
  @parents = args[:parents] if args.key?(:parents)
  @permissions = args[:permissions] if args.key?(:permissions)
  @properties = args[:properties] if args.key?(:properties)
  @quota_bytes_used = args[:quota_bytes_used] if args.key?(:quota_bytes_used)
  @self_link = args[:self_link] if args.key?(:self_link)
  @shareable = args[:shareable] if args.key?(:shareable)
  @shared = args[:shared] if args.key?(:shared)
  @shared_with_me_date = args[:shared_with_me_date] if args.key?(:shared_with_me_date)
  @sharing_user = args[:sharing_user] if args.key?(:sharing_user)
  @spaces = args[:spaces] if args.key?(:spaces)
  @thumbnail = args[:thumbnail] if args.key?(:thumbnail)
  @thumbnail_link = args[:thumbnail_link] if args.key?(:thumbnail_link)
  @title = args[:title] if args.key?(:title)
  @user_permission = args[:user_permission] if args.key?(:user_permission)
  @version = args[:version] if args.key?(:version)
  @video_media_metadata = args[:video_media_metadata] if args.key?(:video_media_metadata)
  @web_content_link = args[:web_content_link] if args.key?(:web_content_link)
  @web_view_link = args[:web_view_link] if args.key?(:web_view_link)
  @writers_can_share = args[:writers_can_share] if args.key?(:writers_can_share)
end