Class: Gcloud::Bigquery::Table::List

Inherits:
Array
  • Object
show all
Defined in:
lib/gcloud/bigquery/table/list.rb

Overview

Table::List is a special case Array with additional values.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arr = []) ⇒ List

Create a new Table::List with an array of jobs.



35
36
37
# File 'lib/gcloud/bigquery/table/list.rb', line 35

def initialize arr = []
  super arr
end

Instance Attribute Details

#etagObject

A hash of this page of results.



28
29
30
# File 'lib/gcloud/bigquery/table/list.rb', line 28

def etag
  @etag
end

#tokenObject

If not empty, indicates that there are more records that match the request and this value should be passed to continue.



25
26
27
# File 'lib/gcloud/bigquery/table/list.rb', line 25

def token
  @token
end

#totalObject

Total number of jobs in this collection.



31
32
33
# File 'lib/gcloud/bigquery/table/list.rb', line 31

def total
  @total
end

Class Method Details

.from_resp(resp, conn) ⇒ Object

New Table::List from a response object.



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/gcloud/bigquery/table/list.rb', line 41

def self.from_resp resp, conn #:nodoc:
  tables = List.new(Array(resp.data["tables"]).map do |gapi_object|
    Table.from_gapi gapi_object, conn
  end)
  tables.instance_eval do
    @token = resp.data["nextPageToken"]
    @etag = resp.data["etag"]
    @total = resp.data["totalItems"]
  end
  tables
end