lib/google/cloud/storage/file.rb in google-cloud-storage-1.8.0 vs lib/google/cloud/storage/file.rb in google-cloud-storage-1.9.0
- old
+ new
@@ -47,10 +47,22 @@
# bucket = storage.bucket "my-bucket"
#
# file = bucket.file "path/to/my-file.ext"
# file.download "path/to/downloaded/file.ext"
#
+ # @example Download a public file with an unauthenticated client:
+ # require "google/cloud/storage"
+ #
+ # storage = Google::Cloud::Storage.anonymous
+ #
+ # bucket = storage.bucket "public-bucket", skip_lookup: true
+ # file = bucket.file "path/to/public-file.ext", skip_lookup: true
+ #
+ # downloaded = file.download
+ # downloaded.rewind
+ # downloaded.read #=> "Hello world!"
+ #
class File
##
# @private The Connection object.
attr_accessor :service
@@ -479,9 +491,21 @@
# storage = Google::Cloud::Storage.new
#
# bucket = storage.bucket "my-bucket"
#
# file = bucket.file "path/to/my-file.ext"
+ # downloaded = file.download
+ # downloaded.rewind
+ # downloaded.read #=> "Hello world!"
+ #
+ # @example Download a public file with an unauthenticated client:
+ # require "google/cloud/storage"
+ #
+ # storage = Google::Cloud::Storage.anonymous
+ #
+ # bucket = storage.bucket "public-bucket", skip_lookup: true
+ # file = bucket.file "path/to/public-file.ext", skip_lookup: true
+ #
# downloaded = file.download
# downloaded.rewind
# downloaded.read #=> "Hello world!"
#
def download path = nil, verify: :md5, encryption_key: nil