google-cloud-storage 0.20.2 → 0.21.0
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 +4 -4
- data/lib/google-cloud-storage.rb +3 -14
- data/lib/google/cloud/storage.rb +97 -61
- data/lib/google/cloud/storage/bucket.rb +120 -55
- data/lib/google/cloud/storage/bucket/acl.rb +65 -99
- data/lib/google/cloud/storage/bucket/cors.rb +4 -6
- data/lib/google/cloud/storage/bucket/list.rb +10 -15
- data/lib/google/cloud/storage/file.rb +48 -54
- data/lib/google/cloud/storage/file/acl.rb +31 -48
- data/lib/google/cloud/storage/file/list.rb +10 -15
- data/lib/google/cloud/storage/project.rb +29 -29
- data/lib/google/cloud/storage/service.rb +1 -2
- data/lib/google/cloud/storage/version.rb +1 -1
- metadata +5 -5
@@ -13,7 +13,7 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
|
16
|
-
require "google/cloud/core/
|
16
|
+
require "google/cloud/core/environment"
|
17
17
|
require "google/cloud/storage/errors"
|
18
18
|
require "google/cloud/storage/service"
|
19
19
|
require "google/cloud/storage/credentials"
|
@@ -39,10 +39,9 @@ module Google
|
|
39
39
|
# See {Google::Cloud#storage}
|
40
40
|
#
|
41
41
|
# @example
|
42
|
-
# require "google/cloud"
|
42
|
+
# require "google/cloud/storage"
|
43
43
|
#
|
44
|
-
#
|
45
|
-
# storage = gcloud.storage
|
44
|
+
# storage = Google::Cloud::Storage.new
|
46
45
|
#
|
47
46
|
# bucket = storage.bucket "my-bucket"
|
48
47
|
# file = bucket.file "path/to/my-file.ext"
|
@@ -64,11 +63,12 @@ module Google
|
|
64
63
|
# The Storage project connected to.
|
65
64
|
#
|
66
65
|
# @example
|
67
|
-
# require "google/cloud"
|
66
|
+
# require "google/cloud/storage"
|
68
67
|
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
68
|
+
# storage = Google::Cloud::Storage.new(
|
69
|
+
# project: "my-todo-project",
|
70
|
+
# keyfile: "/path/to/keyfile.json"
|
71
|
+
# )
|
72
72
|
#
|
73
73
|
# storage.project #=> "my-todo-project"
|
74
74
|
#
|
@@ -82,7 +82,7 @@ module Google
|
|
82
82
|
ENV["STORAGE_PROJECT"] ||
|
83
83
|
ENV["GOOGLE_CLOUD_PROJECT"] ||
|
84
84
|
ENV["GCLOUD_PROJECT"] ||
|
85
|
-
Google::Cloud::Core::
|
85
|
+
Google::Cloud::Core::Environment.project_id
|
86
86
|
end
|
87
87
|
|
88
88
|
##
|
@@ -98,10 +98,9 @@ module Google
|
|
98
98
|
# {Google::Cloud::Storage::Bucket::List})
|
99
99
|
#
|
100
100
|
# @example
|
101
|
-
# require "google/cloud"
|
101
|
+
# require "google/cloud/storage"
|
102
102
|
#
|
103
|
-
#
|
104
|
-
# storage = gcloud.storage
|
103
|
+
# storage = Google::Cloud::Storage.new
|
105
104
|
#
|
106
105
|
# buckets = storage.buckets
|
107
106
|
# buckets.each do |bucket|
|
@@ -109,10 +108,9 @@ module Google
|
|
109
108
|
# end
|
110
109
|
#
|
111
110
|
# @example Retrieve buckets with names that begin with a given prefix:
|
112
|
-
# require "google/cloud"
|
111
|
+
# require "google/cloud/storage"
|
113
112
|
#
|
114
|
-
#
|
115
|
-
# storage = gcloud.storage
|
113
|
+
# storage = Google::Cloud::Storage.new
|
116
114
|
#
|
117
115
|
# user_buckets = storage.buckets prefix: "user-"
|
118
116
|
# user_buckets.each do |bucket|
|
@@ -120,10 +118,9 @@ module Google
|
|
120
118
|
# end
|
121
119
|
#
|
122
120
|
# @example Retrieve all buckets: (See {Bucket::List#all})
|
123
|
-
# require "google/cloud"
|
121
|
+
# require "google/cloud/storage"
|
124
122
|
#
|
125
|
-
#
|
126
|
-
# storage = gcloud.storage
|
123
|
+
# storage = Google::Cloud::Storage.new
|
127
124
|
#
|
128
125
|
# buckets = storage.buckets
|
129
126
|
# buckets.all do |bucket|
|
@@ -146,10 +143,9 @@ module Google
|
|
146
143
|
# does not exist
|
147
144
|
#
|
148
145
|
# @example
|
149
|
-
# require "google/cloud"
|
146
|
+
# require "google/cloud/storage"
|
150
147
|
#
|
151
|
-
#
|
152
|
-
# storage = gcloud.storage
|
148
|
+
# storage = Google::Cloud::Storage.new
|
153
149
|
#
|
154
150
|
# bucket = storage.bucket "my-bucket"
|
155
151
|
# puts bucket.name
|
@@ -232,11 +228,14 @@ module Google
|
|
232
228
|
# Logs](https://cloud.google.com/storage/docs/access-logs).
|
233
229
|
# @param [Symbol, String] storage_class Defines how objects in the
|
234
230
|
# bucket are stored and determines the SLA and the cost of storage.
|
235
|
-
# Values include `:
|
231
|
+
# Values include `:multi_regional`, `:regional`, `:nearline`,
|
232
|
+
# `:coldline`, `:standard`, and `:dra` (Durable Reduced
|
236
233
|
# Availability), as well as the strings returned by
|
237
234
|
# Bucket#storage_class. For more information, see [Storage
|
238
235
|
# Classes](https://cloud.google.com/storage/docs/storage-classes). The
|
239
|
-
# default value is `:standard
|
236
|
+
# default value is `:standard`, which is equivalent to
|
237
|
+
# `:multi_regional` or `:regional` depending on the bucket's location
|
238
|
+
# settings.
|
240
239
|
# @param [Boolean] versioning Whether [Object
|
241
240
|
# Versioning](https://cloud.google.com/storage/docs/object-versioning)
|
242
241
|
# is to be enabled for the bucket. The default value is `false`.
|
@@ -257,18 +256,16 @@ module Google
|
|
257
256
|
# @return [Google::Cloud::Storage::Bucket]
|
258
257
|
#
|
259
258
|
# @example
|
260
|
-
# require "google/cloud"
|
259
|
+
# require "google/cloud/storage"
|
261
260
|
#
|
262
|
-
#
|
263
|
-
# storage = gcloud.storage
|
261
|
+
# storage = Google::Cloud::Storage.new
|
264
262
|
#
|
265
263
|
# bucket = storage.create_bucket "my-bucket"
|
266
264
|
#
|
267
265
|
# @example Configure the bucket in a block:
|
268
|
-
# require "google/cloud"
|
266
|
+
# require "google/cloud/storage"
|
269
267
|
#
|
270
|
-
#
|
271
|
-
# storage = gcloud.storage
|
268
|
+
# storage = Google::Cloud::Storage.new
|
272
269
|
#
|
273
270
|
# bucket = storage.create_bucket "my-bucket" do |b|
|
274
271
|
# b.website_main = "index.html"
|
@@ -313,6 +310,9 @@ module Google
|
|
313
310
|
"dra" => "DURABLE_REDUCED_AVAILABILITY",
|
314
311
|
"durable" => "DURABLE_REDUCED_AVAILABILITY",
|
315
312
|
"nearline" => "NEARLINE",
|
313
|
+
"coldline" => "COLDLINE",
|
314
|
+
"multi_regional" => "MULTI_REGIONAL",
|
315
|
+
"regional" => "REGIONAL",
|
316
316
|
"standard" => "STANDARD" }[str.to_s.downcase]
|
317
317
|
end
|
318
318
|
end
|
@@ -14,7 +14,6 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
require "google/cloud/storage/version"
|
17
|
-
require "google/cloud/core/grpc_backoff"
|
18
17
|
require "google/apis/storage_v1"
|
19
18
|
require "digest"
|
20
19
|
require "mime/types"
|
@@ -44,7 +43,7 @@ module Google
|
|
44
43
|
@credentials = credentials
|
45
44
|
@credentials = credentials
|
46
45
|
@service = API::StorageService.new
|
47
|
-
@service.client_options.application_name = "
|
46
|
+
@service.client_options.application_name = "gcloud-ruby"
|
48
47
|
@service.client_options.application_version = \
|
49
48
|
Google::Cloud::Storage::VERSION
|
50
49
|
@service.request_options.retries = retries || 3
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-10-
|
12
|
+
date: 2016-10-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.
|
20
|
+
version: 0.21.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.
|
27
|
+
version: 0.21.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: google-api-client
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
222
|
version: '0'
|
223
223
|
requirements: []
|
224
224
|
rubyforge_project:
|
225
|
-
rubygems_version: 2.
|
225
|
+
rubygems_version: 2.6.4
|
226
226
|
signing_key:
|
227
227
|
specification_version: 4
|
228
228
|
summary: API Client library for Google Cloud Storage
|