google_drive 2.1.8 → 2.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a307d368da1d8c3aaddcc80fce8e3ab842e31fbc
4
- data.tar.gz: f638dfeb91a08128bfca2e547973efd2b1172a42
3
+ metadata.gz: 865c482b6edbfefd86f4a5e9658b9487e70b99c6
4
+ data.tar.gz: da516192ff4de976a61327eaa61602dc1df51dd5
5
5
  SHA512:
6
- metadata.gz: f6ead9f1d7cedf6efedd25b88b0d36d8599c63824ed616d3401eebaf9d0431c29e4d41ef6e4ec1cfa1754de76dc47c23754946c17334bcd264929e37ffd1e40a
7
- data.tar.gz: 56a2e06379ea4a54efbc2c2ac53d65c1f93b89ab7036f6989ce79b143c45b3d43dee68d1fe9d9102b1133a5aab82f94d6d1ce8332475eafd2e2b55c65be4e87b
6
+ metadata.gz: a31cb6ce83639300b5e182b36146dbb4132ce182cd520a44dd1474f105d81e54eeb9cea4522b7b205a57c7530eefcb2e9c872a0766e1aa021232d72cd15c9c0d
7
+ data.tar.gz: 81986aea9ec0ebd102808fa49c82ae9910ea9bb31b9e7c135e34eb66a1218222a5a09071254a1606839cfd013edfe432dd5f82ec1a00429289d198f84df1cf2b
@@ -18,13 +18,18 @@ module GoogleDrive
18
18
  config = ENV['HOME'] + '/.ruby_google_drive.token',
19
19
  proxy = nil,
20
20
  client_id = nil,
21
- client_secret = nil)
21
+ client_secret = nil
22
+ )
22
23
  if proxy
23
- fail(
24
+ raise(
24
25
  ArgumentError,
25
- 'Specifying a proxy object is no longer supported. Set ENV["http_proxy"] instead.')
26
+ 'Specifying a proxy object is no longer supported. ' \
27
+ 'Set ENV["http_proxy"] instead.'
28
+ )
26
29
  end
27
30
 
28
- Session.from_config(config, client_id: client_id, client_secret: client_secret)
31
+ Session.from_config(
32
+ config, client_id: client_id, client_secret: client_secret
33
+ )
29
34
  end
30
35
  end
@@ -21,14 +21,15 @@ module GoogleDrive
21
21
  @session = session
22
22
  @file = file
23
23
  api_permissions = @session.drive.list_permissions(@file.id, fields: '*')
24
- @entries = api_permissions.permissions.map { |perm| AclEntry.new(perm, self) }
24
+ @entries =
25
+ api_permissions.permissions.map { |perm| AclEntry.new(perm, self) }
25
26
  end
26
27
 
27
28
  def_delegators(:@entries, :size, :[], :each)
28
29
 
29
- # Adds a new entry. +entry+ is either a GoogleDrive::AclEntry or a Hash with keys
30
- # +:type+, +:email_address+, +:domain+, +:role+ and +:allow_file_discovery+.
31
- # See GoogleDrive::AclEntry#type and
30
+ # Adds a new entry. +entry+ is either a GoogleDrive::AclEntry or a Hash with
31
+ # keys +:type+, +:email_address+, +:domain+, +:role+ and
32
+ # +:allow_file_discovery+. See GoogleDrive::AclEntry#type and
32
33
  # GoogleDrive::AclEntry#role for the document of the fields.
33
34
  #
34
35
  # Also you can pass the second hash argument +options+, which specifies
@@ -37,9 +38,9 @@ module GoogleDrive
37
38
  # * :email_message -- A custom message to include in notification emails
38
39
  # * :send_notification_email -- Whether to send notification emails
39
40
  # when sharing to users or groups. (Default: true)
40
- # * :transfer_ownership -- Whether to transfer ownership to the specified user
41
- # and downgrade the current owner to a writer. This parameter is required as an
42
- # acknowledgement of the side effect. (Default: false)
41
+ # * :transfer_ownership -- Whether to transfer ownership to the specified
42
+ # user and downgrade the current owner to a writer. This parameter is
43
+ # required as an acknowledgement of the side effect. (Default: false)
43
44
  #
44
45
  # e.g.
45
46
  # # A specific user can read or write.
@@ -64,8 +65,11 @@ module GoogleDrive
64
65
  # See here for parameter detais:
