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

#gapi, #service

Instance Method Summary collapse

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

#acl, #api_url, #create_file, #created_at, #default_acl, #delete, #file, #files, from_gapi, #id, #kind, #location, #logging_bucket, #logging_bucket=, #logging_prefix, #logging_prefix=, #name, #reload!, #storage_class, #update, #versioning=, #versioning?, #website_404, #website_404=, #website_main, #website_main=

Constructor Details

#initialize(gapi) ⇒ Updater

Create an Updater object.



749
750
751
752
753
# File 'lib/google/cloud/storage/bucket.rb', line 749

def initialize gapi
  @updates = []
  @gapi = gapi
  @cors_builder = nil
end

Instance Attribute Details

#updatesObject (readonly)

Returns the value of attribute updates.



746
747
748
# File 'lib/google/cloud/storage/bucket.rb', line 746

def updates
  @updates
end

Instance Method Details

#check_for_mutable_cors!Object



764
765
766
767
768
769
# File 'lib/google/cloud/storage/bucket.rb', line 764

def check_for_mutable_cors!
  return if @cors_builder.nil?
  return unless @cors_builder.changed?
  @gapi.cors_configurations = @cors_builder.to_gapi
  patch_gapi! :cors_configurations
end

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

Yields:

  • (@cors_builder)


755
756
757
758
759
760
# File 'lib/google/cloud/storage/bucket.rb', line 755

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