Class: Google::Cloud::Storage::Bucket::Updater

Inherits:
Google::Cloud::Storage::Bucket show all
Defined in:
lib/google/cloud/storage/bucket.rb

Overview

Yielded to a block to accumulate changes for a patch request.

Instance Attribute Summary collapse

Attributes inherited from Google::Cloud::Storage::Bucket

#user_project

Instance Method Summary collapse

Methods inherited from Google::Cloud::Storage::Bucket

#acl, #api_url, #create_file, #create_notification, #created_at, #default_acl, #delete, #exists?, #file, #files, #id, #kind, #location, #logging_bucket, #logging_bucket=, #logging_prefix, #logging_prefix=, #name, #notification, #notifications, #policy, #policy=, #post_object, #reload!, #requester_pays, #requester_pays=, #signed_url, #storage_class, #storage_class=, #test_permissions, #update, #versioning=, #versioning?, #website_404, #website_404=, #website_main, #website_main=

Constructor Details

#initialize(gapi) ⇒ Updater

Create an Updater object.



1392
1393
1394
1395
1396
1397
# File 'lib/google/cloud/storage/bucket.rb', line 1392

def initialize gapi
  @updates = []
  @gapi = gapi
  @labels = @gapi.labels.to_h.dup
  @cors_builder = nil
end

Instance Attribute Details

#updatesObject (readonly)

Returns the value of attribute updates



1389
1390
1391
# File 'lib/google/cloud/storage/bucket.rb', line 1389

def updates
  @updates
end

Instance Method Details

#cors {|@cors_builder| ... } ⇒ Object

Yields:

  • (@cors_builder)


1421
1422
1423
1424
1425
1426
# File 'lib/google/cloud/storage/bucket.rb', line 1421

def cors
  # Same as Bucket#cors, but not frozen
  @cors_builder ||= Bucket::Cors.from_gapi @gapi.cors_configurations
  yield @cors_builder if block_given?
  @cors_builder
end

#labelsObject

A hash of user-provided labels. Changes are allowed.



1401
1402
1403
# File 'lib/google/cloud/storage/bucket.rb', line 1401

def labels
  @labels
end

#labels=(labels) ⇒ Object

Updates the hash of user-provided labels.



1407
1408
1409
1410
1411
# File 'lib/google/cloud/storage/bucket.rb', line 1407

def labels= labels
  @labels = labels
  @gapi.labels = @labels
  patch_gapi! :labels
end