65
66
  # https://developers.google.com/drive/v3/reference/permissions/create
66
67
  def push(params_or_entry, options = {})
67
- entry = params_or_entry.is_a?(AclEntry) ? params_or_entry : AclEntry.new(params_or_entry)
68
- api_permission = @session.drive.create_permission(@file.id, entry.params, {fields: '*'}.merge(options))
68
+ entry = params_or_entry.is_a?(AclEntry) ?
69
+ params_or_entry : AclEntry.new(params_or_entry)
70
+ api_permission = @session.drive.create_permission(
71
+ @file.id, entry.params, { fields: '*' }.merge(options)
72
+ )
69
73
  new_entry = AclEntry.new(api_permission, self)
70
74
  @entries.push(new_entry)
71
75
  new_entry
@@ -83,13 +87,14 @@ module GoogleDrive
83
87
  # @api private
84
88
  def update_role(entry)
85
89
  api_permission = @session.drive.update_permission(
86
- @file.id, entry.id, {role: entry.role}, fields: '*')
90
+ @file.id, entry.id, { role: entry.role }, fields: '*'
91
+ )
87
92
  entry.api_permission = api_permission
88
93
  entry
89
94
  end
90
95
 
91
96
  def inspect
92
- "\#<%p %p>" % [self.class, @entries]
97
+ format("\#<%p %p>", self.class, @entries)
93
98
  end
94
99
  end
95
100
  end
@@ -54,7 +54,7 @@ module GoogleDrive
54
54
  @params ? @params[:type] : @api_permission.type
55
55
  end
56
56
 
57
- alias_method :scope_type, :type
57
+ alias scope_type type
58
58
 
59
59
  def additional_roles
60
60
  @params ? @params[:additionalRoles] : @api_permission.additional_roles
@@ -81,8 +81,6 @@ module GoogleDrive
81
81
  @params[:email_address]
82
82
  when 'domain'
83
83
  @params[:domain]
84
- else
85
- nil
86
84
  end
87
85
  else
88
86
  case @api_permission.type
@@ -90,18 +88,17 @@ module GoogleDrive
90
88
  @api_permission.email_address
91
89
  when 'domain'
92
90
  @api_permission.domain
93
- else
94
- nil
95
91
  end
96
92
  end
97
93
  end
98
94
 
99
- alias_method :scope, :value
95
+ alias scope value
100
96
 
101
97
  # If +false+, the file is shared only with people who know the link.
102
98
  # Only used for type "anyone".
103
99
  def allow_file_discovery
104
- @params ? @params[:allow_file_discovery] : @api_permission.allow_file_discovery
100
+ @params ?
101
+ @params[:allow_file_discovery] : @api_permission.allow_file_discovery
105
102
  end
106
103
 
107
104
  # If +true+, the file is shared only with people who know the link.
@@ -110,7 +107,7 @@ module GoogleDrive
110
107
  allow_file_discovery == false
111
108
  end
112
109
 
113
- alias_method :with_key, :with_link
110
+ alias with_key with_link
114
111
 
115
112
  # Changes the role of the scope.
116
113
  #
@@ -128,17 +125,22 @@ module GoogleDrive
128
125
  def inspect
129
126
  case type
130
127
  when 'user', 'group'
131
- "\#<%p type=%p, email_address=%p, role=%p>" %
132
- [self.class, type, email_address, role]
128
+ format(
129
+ "\#<%p type=%p, email_address=%p, role=%p>",
130
+ self.class, type, email_address, role
131
+ )
133
132
  when 'domain'
134
- "\#<%p type=%p, domain=%p, role=%p>" %
135
- [self.class, type, domain, role]
133
+ format(
134
+ "\#<%p type=%p, domain=%p, role=%p>",
135
+ self.class, type, domain, role
136
+ )
136
137
  when 'anyone'
137
- "\#<%p type=%p, role=%p, allow_file_discovery=%p>" %
138
- [self.class, type, role, allow_file_discovery]
138
+ format(
139
+ "\#<%p type=%p, role=%p, allow_file_discovery=%p>",
140
+ self.class, type, role, allow_file_discovery
141
+ )
139
142
  else
140
- "\#<%p type=%p, role=%p>" %
141
- [self.class, type, role]
143
+ format("\#<%p type=%p, role=%p>", self.class, type, role)
142
144
  end
143
145
  end
144
146
 
