lib/google/cloud/storage/bucket.rb in google-cloud-storage-1.40.0 vs lib/google/cloud/storage/bucket.rb in google-cloud-storage-1.41.0
- old
+ new
@@ -1168,13 +1168,13 @@
# Add check for mutable cors
updater.check_for_changed_labels!
updater.check_for_mutable_cors!
updater.check_for_mutable_lifecycle!
return if updater.updates.empty?
- patch_gapi! updater.updates,
- if_metageneration_match: if_metageneration_match,
- if_metageneration_not_match: if_metageneration_not_match
+ update_gapi! updater.updates,
+ if_metageneration_match: if_metageneration_match,
+ if_metageneration_not_match: if_metageneration_not_match
end
##
# Permanently deletes the bucket.
# The bucket must be empty before it can be deleted.
@@ -2899,9 +2899,29 @@
@gapi = service.patch_bucket name,
patch_gapi,
if_metageneration_match: if_metageneration_match,
if_metageneration_not_match: if_metageneration_not_match,
user_project: user_project
+ @lazy = nil
+ self
+ end
+
+ def update_gapi! attributes,
+ if_metageneration_match: nil,
+ if_metageneration_not_match: nil
+ attributes = Array(attributes)
+ attributes.flatten!
+ return if attributes.empty?
+ ensure_service!
+ update_args = Hash[attributes.map do |attr|
+ [attr, @gapi.send(attr)]
+ end]
+ update_gapi = API::Bucket.new(**update_args)
+ @gapi = service.update_bucket name,
+ update_gapi,
+ if_metageneration_match: if_metageneration_match,
+ if_metageneration_not_match: if_metageneration_not_match,
+ user_project: user_project
@lazy = nil
self
end
##