bigquery 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/bigquery.rb +12 -4
  2. metadata +1 -1
data/lib/bigquery.rb CHANGED
@@ -7,11 +7,19 @@ class BigQuery
7
7
  def initialize(opts = {})
8
8
  @client = Google::APIClient.new
9
9
 
10
- @client.authorization.client_id = opts['client_id']
11
- @client.authorization.client_secret = opts['client_secret']
12
- @client.authorization.refresh_token = opts['refresh_token']
10
+ key = Google::APIClient::PKCS12.load_key(
11
+ BASE_PATH + "/config/#{opts['key']}",
12
+ "notasecret"
13
+ )
14
+
15
+ asserter = Google::APIClient::JWTAsserter.new(
16
+ opts['service_email'],
17
+ opts['auth_url'],
18
+ key
19
+ )
20
+
21
+ @client.authorization = asserter.authorize
13
22
 
14
- @client.authorization.fetch_access_token!
15
23
  @bq = @client.discovered_api("bigquery", "v2")
16
24
 
17
25
  @project_id = opts['project_id']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigquery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: