Class: GoogleBigquery::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/google_bigquery/client.rb

Direct Known Subclasses

Dataset, Jobs, Project, Table, TableData

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Client

Returns a new instance of Client.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/google_bigquery/client.rb', line 6

def initialize(opts = {})

  @api   ||= GoogleBigquery::Auth.api
  @client ||= GoogleBigquery::Auth.client
  #@auth.authorize # check expiration and cache ?

  self.tap do |client|
    client.options    ||= {}
    client.defaults_options(opts)
    client.options ||= opts
    yield client if block_given?
  end
end

Instance Attribute Details

#apiObject

Returns the value of attribute api.



4
5
6
# File 'lib/google_bigquery/client.rb', line 4

def api
  @api
end

#clientObject

Returns the value of attribute client.



4
5
6
# File 'lib/google_bigquery/client.rb', line 4

def client
  @client
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/google_bigquery/client.rb', line 4

def options
  @options
end

Class Method Details

.parse_response(res) ⇒ Object



28
29
30
31
# File 'lib/google_bigquery/client.rb', line 28

def self.parse_response(res)
  raise_detected_errors(res)
  JSON.parse(res.body)
end

Instance Method Details

#defaults_options(opts) ⇒ Object



20
21
22
# File 'lib/google_bigquery/client.rb', line 20

def defaults_options(opts)

end

#parse_response(res) ⇒ Object



24
25
26
# File 'lib/google_bigquery/client.rb', line 24

def parse_response(res)
  JSON.parse(res.body)
end