class Google::Cloud::Storage::Bucket::Updater
Yielded to a block to accumulate changes for a patch request.
#
def check_for_changed_labels!
- Private: - Make sure any labels changes are saved
def check_for_changed_labels! return if @labels == @gapi.labels.to_h @gapi.labels = @labels patch_gapi! :labels end
def check_for_mutable_cors!
- Private: - Make sure any cors changes are saved
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
def check_for_mutable_lifecycle!
- Private: - Make sure any lifecycle changes are saved
def check_for_mutable_lifecycle! return if @lifecycle_builder.nil? return unless @lifecycle_builder.changed? @gapi.lifecycle = @lifecycle_builder.to_gapi patch_gapi! :lifecycle end
def cors
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
def initialize gapi
#
def initialize gapi super() @updates = [] @gapi = gapi @labels = @gapi.labels.to_h.dup @cors_builder = nil @lifecycle_builder = nil end
def labels
-
(Hash(String => String))
-
def labels @labels end
def labels= labels
-
labels
(Hash(String => String)
) -- The user-provided labels.
def labels= labels @labels = labels @gapi.labels = @labels patch_gapi! :labels end
def lifecycle
def lifecycle # Same as Bucket#lifecycle, but not frozen @lifecycle_builder ||= Bucket::Lifecycle.from_gapi @gapi.lifecycle yield @lifecycle_builder if block_given? @lifecycle_builder end
def patch_gapi! attribute
#
def patch_gapi! attribute @updates << attribute @updates.uniq! end