@@ -21,10 +21,10 @@ module GoogleDrive
21
21
  @drive = Google::Apis::DriveV3::DriveService.new
22
22
  @drive.authorization = authorization
23
23
 
24
- # Make the timeout virtually infinite because some of the operations (e.g., uploading a large file)
25
- # can take very long.
24
+ # Make the timeout virtually infinite because some of the operations
25
+ # (e.g., uploading a large file) can take very long.
26
26
  # This value is the maximal allowed timeout in seconds on JRuby.
27
- t = (2 ** 31 - 1) / 1000
27
+ t = (2**31 - 1) / 1000
28
28
  @drive.client_options.open_timeout_sec = t
29
29
  @drive.client_options.read_timeout_sec = t
30
30
  @drive.client_options.send_timeout_sec = t
@@ -8,8 +8,10 @@ require 'google_drive/spreadsheet'
8
8
  module GoogleDrive
9
9
  # Represents a folder in Google Drive.
10
10
  #
11
- # Use GoogleDrive::Session#root_collection, GoogleDrive::Collection#subcollections,
12
- # or GoogleDrive::Session#collection_by_url to get GoogleDrive::Collection object.
11
+ # Use GoogleDrive::Session#root_collection,
12
+ # GoogleDrive::Collection#subcollections,
13
+ # or GoogleDrive::Session#collection_by_url to get GoogleDrive::Collection
14
+ # object.
13
15
  class Collection < GoogleDrive::File
14
16
  include(Util)
15
17
 
@@ -17,26 +19,33 @@ module GoogleDrive
17
19
 
18
20
  # Adds the given GoogleDrive::File to the folder.
19
21
  def add(file)
20
- @session.drive.update_file(file.id, add_parents: self.id, fields: '', supports_team_drives: true)
22
+ @session.drive.update_file(
23
+ file.id, add_parents: id, fields: '', supports_team_drives: true
24
+ )
21
25
  nil
22
26
  end
23
27
 
24
28
  # Removes the given GoogleDrive::File from the folder.
25
29
  def remove(file)
26
- @session.drive.update_file(file.id, remove_parents: self.id, fields: '', supports_team_drives: true)
30
+ @session.drive.update_file(
31
+ file.id, remove_parents: id, fields: '', supports_team_drives: true
32
+ )
27
33
  end
28
34
 
29
- # Creates a sub-folder with given title. Returns GoogleDrive::Collection object.
35
+ # Creates a sub-folder with given title. Returns GoogleDrive::Collection
36
+ # object.
30
37
  def create_subcollection(title)
31
38
  file_metadata = {
32
39
  name: title,
33
40
  mime_type: 'application/vnd.google-apps.folder',
34
- parents: [self.id],
41
+ parents: [id]
35
42
  }
36
- file = @session.drive.create_file(file_metadata, fields: '*', supports_team_drives: true)
43
+ file = @session.drive.create_file(
44
+ file_metadata, fields: '*', supports_team_drives: true
45
+ )
37
46
  @session.wrap_api_file(file)
38
47
  end
39
-
48
+
40
49
  alias create_subfolder create_subcollection
41
50
 
42
51
  # Returns true if this is a root folder.
@@ -44,8 +53,8 @@ module GoogleDrive
44
53
  !api_file.parents || api_file.parents.empty?
45
54
  end
46
55
 
47
- # Returns all the files (including spreadsheets, documents, subfolders) in the folder.
48
- # You can specify parameters documented at
56
+ # Returns all the files (including spreadsheets, documents, subfolders) in
57
+ # the folder. You can specify parameters documented at
49
58
  # https://developers.google.com/drive/v3/web/search-parameters
50
59
  #
51
60
  # e.g.
@@ -59,73 +68,74 @@ module GoogleDrive
59
68
  # # Same as above with a placeholder.
60
69
  # collection.files(q: ["name = ?", "hoge"])
61
70
  #
62
- # By default, it returns the first 100 files. See document of GoogleDrive::Session#files method
63
- # for how to get all files.
71
+ # By default, it returns the first 100 files. See document of
72
+ # GoogleDrive::Session#files method for how to get all files.
64
73
  def files(params = {}, &block)
65
74
  files_with_type(nil, params, &block)
66
75
  end
67
76
 
68
77
  # Uploads a file to this folder. See Session#upload_from_file for details.
69
78
  def upload_from_file(path, title = nil, params = {})
