Class: Google::Cloud::Bigquery::Dataset::Updater
- Inherits:
-
Google::Cloud::Bigquery::Dataset
- Object
- Google::Cloud::Bigquery::Dataset
- Google::Cloud::Bigquery::Dataset::Updater
- Defined in:
- lib/google/cloud/bigquery/dataset.rb
Overview
Yielded to a block to accumulate changes for a patch request.
Data collapse
-
#updates ⇒ Object
readonly
A list of attributes that were updated.
Data collapse
- #access ⇒ Object
-
#check_for_mutated_access! ⇒ Object
Make sure any access changes are saved.
-
#initialize(gapi) ⇒ Updater
constructor
Create an Updater object.
- #to_gapi ⇒ Object
Methods inherited from Google::Cloud::Bigquery::Dataset
#api_url, #create_table, #create_view, #created_at, #dataset_id, #default_expiration, #default_expiration=, #delete, #description, #description=, #etag, #exists?, #external, #insert, #insert_async, #labels, #labels=, #load, #load_job, #location, #modified_at, #name, #name=, #project_id, #query, #query_job, #reference?, #reload!, #resource?, #resource_full?, #resource_partial?, #table, #tables
Constructor Details
#initialize(gapi) ⇒ Updater
Create an Updater object.
2209 2210 2211 2212 |
# File 'lib/google/cloud/bigquery/dataset.rb', line 2209 def initialize gapi @updates = [] @gapi = gapi end |
Instance Attribute Details
#updates ⇒ Object (readonly)
A list of attributes that were updated.
2205 2206 2207 |
# File 'lib/google/cloud/bigquery/dataset.rb', line 2205 def updates @updates end |
Instance Method Details
#access ⇒ Object
2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 |
# File 'lib/google/cloud/bigquery/dataset.rb', line 2214 def access # TODO: make sure to call ensure_full_data! on Dataset#update @access ||= Access.from_gapi @gapi if block_given? yield @access check_for_mutated_access! end # Same as Dataset#access, but not frozen @access end |
#check_for_mutated_access! ⇒ Object
Make sure any access changes are saved
2227 2228 2229 2230 2231 2232 |
# File 'lib/google/cloud/bigquery/dataset.rb', line 2227 def check_for_mutated_access! return if @access.nil? return unless @access.changed? @gapi.update! access: @access.to_gapi patch_gapi! :access end |
#to_gapi ⇒ Object
2234 2235 2236 2237 |
# File 'lib/google/cloud/bigquery/dataset.rb', line 2234 def to_gapi check_for_mutated_access! @gapi end |