gcloud 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,46 @@
1
+ #--
2
+ # Copyright 2015 Google Inc. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ module Gcloud
17
+ module Pubsub
18
+ class Topic
19
+ ##
20
+ # Topic::List is a special case Array with additional values.
21
+ class List < DelegateClass(::Array)
22
+ ##
23
+ # If not empty, indicates that there are more topics
24
+ # that match the request and this value should be passed to
25
+ # the next Gcloud::PubSub::Project#topics to continue.
26
+ attr_accessor :token
27
+
28
+ ##
29
+ # Create a new Topic::List with an array of values.
30
+ def initialize arr = [], token = nil
31
+ super arr
32
+ @token = token
33
+ end
34
+
35
+ ##
36
+ # New Topic::List from a response object.
37
+ def self.from_resp resp, conn #:nodoc:
38
+ topics = Array(resp.data["topics"]).map do |gapi_object|
39
+ Topic.from_gapi gapi_object, conn
40
+ end
41
+ new topics, resp.data["nextPageToken"]
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -38,13 +38,13 @@ module Gcloud
38
38
  #
39
39
  # === Example
40
40
  #
41
- # require "glcoud/storage"
41
+ # require "gcloud/storage"
42
42
  #
43
43
  # storage = Gcloud.storage "my-todo-project",
44
44
  # "/path/to/keyfile.json"
45
45
  #
46
- # bucket = storage.find_bucket "my-bucket"
47
- # file = bucket.find_file "path/to/my-file.ext"
46
+ # bucket = storage.bucket "my-bucket"
47
+ # file = bucket.file "path/to/my-file.ext"
48
48
  #
49
49
  def self.storage project = nil, keyfile = nil
50
50
  project ||= Gcloud::Storage::Project.default_project
@@ -65,23 +65,24 @@ module Gcloud
65
65
  # infrastructure to perform data operations in a cost effective manner.
66
66
  #
67
67
  # Gcloud's goal is to provide a API that is familiar and comfortable to
68
- # Rubyists. Authentication is handled by Gcloud.storage. You can provide the
68
+ # Rubyists. Authentication is handled by Gcloud#storage. You can provide the
69
69
  # project and credential information to connect to the Storage service, or if
70
70
  # you are running on Google Compute Engine this configuration is taken care
71
71
  # of for you.
72
72
  #
73
- # require "glcoud/storage"
73
+ # require "gcloud"
74
74
  #
75
- # storage = Gcloud.storage "my-todo-project",
76
- # "/path/to/keyfile.json"
75
+ # gcloud = Gcloud.new "my-todo-project",
76
+ # "/path/to/keyfile.json"
77
+ # storage = gcloud.storage
77
78
  #
78
- # bucket = storage.find_bucket "my-bucket"
79
- # file = bucket.find_file "path/to/my-file.ext"
79
+ # bucket = storage.bucket "my-bucket"
80
+ # file = bucket.file "path/to/my-file.ext"
80
81
  #
81
82
  # You can learn more about various options for connection on the
82
83
  # {Authentication Guide}[link:AUTHENTICATION.md].
83
84
  #
84
- # To learn more about Datastore, read the
85
+ # To learn more about Cloud Storage, read the
85
86
  # {Google Cloud Storage Overview
86
87
  # }[https://cloud.google.com/storage/docs/overview].
87
88
  #
@@ -90,28 +91,31 @@ module Gcloud
90
91
  # A Bucket is the container for your data. There is no limit on the number of
91
92
  # buckets that you can create in a project. You can use buckets to organize
92
93
  # and control access to your data. Each bucket has a unique name, which is how
93
- # they are retrieved: (See Project#find_bucket)
94
+ # they are retrieved: (See Project#bucket)
94
95
  #
95
- # require "gcloud/storage"
96
+ # require "gcloud"
96
97
  #
97
- # storage = Gcloud.storage
98
+ # gcloud = Gcloud.new
99
+ # storage = gcloud.storage
98
100
  #
99
- # bucket = storage.find_bucket "my-todo-app"
101
+ # bucket = storage.bucket "my-todo-app"
100
102
  #
101
103
  # You can also retrieve all buckets on a project: (See Project#buckets)
102
104
  #