70
- params = {parents: [self.id]}.merge(params)
79
+ params = { parents: [id] }.merge(params)
71
80
  @session.upload_from_file(path, title, params)
72
81
  end
73
82
 
74
83
  # Uploads a file to this folder. See Session#upload_from_io for details.
75
84
  def upload_from_io(io, title = 'Untitled', params = {})
76
- params = {parents: [self.id]}.merge(params)
85
+ params = { parents: [id] }.merge(params)
77
86
  @session.upload_from_io(io, title, params)
78
87
  end
79
88
 
80
89
  # Uploads a file to this folder. See Session#upload_from_string for details.
81
90
  def upload_from_string(content, title = 'Untitled', params = {})
82
- params = {parents: [self.id]}.merge(params)
91
+ params = { parents: [id] }.merge(params)
83
92
  @session.upload_from_string(content, title, params)
84
93
  end
85
94
 
86
- alias_method :contents, :files
95
+ alias contents files
87
96
 
88
97
  # Returns all the spreadsheets in the folder.
89
98
  #
90
- # By default, it returns the first 100 spreadsheets. See document of GoogleDrive::Session#files method
91
- # for how to get all spreadsheets.
99
+ # By default, it returns the first 100 spreadsheets. See document of
100
+ # GoogleDrive::Session#files method for how to get all spreadsheets.
92
101
  def spreadsheets(params = {}, &block)
93
102
  files_with_type('application/vnd.google-apps.spreadsheet', params, &block)
94
103
  end
95
104
 
96
105
  # Returns all the Google Docs documents in the folder.
97
106
  #
98
- # By default, it returns the first 100 documents. See document of GoogleDrive::Session#files method
99
- # for how to get all documents.
107
+ # By default, it returns the first 100 documents. See document of
108
+ # GoogleDrive::Session#files method for how to get all documents.
100
109
  def documents(params = {}, &block)
101
110
  files_with_type('application/vnd.google-apps.document', params, &block)
102
111
  end
103
112
 
104
113
  # Returns all its subfolders.
105
114
  #
106
- # By default, it returns the first 100 subfolders. See document of GoogleDrive::Session#files method
107
- # for how to get all subfolders.
115
+ # By default, it returns the first 100 subfolders. See document of
116
+ # GoogleDrive::Session#files method for how to get all subfolders.
108
117
  def subcollections(params = {}, &block)
109
118
  files_with_type('application/vnd.google-apps.folder', params, &block)
110
119
  end
111
-
120
+
112
121
  alias subfolders subcollections
113
122
 
114
- # Returns a file (can be a spreadsheet, document, subfolder or other files) in the
115
- # folder which exactly matches +title+ as GoogleDrive::File.
116
- # Returns nil if not found. If multiple folders with the +title+ are found, returns
117
- # one of them.
123
+ # Returns a file (can be a spreadsheet, document, subfolder or other files)
124
+ # in the folder which exactly matches +title+ as GoogleDrive::File.
125
+ # Returns nil if not found. If multiple folders with the +title+ are found,
126
+ # returns one of them.
118
127
  #
119
128
  # If given an Array, does a recursive subfolder traversal.
120
129
  def file_by_title(title)
121
130
  file_by_title_with_type(title, nil)
122
131
  end
123
-
132
+
124
133
  alias file_by_name file_by_title
125
134
 
126
- # Returns its subfolder whose title exactly matches +title+ as GoogleDrive::Collection.
127
- # Returns nil if not found. If multiple folders with the +title+ are found, returns
128
- # one of them.
135
+ # Returns its subfolder whose title exactly matches +title+ as
136
+ # GoogleDrive::Collection.
137
+ # Returns nil if not found. If multiple folders with the +title+ are found,
138
+ # returns one of them.
129
139
  #
130
140
  # If given an Array, does a recursive subfolder traversal.
131
141
  def subcollection_by_title(title)
@@ -133,7 +143,7 @@ module GoogleDrive
133
143
  end
134
144
 
135
145
  alias subfolder_by_name subcollection_by_title
136
-
146
+
137
147
  # Returns URL of the deprecated contents feed.
138
148
  def contents_url
139
149
  document_feed_url + '/contents'
@@ -154,7 +164,7 @@ module GoogleDrive
154
164
  files_with_type(type, q: ['name = ?', title], page_size: 1)[0]
155
165
  end
156
166
  end
