Method: Gcloud#storage
- Defined in:
- lib/gcloud.rb
#storage(scope: nil) ⇒ Object
Creates a new object for connecting to the Storage service. Each call creates a new connection.
Parameters
scope-
The OAuth 2.0 scopes controlling the set of resources and operations that the connection can access. See Using OAuth 2.0 to Access Google APIs. (
StringorArray)The default scope is:
-
https://www.googleapis.com/auth/devstorage.full_control
-
Returns
Gcloud::Storage::Project
Examples
require "gcloud"
gcloud = Gcloud.new
storage = gcloud.storage
bucket = storage.bucket "my-bucket"
file = bucket.file "path/to/my-file.ext"
The default scope can be overridden with the scope option. For more information see Storage OAuth 2.0 Authentication.
require "gcloud"
gcloud = Gcloud.new
readonly_scope = "https://www.googleapis.com/auth/devstorage.read_only"
readonly_storage = gcloud.storage scope: readonly_scope
157 158 159 160 |
# File 'lib/gcloud.rb', line 157 def storage scope: nil require "gcloud/storage" Gcloud.storage @project, @keyfile, scope: scope end |