103
- # require "gcloud/storage"
105
+ # require "gcloud"
104
106
  #
105
- # storage = Gcloud.storage
107
+ # gcloud = Gcloud.new
108
+ # storage = gcloud.storage
106
109
  #
107
110
  # all_buckets = storage.buckets
108
111
  #
109
112
  # If you have a significant number of buckets, you may need to paginate
110
113
  # through them: (See Bucket::List#token)
111
114
  #
112
- # require "gcloud/storage"
115
+ # require "gcloud"
113
116
  #
114
- # storage = Gcloud.storage
117
+ # gcloud = Gcloud.new
118
+ # storage = gcloud.storage
115
119
  #
116
120
  # all_buckets = []
117
121
  # tmp_buckets = storage.buckets
@@ -130,9 +134,10 @@ module Gcloud
130
134
  # A unique name is all that is needed to create a new bucket:
131
135
  # (See Project#create_bucket)
132
136
  #
133
- # require "gcloud/storage"
137
+ # require "gcloud"
134
138
  #
135
- # storage = Gcloud.storage
139
+ # gcloud = Gcloud.new
140
+ # storage = gcloud.storage
136
141
  #
137
142
  # bucket = storage.create_bucket "my-todo-app-attachments"
138
143
  #
@@ -144,41 +149,45 @@ module Gcloud
144
149
  # no limit on the number of objects that you can create in a bucket.
145
150
  #
146
151
  # Files are retrieved by their name, which is the path of the file in the
147
- # bucket: (See Bucket#find_file)
152
+ # bucket: (See Bucket#file)
148
153
  #
149
- # require "gcloud/storage"
154
+ # require "gcloud"
150
155
  #
151
- # storage = Gcloud.storage
156
+ # gcloud = Gcloud.new
157
+ # storage = gcloud.storage
152
158
  #
153
- # bucket = storage.find_bucket "my-todo-app"
154
- # file = bucket.find_file "avatars/heidi/400x400.png"
159
+ # bucket = storage.bucket "my-todo-app"
160
+ # file = bucket.file "avatars/heidi/400x400.png"
155
161
  #
156
162
  # You can also retrieve all files in a bucket: (See Bucket#files)
157
163
  #
158
- # require "gcloud/storage"
164
+ # require "gcloud"
159
165
  #
160
- # storage = Gcloud.storage
166
+ # gcloud = Gcloud.new
167
+ # storage = gcloud.storage
161
168
  #
162
- # bucket = storage.find_bucket "my-todo-app"
169
+ # bucket = storage.bucket "my-todo-app"
163
170
  # all_files = bucket.files
164
171
  #
165
172
  # Or you can retrieve all files in a specified path:
166
173
  #
167
- # require "gcloud/storage"
174
+ # require "gcloud"
168
175
  #
169
- # storage = Gcloud.storage
176
+ # gcloud = Gcloud.new
177
+ # storage = gcloud.storage
170
178
  #
171
- # bucket = storage.find_bucket "my-todo-app"
179
+ # bucket = storage.bucket "my-todo-app"
172
180
  # avatar_files = bucket.files prefix: "avatars/"
173
181
  #
174
182
  # If you have a significant number of files, you may need to paginate through
175
183
  # them: (See File::List#token)
176
184
  #
177
- # require "gcloud/storage"
185
+ # require "gcloud"
178
186
  #
179
- # storage = Gcloud.storage
187
+ # gcloud = Gcloud.new
188
+ # storage = gcloud.storage
180
189
  #
181
- # bucket = storage.find_bucket "my-todo-app"
190
+ # bucket = storage.bucket "my-todo-app"
182
191
  #
183
192
  # all_files = []
184
193
  # tmp_files = bucket.files
@@ -198,11 +207,12 @@ module Gcloud
198
207
  # file system, and the name/path that the file should be stored in the bucket.
199
208
  # (See Bucket#create_file)
200
209
  #
201
- # require "gcloud/storage"
210
+ # require "gcloud"
202
211
  #
203
- # storage = Gcloud.storage
212
+ # gcloud = Gcloud.new
213
+ # storage = gcloud.storage
204
214
  #