157
-
167
+
158
168
  alias file_by_name_with_type file_by_title_with_type
159
169
 
160
170
  private
@@ -162,15 +172,16 @@ module GoogleDrive
162
172
  def files_with_type(type, params = {}, &block)
163
173
  params = convert_params(params)
164
174
  query = construct_and_query([
165
- ['? in parents', id],
166
- type ? ['mimeType = ?', type] : nil,
167
- params[:q]
168
- ])
175
+ ['? in parents', id],
176
+ type ? ['mimeType = ?', type] : nil,
177
+ params[:q]
178
+ ])
169
179
  params = params.merge(q: query)
170
- # This is faster than calling children.list and then files.get for each file.
180
+ # This is faster than calling children.list and then files.get for each
181
+ # file.
171
182
  @session.files(params, &block)
172
183
  end
173
184
  end
174
-
185
+
175
186
  Folder = Collection
176
187
  end
@@ -6,7 +6,7 @@ require 'json'
6
6
  module GoogleDrive
7
7
  # @api private
8
8
  class Config
9
- FIELDS = %w(client_id client_secret scope refresh_token type).freeze
9
+ FIELDS = %w[client_id client_secret scope refresh_token type].freeze
10
10
  attr_accessor(*FIELDS)
11
11
 
12
12
  def initialize(config_path)
@@ -19,7 +19,7 @@ module GoogleDrive
19
19
  end
20
20
 
21
21
  def save
22
- ::File.open(@config_path, 'w', 0600) { |f| f.write(to_json) }
22
+ ::File.open(@config_path, 'w', 0o600) { |f| f.write(to_json) }
23
23
  end
24
24
 
25
25
  private
@@ -9,12 +9,14 @@ require 'google_drive/util'
9
9
  require 'google_drive/acl'
10
10
 
11
11
  module GoogleDrive
12
- # A file in Google Drive, including Google Docs document/spreadsheet/presentation.
12
+ # A file in Google Drive, including a Google Docs
13
+ # document/spreadsheet/presentation and a folder.
13
14
  #
14
15
  # Use GoogleDrive::Session#files or GoogleDrive::Session#file_by_title to
15
16
  # get this object.
16
17
  #
17
- # In addition to the methods below, properties defined here are also available as attributes:
18
+ # In addition to the methods below, properties defined here are also available
19
+ # as attributes:
18
20
  # https://developers.google.com/drive/v3/reference/files#resource
19
21
  #
20
22
  # e.g.,
@@ -36,18 +38,21 @@ module GoogleDrive
36
38
 
37
39
  # Reloads file metadata such as title and acl.
38
40
  def reload_metadata
39
- @api_file = @session.drive.get_file(id, fields: '*', supports_team_drives: true)
41
+ @api_file = @session.drive.get_file(
42
+ id, fields: '*', supports_team_drives: true
43
+ )
40
44
  @acl = Acl.new(@session, self) if @acl
41
45
  end
42
46
 
43
47
  # Returns resource_type + ":" + id.
44
48
  def resource_id
45
- '%s:%s' % [resource_type, id]
49
+ format('%s:%s', resource_type, id)
46
50
  end
47
51
 
48
52
  # URL of feed used in the deprecated document list feed API.
49
53
  def document_feed_url
50
- 'https://docs.google.com/feeds/default/private/full/' + CGI.escape(resource_id)
54
+ 'https://docs.google.com/feeds/default/private/full/' +
55
+ CGI.escape(resource_id)
51
56
  end
52
57
 
53
58
  # Deprecated ACL feed URL of the file.
@@ -65,7 +70,7 @@ module GoogleDrive
65
70
  reload_metadata if params[:reload]
66
71
  api_file.name
67
72
  end
68
-
73
+
69
74
  alias name title
70
75
 
71
76
  # URL to view/edit the file in a Web browser.
@@ -75,11 +80,11 @@ module GoogleDrive
75
80
  api_file.web_view_link
76
81
  end
77
82
 
78
- # Content types you can specify in methods download_to_file, download_to_string,
79
- # download_to_io .
83
+ # Content types you can specify in methods download_to_file,
84
+ # download_to_string, download_to_io.
80
85
  #
81
- # This returns zero or one file type. You may be able to download the file in other formats using
82
- # export_as_file, export_as_string, or export_to_io.
86
+ # This returns zero or one file type. You may be able to download the file
87
+ # in other formats using export_as_file, export_as_string, or export_to_io.
83
88
  def available_content_types
