class BigQuery::Tabledata::InsertRows

Public Class Methods

new(client, table, arg) click to toggle source
# File lib/bigquery-client/insert_rows.rb, line 7
def initialize(client, table, arg)
  @client, @table = client, table
  @rows = arg.is_a?(Array) ? arg : [arg]
end

Public Instance Methods

call() click to toggle source
# File lib/bigquery-client/insert_rows.rb, line 12
def call
  result = @client.insert_all(@table, @rows)
  handle_errors(result['insertErrors']) if result['insertErrors']
  result
end
handle_errors(errors) click to toggle source
# File lib/bigquery-client/insert_rows.rb, line 18
def handle_errors(errors)
  fail InsertError, errors
end