205
- # bucket = storage.find_bucket "my-todo-app"
215
+ # bucket = storage.bucket "my-todo-app"
206
216
  # bucket.create_file "/var/todo-app/avatars/heidi/400x400.png",
207
217
  # "avatars/heidi/400x400.png"
208
218
  #
@@ -210,12 +220,13 @@ module Gcloud
210
220
  #
211
221
  # Files can be downloaded to the local file system. (See File#download)
212
222
  #
213
- # require "gcloud/storage"
223
+ # require "gcloud"
214
224
  #
215
- # storage = Gcloud.storage
225
+ # gcloud = Gcloud.new
226
+ # storage = gcloud.storage
216
227
  #
217
- # bucket = storage.find_bucket "my-todo-app"
218
- # file = bucket.find_file "avatars/heidi/400x400.png"
228
+ # bucket = storage.bucket "my-todo-app"
229
+ # file = bucket.file "avatars/heidi/400x400.png"
219
230
  # file.download "/var/todo-app/avatars/heidi/400x400.png"
220
231
  #
221
232
  # == Using Signed URLs
@@ -224,12 +235,13 @@ module Gcloud
224
235
  # period of time. This URL uses a cryptographic signature
225
236
  # of your credentials to access the file. (See File#signed_url)
226
237
  #
227
- # require "gcloud/storage"
238
+ # require "gcloud"
228
239
  #
229
- # storage = Gcloud.storage
240
+ # gcloud = Gcloud.new
241
+ # storage = gcloud.storage
230
242
  #
231
- # bucket = storage.find_bucket "my-todo-app"
232
- # file = bucket.find_file "avatars/heidi/400x400.png"
243
+ # bucket = storage.bucket "my-todo-app"
244
+ # file = bucket.file "avatars/heidi/400x400.png"
233
245
  # shared_url = file.signed_url method: "GET",
234
246
  # expires: 300 # 5 minutes from now
235
247
  #
@@ -245,11 +257,12 @@ module Gcloud
245
257
  # Access to a bucket can be granted to a user by appending +"user-"+ to the
246
258
  # email address:
247
259
  #
248
- # require "gcloud/storage"
260
+ # require "gcloud"
249
261
  #
250
- # storage = Gcloud.storage
262
+ # gcloud = Gcloud.new
263
+ # storage = gcloud.storage
251
264
  #
252
- # bucket = storage.find_bucket "my-todo-app"
265
+ # bucket = storage.bucket "my-todo-app"
253
266
  #
254
267
  # email = "heidi@example.net"
255
268
  # bucket.acl.add_reader "user-#{email}"
@@ -257,22 +270,24 @@ module Gcloud
257
270
  # Access to a bucket can be granted to a group by appending +"group-"+ to the
258
271
  # email address:
259
272
  #
260
- # require "gcloud/storage"
273
+ # require "gcloud"
261
274
  #
262
- # storage = Gcloud.storage
275
+ # gcloud = Gcloud.new
276
+ # storage = gcloud.storage
263
277
  #
264
- # bucket = storage.find_bucket "my-todo-app"
278
+ # bucket = storage.bucket "my-todo-app"
265
279
  #
266
280
  # email = "authors@example.net"
267
281
  # bucket.acl.add_reader "group-#{email}"
268
282
  #
269
283
  # Access to a bucket can also be granted to a predefined list of permissions:
270
284
  #
271
- # require "gcloud/storage"
285
+ # require "gcloud"
272
286
  #
273
- # storage = Gcloud.storage
287
+ # gcloud = Gcloud.new
288
+ # storage = gcloud.storage
274
289
  #
275
- # bucket = storage.find_bucket "my-todo-app"
290
+ # bucket = storage.bucket "my-todo-app"
276
291
  #
277
292
  # bucket.acl.public!
278
293
  #
@@ -285,12 +300,13 @@ module Gcloud
285
300
  # Access to a file can be granted to a user by appending +"user-"+ to the
286
301
  # email address:
287
302
  #
288
- # require "gcloud/storage"
303
+ # require "gcloud"
289
304
  #
290
- # storage = Gcloud.storage
305
+ # gcloud = Gcloud.new
306
+ # storage = gcloud.storage
291
307
  #
