bigbroda 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +6 -2
- data/lib/generators/templates/bigquery.rb.erb +2 -2
- data/lib/google_bigquery/auth.rb +7 -6
- data/lib/google_bigquery/config.rb +3 -4
- data/lib/google_bigquery/version.rb +1 -1
- data/spec/dummy/config/initializers/bigquery.rb +1 -2
- data/spec/fixtures/configs/account_config.yml-example +0 -1
- data/spec/functional/config_spec.rb +0 -3
- data/spec/spec_helper.rb +2 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26a124f01089b56c69ba302ef201cfb34d758d69
|
4
|
+
data.tar.gz: 45592ad512c5a78941f8ffc1844b6462aaab8710
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a85ed5f8a73a0c19dc3735add3edb714e0fa7f5dcb35a5c2354d2d5ac40c79d6da5f264eabfc05ef2b9ad4f7c75c3ecd4ad1e87ad03f68fdfc9f9934694581f
|
7
|
+
data.tar.gz: 70ea14ef513d18a3b7bb67f01578aced7b0164a970f2ffd52a193a08eb7776b7231ff529325fdae7381d30f690870d0753d71421b841b904ba67119e6fd3f8b6
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -31,12 +31,14 @@ Or generate a file in config/initializers/bigquery.rb with the following content
|
|
31
31
|
GoogleBigquery::Config.setup do |config|
|
32
32
|
config.pass_phrase = ["pass_phrase"]
|
33
33
|
config.key_file = ["key_file"]
|
34
|
-
config.client_id = ["client_id"]
|
35
34
|
config.scope = ["scope"]
|
36
35
|
config.email = ["email"]
|
36
|
+
config.retries = [retries]
|
37
37
|
end
|
38
38
|
```
|
39
39
|
|
40
|
+
retries indicates the number of times to retry on recoverable errors (no retries if set to one or not present)
|
41
|
+
|
40
42
|
### Active Record Adapter
|
41
43
|
|
42
44
|
#### Connection
|
@@ -218,12 +220,14 @@ Note:
|
|
218
220
|
GoogleBigquery::Config.setup do |config|
|
219
221
|
config.pass_phrase = "notasecret"
|
220
222
|
config.key_file = /location/to_your/key_file.p12
|
221
|
-
config.client_id = "XXXXX.apps.googleusercontent.com"
|
222
223
|
config.scope = "https://www.googleapis.com/auth/bigquery"
|
223
224
|
config.email = "XXXXXX@developer.gserviceaccount.com"
|
225
|
+
config.retries = 1
|
224
226
|
end
|
225
227
|
```
|
226
228
|
|
229
|
+
retries indicates the number of times to retry on recoverable errors (no retries if set to one or not present)
|
230
|
+
|
227
231
|
And authorize client:
|
228
232
|
|
229
233
|
```ruby
|
@@ -1,7 +1,7 @@
|
|
1
1
|
GoogleBigquery::Config.setup do |config|
|
2
2
|
#config.pass_phrase = "notasecret"
|
3
3
|
#config.key_file = Rails.root + "/config/XXXXkey_file.p12"
|
4
|
-
#config.client_id = "XXXXX.apps.googleusercontent.com"
|
5
4
|
#config.scope = "https://www.googleapis.com/auth/bigquery"
|
6
5
|
#config.email = "XXXXXX@developer.gserviceaccount.com"
|
7
|
-
|
6
|
+
#config.retries = 1
|
7
|
+
end
|
data/lib/google_bigquery/auth.rb
CHANGED
@@ -5,15 +5,16 @@ module GoogleBigquery
|
|
5
5
|
cattr_accessor :api, :client
|
6
6
|
|
7
7
|
def initialize
|
8
|
-
config = GoogleBigquery::Config
|
9
|
-
@key = Google::APIClient::
|
10
|
-
@asserter = Google::APIClient::JWTAsserter.new( config.email, config.scope, @key)
|
8
|
+
@config = GoogleBigquery::Config
|
9
|
+
@key = Google::APIClient::KeyUtils.load_from_pkcs12(@config.key_file, @config.pass_phrase)
|
10
|
+
@asserter = Google::APIClient::JWTAsserter.new( @config.email, @config.scope, @key)
|
11
11
|
end
|
12
12
|
|
13
13
|
def authorize
|
14
|
-
@client = Google::APIClient.new
|
15
|
-
@client.authorization = @asserter.authorize
|
16
|
-
@
|
14
|
+
@client = Google::APIClient.new
|
15
|
+
@client.authorization = @asserter.authorize
|
16
|
+
@client.retries = @config.retries.to_i if @config.retries.to_i > 1
|
17
|
+
@api = @client.discovered_api('bigquery', 'v2')
|
17
18
|
self.class.api = @api
|
18
19
|
self.class.client = @client
|
19
20
|
end
|
@@ -12,8 +12,7 @@ end
|
|
12
12
|
GoogleBigquery::Config.setup do |config|
|
13
13
|
config.pass_phrase = config_options["pass_phrase"]
|
14
14
|
config.key_file = config_options["key_file"]
|
15
|
-
config.client_id = config_options["client_id"]
|
16
15
|
config.scope = config_options["scope"]
|
17
16
|
config.profile_id = config_options["profile_id"]
|
18
17
|
config.email = config_options["email"]
|
19
|
-
end
|
18
|
+
end
|
@@ -6,9 +6,7 @@ describe "Config class" do
|
|
6
6
|
GoogleBigquery::Config.setup do |config|
|
7
7
|
config.pass_phrase = config_options["pass_phrase"]
|
8
8
|
config.key_file = config_options["key_file"]
|
9
|
-
config.client_id = config_options["client_id"]
|
10
9
|
config.scope = config_options["scope"]
|
11
|
-
config.profile_id = config_options["profile_id"]
|
12
10
|
config.email = config_options["email"]
|
13
11
|
end
|
14
12
|
end
|
@@ -17,7 +15,6 @@ describe "Config class" do
|
|
17
15
|
GoogleBigquery::Config.pass_phrase.should_not be_empty
|
18
16
|
GoogleBigquery::Config.key_file.should_not be_empty
|
19
17
|
GoogleBigquery::Config.scope.should_not be_empty
|
20
|
-
GoogleBigquery::Config.profile_id.should_not be_empty
|
21
18
|
GoogleBigquery::Config.email.should_not be_empty
|
22
19
|
end
|
23
20
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
2
|
require 'rspec'
|
3
|
-
require 'debugger'
|
3
|
+
require 'debugger' if Gem.ruby_version < Gem::Version.new('2.0')
|
4
4
|
require File.join(File.dirname(__FILE__), '../lib', 'google_bigquery')
|
5
5
|
require 'stringio'
|
6
6
|
require "pry"
|
@@ -36,12 +36,10 @@ RSpec.configure do |config|
|
|
36
36
|
GoogleBigquery::Config.setup do |config|
|
37
37
|
config.pass_phrase = config_options["pass_phrase"]
|
38
38
|
config.key_file = config_options["key_file"]
|
39
|
-
config.client_id = config_options["client_id"]
|
40
39
|
config.scope = config_options["scope"]
|
41
|
-
config.profile_id = config_options["profile_id"]
|
42
40
|
config.email = config_options["email"]
|
41
|
+
config.retries = config_options["retries"]
|
43
42
|
end
|
44
|
-
GoogleBigquery::Config
|
45
43
|
@project = config_options["options"]
|
46
44
|
end
|
47
45
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigbroda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- miguel michelson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|