Class: Google::Cloud::Bigquery::Dataset::Updater

Inherits:
Google::Cloud::Bigquery::Dataset show all
Defined in:
lib/google/cloud/bigquery/dataset.rb

Overview

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

Data collapse

Data collapse

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.



2002
2003
2004
2005
# File 'lib/google/cloud/bigquery/dataset.rb', line 2002

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

Instance Attribute Details

#updatesObject (readonly)

A list of attributes that were updated.



1998
1999
2000
# File 'lib/google/cloud/bigquery/dataset.rb', line 1998

def updates
  @updates
end

Instance Method Details

#accessObject



2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
# File 'lib/google/cloud/bigquery/dataset.rb', line 2007

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



2020
2021
2022
2023
2024
2025
# File 'lib/google/cloud/bigquery/dataset.rb', line 2020

def check_for_mutated_access!
  return if @access.nil?
  return unless @access.changed?
  @gapi.update! access: @access.to_gapi
  patch_gapi! :access
end

#to_gapiObject



2027
2028
2029
2030
# File 'lib/google/cloud/bigquery/dataset.rb', line 2027

def to_gapi
  check_for_mutated_access!
  @gapi
end