292
- # bucket = storage.find_bucket "my-todo-app"
293
- # file = bucket.find_file "avatars/heidi/400x400.png"
308
+ # bucket = storage.bucket "my-todo-app"
309
+ # file = bucket.file "avatars/heidi/400x400.png"
294
310
  #
295
311
  # email = "heidi@example.net"
296
312
  # file.acl.add_reader "user-#{email}"
@@ -298,24 +314,26 @@ module Gcloud
298
314
  # Access to a file can be granted to a group by appending +"group-"+ to the
299
315
  # email address:
300
316
  #
301
- # require "gcloud/storage"
317
+ # require "gcloud"
302
318
  #
303
- # storage = Gcloud.storage
319
+ # gcloud = Gcloud.new
320
+ # storage = gcloud.storage
304
321
  #
305
- # bucket = storage.find_bucket "my-todo-app"
306
- # file = bucket.find_file "avatars/heidi/400x400.png"
322
+ # bucket = storage.bucket "my-todo-app"
323
+ # file = bucket.file "avatars/heidi/400x400.png"
307
324
  #
308
325
  # email = "authors@example.net"
309
326
  # file.acl.add_reader "group-#{email}"
310
327
  #
311
328
  # Access to a file can also be granted to a predefined list of permissions:
312
329
  #
313
- # require "gcloud/storage"
330
+ # require "gcloud"
314
331
  #
315
- # storage = Gcloud.storage
332
+ # gcloud = Gcloud.new
333
+ # storage = gcloud.storage
316
334
  #
317
- # bucket = storage.find_bucket "my-todo-app"
318
- # file = bucket.find_file "avatars/heidi/400x400.png"
335
+ # bucket = storage.bucket "my-todo-app"
336
+ # file = bucket.file "avatars/heidi/400x400.png"
319
337
  #
320
338
  # file.acl.public!
321
339
  #
@@ -24,12 +24,13 @@ module Gcloud
24
24
  #
25
25
  # Represents a Storage bucket. Belongs to a Project and has many Files.
26
26
  #
27
- # require "glcoud/storage"
27
+ # require "gcloud"
28
28
  #
29
- # storage = Gcloud.storage
29
+ # gcloud = Gcloud.new
30
+ # storage = gcloud.storage
30
31
  #
31
- # bucket = storage.find_bucket "my-bucket"
32
- # file = bucket.find_file "path/to/my-file.ext"
32
+ # bucket = storage.bucket "my-bucket"
33
+ # file = bucket.file "path/to/my-file.ext"
33
34
  #
34
35
  class Bucket
35
36
  ##
@@ -96,8 +97,8 @@ module Gcloud
96
97
  # === Parameters
97
98
  #
98
99
  # +options+::
99
- # An optional Hash for controlling additional behavor. (+Hash+)
100
- # +options [:retries]+::
100
+ # An optional Hash for controlling additional behavior. (+Hash+)
101
+ # <code>options[:retries]</code>::
101
102
  # The number of times the API call should be retried.
102
103
  # Default is Gcloud::Backoff.retries. (+Integer+)
103
104
  #
@@ -107,22 +108,24 @@ module Gcloud
107
108
  #
108
109
  # === Examples
109
110
  #
110
- # require "gcloud/storage"
111
+ # require "gcloud"
111
112
  #
112
- # storage = Gcloud.storage
113
+ # gcloud = Gcloud.new
114
+ # storage = gcloud.storage
113
115
  #
114
- # bucket = storage.find_bucket "my-bucket"
116
+ # bucket = storage.bucket "my-bucket"
115
117
  # bucket.delete
116
118
  #
117
119
  # The API call to delete the bucket may be retried under certain
118
120
  # conditions. See Gcloud::Backoff to control this behavior, or
119
121
  # specify the wanted behavior in the call:
120
122
  #
121
- # require "gcloud/storage"
123
+ # require "gcloud"
122
124
  #
123
- # storage = Gcloud.storage
125
+ # gcloud = Gcloud.new
126
+ # storage = gcloud.storage
124
127
  #
125
- # bucket = storage.find_bucket "my-bucket"
128
+ # bucket = storage.bucket "my-bucket"
126
129
  # bucket.delete retries: 5
127
130
  #
128
131
  def delete options = {}
