Class: Google::Cloud::Storage::File::Updater

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

Overview

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

Instance Attribute Summary collapse

Attributes inherited from Google::Cloud::Storage::File

#gapi, #service

Instance Method Summary collapse

Methods inherited from Google::Cloud::Storage::File

#acl, #api_url, #bucket, #cache_control, #cache_control=, #content_disposition, #content_disposition=, #content_encoding, #content_encoding=, #content_language, #content_language=, #content_type, #content_type=, #copy, #crc32c, #created_at, #delete, #download, #encryption_key_sha256, #etag, from_gapi, #generation, #id, #kind, #md5, #media_url, #metageneration, #name, #public_url, #reload!, #signed_url, #size, #to_gs_url, #update, #updated_at

Constructor Details

#initialize(gapi) ⇒ Updater

Create an Updater object.



800
801
802
803
# File 'lib/google/cloud/storage/file.rb', line 800

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

Instance Attribute Details

#updatesObject (readonly)

Returns the value of attribute updates.



797
798
799
# File 'lib/google/cloud/storage/file.rb', line 797

def updates
  @updates
end

Instance Method Details

#check_for_changed_metadata!Object



826
827
828
829
830
# File 'lib/google/cloud/storage/file.rb', line 826

def check_for_changed_metadata!
  return if @metadata == @gapi.
  @gapi. = @metadata
  patch_gapi! :metadata
end

#metadataObject

A hash of custom, user-provided web-safe keys and arbitrary string values that will returned with requests for the file as “x-goog-meta-” response headers.



809
810
811
812
# File 'lib/google/cloud/storage/file.rb', line 809

def 
  # do not freeze metadata
  @metadata ||= @gapi..to_h.dup
end

#metadata=(metadata) ⇒ Object

Updates the hash of custom, user-provided web-safe keys and arbitrary string values that will returned with requests for the file as “x-goog-meta-” response headers.



818
819
820
821
822
# File 'lib/google/cloud/storage/file.rb', line 818

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