84
89
  api_file.web_content_link ? [api_file.mime_type] : []
85
90
  end
@@ -90,8 +95,9 @@ module GoogleDrive
90
95
  # To export the file in other formats, use export_as_file.
91
96
  def download_to_file(path, params = {})
92
97
  @session.drive.get_file(
93
- id,
94
- {download_dest: path, supports_team_drives: true}.merge(params))
98
+ id,
99
+ { download_dest: path, supports_team_drives: true }.merge(params)
100
+ )
95
101
  end
96
102
 
97
103
  # Downloads the file and returns as a String.
@@ -108,8 +114,9 @@ module GoogleDrive
108
114
  # To export the file in other formats, use export_to_io.
109
115
  def download_to_io(io, params = {})
110
116
  @session.drive.get_file(
111
- id,
112
- {download_dest: io, supports_team_drives: true}.merge(params))
117
+ id,
118
+ { download_dest: io, supports_team_drives: true }.merge(params)
119
+ )
113
120
  end
114
121
 
115
122
  # Export the file to +path+ in content type +format+.
@@ -119,15 +126,15 @@ module GoogleDrive
119
126
  # spreadsheet.export_as_file("/path/to/hoge.csv")
120
127
  # spreadsheet.export_as_file("/path/to/hoge", "text/csv")
121
128
  #
122
- # If you want to download the file in the original format, use download_to_file instead.
129
+ # If you want to download the file in the original format,
130
+ # use download_to_file instead.
123
131
  def export_as_file(path, format = nil)
124
132
  unless format
125
133
  format = EXT_TO_CONTENT_TYPE[::File.extname(path).downcase]
126
134
  unless format
127
- fail(ArgumentError,
128
- ("Cannot guess format from the file name: %s\n" \
129
- 'Specify format argument explicitly.') %
130
- path)
135
+ raise(ArgumentError,
136
+ format("Cannot guess format from the file name: %s\n" \
137
+ 'Specify format argument explicitly.', path))
131
138
  end
132
139
  end
133
140
  export_to_dest(path, format)
@@ -138,7 +145,8 @@ module GoogleDrive
138
145
  # e.g.,
139
146
  # spreadsheet.export_as_string("text/csv")
140
147
  #
141
- # If you want to download the file in the original format, use download_to_string instead.
148
+ # If you want to download the file in the original format, use
149
+ # download_to_string instead.
142
150
  def export_as_string(format)
143
151
  sio = StringIO.new
144
152
  export_to_dest(sio, format)
@@ -147,7 +155,8 @@ module GoogleDrive
147
155
 
148
156
  # Export the file to +io+ in content type +format+.
149
157
  #
150
- # If you want to download the file in the original format, use download_to_io instead.
158
+ # If you want to download the file in the original format, use
159
+ # download_to_io instead.
151
160
  def export_to_io(io, format)
152
161
  export_to_dest(io, format)
153
162
  end
@@ -165,7 +174,8 @@ module GoogleDrive
165
174
  # e.g.
166
175
  # file.update_from_file("/path/to/hoge.txt")
167
176
  def update_from_file(path, params = {})
168
- # Somehow it doesn't work if I specify the file name directly as upload_source.
177
+ # Somehow it doesn't work if I specify the file name directly as
178
+ # upload_source.
169
179
  open(path, 'rb') do |f|
170
180
  update_from_io(f, params)
171
181
  end
@@ -196,7 +206,7 @@ module GoogleDrive
196
206
  nil
197
207
  end
198
208
 
199
- alias_method :title=, :rename
209
+ alias title= rename
200
210
 
201
211
  # Creates copy of this file with the given title.
202
212
  def copy(title)
@@ -204,7 +214,7 @@ module GoogleDrive
204
214
  @session.wrap_api_file(api_file)
205
215
  end
206
216
 
207
- alias_method :duplicate, :copy
217
+ alias duplicate copy
208
218
 
209
219
  # Returns GoogleDrive::Acl object for the file.
210
220
  #
@@ -236,7 +246,7 @@ module GoogleDrive
236
246
  end
237
247
 
238
248
  def inspect
239
- "\#<%p id=%p title=%p>" % [self.class, id, title]
249
+ format("\#<%p id=%p title=%p>", self.class, id, title)
240
250
  end
241
251
 
242
252
  private