@@ -131,7 +134,7 @@ module Gcloud
131
134
  if resp.success?
132
135
  true
133
136
  else
134
- ApiError.from_response(resp)
137
+ fail ApiError.from_response(resp)
135
138
  end
136
139
  end
137
140
 
@@ -141,37 +144,38 @@ module Gcloud
141
144
  # === Parameters
142
145
  #
143
146
  # +options+::
144
- # An optional Hash for controlling additional behavor. (+Hash+)
145
- # +options [:prefix]+::
147
+ # An optional Hash for controlling additional behavior. (+Hash+)
148
+ # <code>options[:prefix]</code>::
146
149
  # Filter results to files whose names begin with this prefix.
147
150
  # (+String+)
148
- # +options [:token]+::
151
+ # <code>options[:token]</code>::
149
152
  # A previously-returned page token representing part of the larger set
150
153
  # of results to view. (+String+)
151
- # +options [:max]+::
154
+ # <code>options[:max]</code>::
152
155
  # Maximum number of items plus prefixes to return. As duplicate prefixes
153
156
  # are omitted, fewer total results may be returned than requested.
154
157
  # The default value of this parameter is 1,000 items. (+Integer+)
155
- # +options [:versions]+::
158
+ # <code>options[:versions]</code>::
156
159
  # If +true+, lists all versions of an object as distinct results.
157
160
  # The default is +false+. For more information, see
158
161
  # {Object Versioning
159
162
  # }[https://cloud.google.com/storage/docs/object-versioning].
160
163
  # (+Boolean+)
161
- # +options [:max]+::
164
+ # <code>options[:max]</code>::
162
165
  # Maximum number of buckets to return. (+Integer+)
163
166
  #
164
167
  # === Returns
165
168
  #
166
- # Array of Gcloud::Datastore::File (Gcloud::Datastore::File::List)
169
+ # Array of Gcloud::Storage::File (Gcloud::Storage::File::List)
167
170
  #
168
171
  # === Examples
169
172
  #
170
- # require "gcloud/storage"
173
+ # require "gcloud"
171
174
  #
172
- # storage = Gcloud.storage
175
+ # gcloud = Gcloud.new
176
+ # storage = gcloud.storage
173
177
  #
174
- # bucket = storage.find_bucket "my-bucket"
178
+ # bucket = storage.bucket "my-bucket"
175
179
  # files = bucket.files
176
180
  # files.each do |file|
177
181
  # puts file.name
@@ -180,11 +184,12 @@ module Gcloud
180
184
  # If you have a significant number of files, you may need to paginate
181
185
  # through them: (See File::List#token)
182
186
  #
183
- # require "gcloud/storage"
187
+ # require "gcloud"
184
188
  #
185
- # storage = Gcloud.storage
189
+ # gcloud = Gcloud.new
190
+ # storage = gcloud.storage
186
191
  #
187
- # bucket = storage.find_bucket "my-bucket"
192
+ # bucket = storage.bucket "my-bucket"
188
193
  #
189
194
  # all_files = []
190
195
  # tmp_files = bucket.files
@@ -207,6 +212,7 @@ module Gcloud
207
212
  fail ApiError.from_response(resp)
208
213
  end
209
214
  end
215
+ alias_method :find_files, :files
210
216
 
211
217
  ##
212
218
  # Retrieves a file matching the path.
@@ -218,20 +224,21 @@ module Gcloud
218
224
  #
219
225
  # === Returns
220
226
  #
221
- # Gcloud::Datastore::File or nil if file does not exist
227
+ # Gcloud::Storage::File or nil if file does not exist
222
228
  #
223
229
  # === Example
224
230
  #
225
- # require "gcloud/storage"
231
+ # require "gcloud"
226
232
  #
227
- # storage = Gcloud.storage
233
+ # gcloud = Gcloud.new
234
+ # storage = gcloud.storage
228
235
  #
229
- # bucket = storage.find_bucket "my-bucket"
236
+ # bucket = storage.bucket "my-bucket"
230
237
  #
231
- # file = bucket.find_file "path/to/my-file.ext"
238
+ # file = bucket.file "path/to/my-file.ext"
232
239
  # puts file.name
233
240
  #
