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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 018bda7792b890c29d878d4cc8704c60cbd09ba7
4
- data.tar.gz: ef8f8184451a788e3e061ed00717fa79c2c63f9a
3
+ metadata.gz: 26a124f01089b56c69ba302ef201cfb34d758d69
4
+ data.tar.gz: 45592ad512c5a78941f8ffc1844b6462aaab8710
5
5
  SHA512:
6
- metadata.gz: 2d2cc171199476855ce721a8c061134db405440789ddc55679a8df356e829a531fa8e0accbdba4515f1b96e7a03bf717e144a7cab58340a3fa3ed262c04ffade
7
- data.tar.gz: a60fdbe72b3bfeda31c61e313085ae8ec5757e671560ab8225f3fc3efe9971c37522e9302d093abbc5266a4e784e7ba1b235aa67cedd1fba0f8c128e6129bc1f
6
+ metadata.gz: 9a85ed5f8a73a0c19dc3735add3edb714e0fa7f5dcb35a5c2354d2d5ac40c79d6da5f264eabfc05ef2b9ad4f7c75c3ecd4ad1e87ad03f68fdfc9f9934694581f
7
+ data.tar.gz: 70ea14ef513d18a3b7bb67f01578aced7b0164a970f2ffd52a193a08eb7776b7231ff529325fdae7381d30f690870d0753d71421b841b904ba67119e6fd3f8b6
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem "certified"
7
- gem "debugger"
7
+ gem "debugger", platform: :ruby_19
8
8
  gem "pry"
9
9
  gem 'pry-remote'
10
10
  gem 'pry-nav'
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
- end
6
+ #config.retries = 1
7
+ end
@@ -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::PKCS12.load_key(config.key_file, config.pass_phrase)
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
- @api = @client.discovered_api("bigquery",'v2')
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
@@ -9,9 +9,8 @@ module GoogleBigquery
9
9
 
10
10
  mattr_accessor :pass_phrase,
11
11
  :key_file,
12
- :client_id,
13
12
  :scope,
14
- :profile_id,
15
- :email
13
+ :email,
14
+ :retries
16
15
  end
17
- end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module GoogleBigquery
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  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
@@ -1,6 +1,5 @@
1
1
  pass_phrase: "notasecret"
2
2
  pem: XXXXXXX-privatekey.p12
3
- client_id: "XXXXXXXXX.apps.googleusercontent.com"
4
3
  scope: "https://www.googleapis.com/auth/bigquery"
5
4
  profile_id: "XXXXXX"
6
5
  email: "XXXXXXX@developer.gserviceaccount.com"
@@ -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
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-07-09 00:00:00.000000000 Z
11
+ date: 2014-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler