Method: BigQuery::Client#initialize
- Defined in:
- lib/big_query/client.rb
#initialize(opts = {}) ⇒ Client
Returns a new instance of Client.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/big_query/client.rb', line 15 def initialize(opts = {}) @client = Google::APIClient.new( application_name: 'BigQuery ruby app', application_version: BigQuery::VERSION ) key = Google::APIClient::PKCS12.load_key(File.open( opts['key'], mode: 'rb'), "notasecret" ) @asserter = Google::APIClient::JWTAsserter.new( opts['service_email'], "https://www.googleapis.com/auth/bigquery", key ) refresh_auth @bq = @client.discovered_api("bigquery", "v2") @project_id = opts['project_id'] @dataset = opts['dataset'] end |