234
- def find_file path, options = {}
241
+ def file path, options = {}
235
242
  ensure_connection!
236
243
  resp = connection.get_file name, path, options
237
244
  if resp.success?
@@ -240,6 +247,7 @@ module Gcloud
240
247
  fail ApiError.from_response(resp)
241
248
  end
242
249
  end
250
+ alias_method :find_file, :file
243
251
 
244
252
  ##
245
253
  # Create a new File object by providing a path to a local file to upload
@@ -252,46 +260,48 @@ module Gcloud
252
260
  # +path+::
253
261
  # Path to store the file in Google Cloud Storage. (+String+)
254
262
  # +options+::
255
- # An optional Hash for controlling additional behavor. (+Hash+)
256
- # +options [:acl]+::
263
+ # An optional Hash for controlling additional behavior. (+Hash+)
264
+ # <code>options[:acl]</code>::
257
265
  # A predefined set of access controls to apply to this file.
258
266
  # (+String+)
259
267
  #
260
268
  # Acceptable values are:
261
269
  # * +auth+, +auth_read+, +authenticated+, +authenticated_read+,
262
- # +authenticatedRead+:: File owner gets OWNER access, and
270
+ # +authenticatedRead+ - File owner gets OWNER access, and
263
271
  # allAuthenticatedUsers get READER access.
264
- # * +owner_full+, +bucketOwnerFullControl+:: File owner gets OWNER
272
+ # * +owner_full+, +bucketOwnerFullControl+ - File owner gets OWNER
265
273
  # access, and project team owners get OWNER access.
266
- # * +owner_read+, +bucketOwnerRead+:: File owner gets OWNER access, and
274
+ # * +owner_read+, +bucketOwnerRead+ - File owner gets OWNER access, and
267
275
  # project team owners get READER access.
268
- # * +private+:: File owner gets OWNER access.
269
- # * +project_private+, +projectPrivate+:: File owner gets OWNER access,
276
+ # * +private+ - File owner gets OWNER access.
277
+ # * +project_private+, +projectPrivate+ - File owner gets OWNER access,
270
278
  # and project team members get access according to their roles.
271
- # * +public+, +public_read+, +publicRead+:: File owner gets OWNER
279
+ # * +public+, +public_read+, +publicRead+ - File owner gets OWNER
272
280
  # access, and allUsers get READER access.
273
281
  #
274
282
  # === Returns
275
283
  #
276
- # Gcloud::Datastore::File
284
+ # Gcloud::Storage::File
277
285
  #
278
286
  # === Examples
279
287
  #
280
- # require "gcloud/storage"
288
+ # require "gcloud"
281
289
  #
282
- # storage = Gcloud.storage
290
+ # gcloud = Gcloud.new
291
+ # storage = gcloud.storage
283
292
  #
284
- # bucket = storage.find_bucket "my-bucket"
293
+ # bucket = storage.bucket "my-bucket"
285
294
  #
286
295
  # bucket.create_file "path/to/local.file.ext"
287
296
  #
288
297
  # Additionally, a destination path can be specified.
289
298
  #
290
- # require "gcloud/storage"
299
+ # require "gcloud"
291
300
  #
292
- # storage = Gcloud.storage
301
+ # gcloud = Gcloud.new
302
+ # storage = gcloud.storage
293
303
  #
294
- # bucket = storage.find_bucket "my-bucket"
304
+ # bucket = storage.bucket "my-bucket"
295
305
  #
296
306
  # bucket.create_file "path/to/local.file.ext",
297
307
  # "destination/path/file.ext"
@@ -302,11 +312,12 @@ module Gcloud
302
312
  # by 265KB then it will be lowered to the nearest acceptible
303
313
  # value.
304
314
  #
305
- # require "gcloud/storage"
315
+ # require "gcloud"
306
316
  #
307
- # storage = Gcloud.storage
317
+ # gcloud = Gcloud.new
318
+ # storage = gcloud.storage
308
319
  #
309
- # bucket = storage.find_bucket "my-bucket"
320
+ # bucket = storage.bucket "my-bucket"
310
321
  #
311
322
  # bucket.create_file "path/to/local.file.ext",
312
323
  # "destination/path/file.ext",
