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

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, #generation, #id, #kind, #md5, #media_url, #metageneration, #name, #public_url, #reload!, #signed_url, #size, #update, #updated_at

Constructor Details

#initialize(gapi) ⇒ Updater

Create an Updater object.



821
822
823
824
# File 'lib/google/cloud/storage/file.rb', line 821

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

Instance Attribute Details

#updatesObject (readonly)

Returns the value of attribute updates



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

def updates
  @updates
end

Instance Method Details

#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.



830
831
832
833
# File 'lib/google/cloud/storage/file.rb', line 830

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.



839
840
841
842
843
# File 'lib/google/cloud/storage/file.rb', line 839

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