@@ -326,6 +337,8 @@ module Gcloud
326
337
  upload_multipart file, path, options
327
338
  end
328
339
  end
340
+ alias_method :upload_file, :create_file
341
+ alias_method :new_file, :create_file
329
342
 
330
343
  ##
331
344
  # The Bucket::Acl instance used to control access to the bucket.
@@ -342,11 +355,12 @@ module Gcloud
342
355
  # Access to a bucket can be granted to a user by appending +"user-"+ to
343
356
  # the email address:
344
357
  #
345
- # require "gcloud/storage"
358
+ # require "gcloud"
346
359
  #
347
- # storage = Gcloud.storage
360
+ # gcloud = Gcloud.new
361
+ # storage = gcloud.storage
348
362
  #
349
- # bucket = storage.find_bucket "my-todo-app"
363
+ # bucket = storage.bucket "my-todo-app"
350
364
  #
351
365
  # email = "heidi@example.net"
352
366
  # bucket.acl.add_reader "user-#{email}"
@@ -354,11 +368,12 @@ module Gcloud
354
368
  # Access to a bucket can be granted to a group by appending +"group-"+ to
355
369
  # the email address:
356
370
  #
357
- # require "gcloud/storage"
371
+ # require "gcloud"
358
372
  #
359
- # storage = Gcloud.storage
373
+ # gcloud = Gcloud.new
374
+ # storage = gcloud.storage
360
375
  #
361
- # bucket = storage.find_bucket "my-todo-app"
376
+ # bucket = storage.bucket "my-todo-app"
362
377
  #
363
378
  # email = "authors@example.net"
364
379
  # bucket.acl.add_reader "group-#{email}"
@@ -366,11 +381,12 @@ module Gcloud
366
381
  # Access to a bucket can also be granted to a predefined list of
367
382
  # permissions:
368
383
  #
369
- # require "gcloud/storage"
384
+ # require "gcloud"
370
385
  #
371
- # storage = Gcloud.storage
386
+ # gcloud = Gcloud.new
387
+ # storage = gcloud.storage
372
388
  #
373
- # bucket = storage.find_bucket "my-todo-app"
389
+ # bucket = storage.bucket "my-todo-app"
374
390
  #
375
391
  # bucket.acl.public!
376
392
  #
@@ -394,11 +410,12 @@ module Gcloud
394
410
  # Access to a bucket's files can be granted to a user by appending
395
411
  # +"user-"+ to the email address:
396
412
  #
397
- # require "gcloud/storage"
413
+ # require "gcloud"
398
414
  #
399
- # storage = Gcloud.storage
415
+ # gcloud = Gcloud.new
416
+ # storage = gcloud.storage
400
417
  #
401
- # bucket = storage.find_bucket "my-todo-app"
418
+ # bucket = storage.bucket "my-todo-app"
402
419
  #
403
420
  # email = "heidi@example.net"
404
421
  # bucket.default_acl.add_reader "user-#{email}"
@@ -406,11 +423,12 @@ module Gcloud
406
423
  # Access to a bucket's files can be granted to a group by appending
407
424
  # +"group-"+ to the email address:
408
425
  #
409
- # require "gcloud/storage"
426
+ # require "gcloud"
410
427
  #
411
- # storage = Gcloud.storage
428
+ # gcloud = Gcloud.new
429
+ # storage = gcloud.storage
412
430
  #
413
- # bucket = storage.find_bucket "my-todo-app"
431
+ # bucket = storage.bucket "my-todo-app"
414
432
  #
415
433
  # email = "authors@example.net"
416
434
  # bucket.default_acl.add_reader "group-#{email}"
@@ -418,11 +436,12 @@ module Gcloud
418
436
  # Access to a bucket's files can also be granted to a predefined list of
419
437
  # permissions:
420
438
  #
421
- # require "gcloud/storage"
439
+ # require "gcloud"
422
440
  #
423
- # storage = Gcloud.storage
441
+ # gcloud = Gcloud.new
442
+ # storage = gcloud.storage
424
443
  #
425
- # bucket = storage.find_bucket "my-todo-app"
444
+ # bucket = storage.bucket "my-todo-app"
426
445
  #
427
446
  # bucket.default_acl.public!
428
447
  def default_acl