bigbroda 0.0.7 → 0.1.0.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Appraisals +15 -0
  3. data/Gemfile +1 -0
  4. data/README.md +39 -21
  5. data/Rakefile +5 -2
  6. data/{google_bigquery.gemspec → bigbroda.gemspec} +2 -2
  7. data/gemfiles/rails_3.gemfile +20 -0
  8. data/gemfiles/rails_4.0.3.gemfile +20 -0
  9. data/gemfiles/rails_4.0.3.gemfile.lock +176 -0
  10. data/gemfiles/rails_4.1.gemfile +20 -0
  11. data/gemfiles/rails_4.1.gemfile.lock +182 -0
  12. data/gemfiles/rails_4.2.gemfile +20 -0
  13. data/gemfiles/rails_4.2.gemfile.lock +202 -0
  14. data/gemfiles/rails_4.gemfile +20 -0
  15. data/gemfiles/rails_4.gemfile.lock +176 -0
  16. data/lib/active_record/connection_adapters/bigquery_adapter.rb +32 -601
  17. data/lib/active_record/connection_adapters/rails_41.rb +607 -0
  18. data/lib/active_record/connection_adapters/rails_42.rb +628 -0
  19. data/lib/{google_bigquery → bigbroda}/auth.rb +3 -3
  20. data/lib/{google_bigquery → bigbroda}/client.rb +3 -3
  21. data/lib/{google_bigquery → bigbroda}/config.rb +1 -1
  22. data/lib/{google_bigquery → bigbroda}/dataset.rb +23 -23
  23. data/lib/{google_bigquery → bigbroda}/engine.rb +4 -4
  24. data/lib/{google_bigquery → bigbroda}/jobs.rb +28 -28
  25. data/lib/bigbroda/project.rb +16 -0
  26. data/lib/{google_bigquery → bigbroda}/railtie.rb +3 -3
  27. data/lib/{google_bigquery → bigbroda}/table.rb +19 -19
  28. data/lib/{google_bigquery → bigbroda}/table_data.rb +7 -7
  29. data/lib/bigbroda/version.rb +3 -0
  30. data/lib/bigbroda.rb +27 -0
  31. data/lib/generators/{google_bigquery → bigbroda}/install/install_generator.rb +2 -2
  32. data/lib/generators/templates/{bigquery.rb.erb → bigbroda.rb.erb} +1 -1
  33. data/spec/dummy/config/application.rb +1 -1
  34. data/spec/functional/adapter/adapter_spec.rb +40 -38
  35. data/spec/functional/auth_spec.rb +3 -3
  36. data/spec/functional/config_spec.rb +5 -5
  37. data/spec/functional/dataset_spec.rb +19 -19
  38. data/spec/functional/project_spec.rb +4 -4
  39. data/spec/functional/table_data_spec.rb +13 -13
  40. data/spec/functional/table_spec.rb +30 -30
  41. data/spec/spec_helper.rb +2 -2
  42. metadata +32 -20
  43. data/lib/google_bigquery/project.rb +0 -16
  44. data/lib/google_bigquery/version.rb +0 -3
  45. data/lib/google_bigquery.rb +0 -27
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '../../spec_helper')
3
3
  describe "Config class" do
4
4
  before(:all) do
5
5
 
6
- GoogleBigquery::Config.setup do |config|
6
+ BigBroda::Config.setup do |config|
7
7
  config.pass_phrase = config_options["pass_phrase"]
8
8
  config.key_file = config_options["key_file"]
9
9
  config.scope = config_options["scope"]
@@ -12,10 +12,10 @@ describe "Config class" do
12
12
  end
13
13
 
14
14
  it "has all the keys required" do
15
- GoogleBigquery::Config.pass_phrase.should_not be_empty
16
- GoogleBigquery::Config.key_file.should_not be_empty
17
- GoogleBigquery::Config.scope.should_not be_empty
18
- GoogleBigquery::Config.email.should_not be_empty
15
+ BigBroda::Config.pass_phrase.should_not be_empty
16
+ BigBroda::Config.key_file.should_not be_empty
17
+ BigBroda::Config.scope.should_not be_empty
18
+ BigBroda::Config.email.should_not be_empty
19
19
  end
20
20
 
21
21
  end
@@ -5,70 +5,70 @@ describe "Dataset", :vcr => { :allow_unused_http_interactions => true } do
5
5
  before(:all) do
6
6
  VCR.use_cassette("Dataset/authorize_config") do
7
7
  config_setup
8
- @auth = GoogleBigquery::Auth.new
8
+ @auth = BigBroda::Auth.new
9
9
  @auth.authorize
10
10
  @project = config_options["email"].match(/(\d*)/)[0]
11
11
  end
12
12
  end
13
13
 
14
- before :each do
14
+ before :each do
15
15
  @name = "rspec_schema"
16
16
  end
17
17
 
18
18
  it ".list", :vcr do
19
- expect(GoogleBigquery::Dataset.list(@project)["datasets"]).to_not be_empty
19
+ expect(BigBroda::Dataset.list(@project)["datasets"]).to_not be_empty
20
20
  end
21
21
 
22
- context "operations" do
23
- after(:each) do
22
+ context "operations" do
23
+ after(:each) do
24
24
  VCR.use_cassette('delete_each_dataset') do
25
- GoogleBigquery::Dataset.delete(@project, @name)
26
- end
25
+ BigBroda::Dataset.delete(@project, @name)
26
+ end
27
27
  end
28
28
 
29
29
  it "create & .delete", :vcr do
30
30
  expect(
31
- GoogleBigquery::Dataset.create(@project,
31
+ BigBroda::Dataset.create(@project,
32
32
  {"datasetReference"=> { "datasetId" => @name }} )["id"]
33
33
  ).to include @name
34
34
  end
35
35
 
36
36
  it ".update & delete", :vcr do
37
37
  expect(
38
- GoogleBigquery::Dataset.create(@project,
38
+ BigBroda::Dataset.create(@project,
39
39
  {"datasetReference"=> { "datasetId" =>@name }} )["id"]
40
40
  ).to include @name
41
-
41
+
42
42
  expect(
43
- GoogleBigquery::Dataset.update(@project, @name,
43
+ BigBroda::Dataset.update(@project, @name,
44
44
  {"datasetReference"=> {
45
- "datasetId" =>@name },
45
+ "datasetId" =>@name },
46
46
  "description"=> "foobar"} )["description"]
47
47
  ).to include "foobar"
48
48
  end
49
49
 
50
50
  it ".patch & delete", :vcr do
51
51
  expect(
52
- GoogleBigquery::Dataset.create(@project,
52
+ BigBroda::Dataset.create(@project,
53
53
  {"datasetReference"=> { "datasetId" =>@name }} )["id"]
54
54
  ).to include @name
55
-
55
+
56
56
  expect(
57
- GoogleBigquery::Dataset.patch(@project, @name,
57
+ BigBroda::Dataset.patch(@project, @name,
58
58
  {"datasetReference"=> {
59
- "datasetId" =>@name },
59
+ "datasetId" =>@name },
60
60
  "description"=> "foobar"} )["description"]
61
61
  ).to include "foobar"
62
62
  end
63
63
 
64
- it ".get & delete", :vcr do
64
+ it ".get & delete", :vcr do
65
65
  expect(
66
- GoogleBigquery::Dataset.create(@project,
66
+ BigBroda::Dataset.create(@project,
67
67
  {"datasetReference"=> { "datasetId" =>@name }} )["id"]
68
68
  ).to include @name
69
69
 
70
70
  expect(
71
- GoogleBigquery::Dataset.get(@project, @name )["id"]
71
+ BigBroda::Dataset.get(@project, @name )["id"]
72
72
  ).to include @name
73
73
  end
74
74
  end
@@ -1,23 +1,23 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '../../spec_helper')
2
2
 
3
3
  describe "Project", :vcr => { :allow_unused_http_interactions => true } do
4
-
4
+
5
5
  before(:all) do
6
6
  VCR.use_cassette("Project/authorize_config") do
7
7
  config_setup
8
- @auth = GoogleBigquery::Auth.new
8
+ @auth = BigBroda::Auth.new
9
9
  @auth.authorize
10
10
  @project = config_options["email"].match(/(\d*)/)[0]
11
11
  end
12
12
  end
13
13
 
14
- before :each do
14
+ before :each do
15
15
  @name = "rspec_schema"
16
16
  end
17
17
 
18
18
  it ".list", :vcr do
19
19
  expect(
20
- GoogleBigquery::Project.list["projects"].class
20
+ BigBroda::Project.list["projects"].class
21
21
  ).to be Array
22
22
  end
23
23
 
@@ -6,22 +6,22 @@ describe "TableData", :vcr => { :allow_unused_http_interactions => true } do
6
6
  before(:all) do
7
7
  VCR.use_cassette("TableData/authorize_config") do
8
8
  config_setup
9
- @auth = GoogleBigquery::Auth.new
9
+ @auth = BigBroda::Auth.new
10
10
  @auth.authorize
11
11
  @project = config_options["email"].match(/(\d*)/)[0]
12
12
  end
13
13
  end
14
14
 
15
- before :each do
15
+ before :each do
16
16
  @name = "rspec_schema"
17
17
  VCR.use_cassette("TableData/create_each", :record => :new_episodes) do
18
- GoogleBigquery::Dataset.create(@project, {"datasetReference"=> { "datasetId" => @name }} )["id"]
18
+ BigBroda::Dataset.create(@project, {"datasetReference"=> { "datasetId" => @name }} )["id"]
19
19
  @table_name = "users"
20
20
  @table_body = { "tableReference"=> {
21
21
  "projectId"=> @project,
22
22
  "datasetId"=> @name,
23
- "tableId"=> @table_name},
24
- "schema"=> [:fields=>[
23
+ "tableId"=> @table_name},
24
+ "schema"=> [:fields=>[
25
25
  {:name=> "name", :type=> "string", :mode => "REQUIRED"},
26
26
  {:name=> "age", :type=> "integer"},
27
27
  {:name=> "weight", :type=> "float"},
@@ -29,8 +29,8 @@ describe "TableData", :vcr => { :allow_unused_http_interactions => true } do
29
29
  ]
30
30
  ]
31
31
  }
32
- @table = GoogleBigquery::Table.create(@project, @name, @table_body )
33
-
32
+ @table = BigBroda::Table.create(@project, @name, @table_body )
33
+
34
34
  @rows = {"rows"=> [
35
35
  {
36
36
  "insertId"=> Time.now.to_i.to_s,
@@ -42,18 +42,18 @@ describe "TableData", :vcr => { :allow_unused_http_interactions => true } do
42
42
  end
43
43
  end
44
44
 
45
- after(:each) do
45
+ after(:each) do
46
46
  VCR.use_cassette("TableData/delete_each") do
47
- GoogleBigquery::Dataset.delete(@project, @name)
47
+ BigBroda::Dataset.delete(@project, @name)
48
48
  end
49
49
  end
50
50
 
51
- it "insertAll" do
51
+ it "insertAll" do
52
52
  VCR.use_cassette("TableData/insertAll2", :record => :new_episodes) do
53
- GoogleBigquery::TableData.create(@project, @name, @table_name , @rows )
53
+ BigBroda::TableData.create(@project, @name, @table_name , @rows )
54
54
  #sleep 60
55
- expect(GoogleBigquery::Jobs.query(@project, {"query"=> "SELECT * FROM [#{@name}.#{@table_name}] LIMIT 1000" })["rows"].empty?).to be false
56
- expect(GoogleBigquery::TableData.list(@project, @name, @table_name)["rows"].empty?).to be false
55
+ expect(BigBroda::Jobs.query(@project, {"query"=> "SELECT * FROM [#{@name}.#{@table_name}] LIMIT 1000" })["rows"].empty?).to be false
56
+ expect(BigBroda::TableData.list(@project, @name, @table_name)["rows"].empty?).to be false
57
57
  end
58
58
  end
59
59
 
@@ -6,33 +6,33 @@ describe "Table", :vcr => { :allow_unused_http_interactions => true } do
6
6
  before(:all) do
7
7
  VCR.use_cassette("Table/authorize_config") do
8
8
  config_setup
9
- @auth = GoogleBigquery::Auth.new
9
+ @auth = BigBroda::Auth.new
10
10
  @auth.authorize
11
11
  @project = config_options["email"].match(/(\d*)/)[0]
12
12
  end
13
13
  end
14
14
 
15
- context "operations" do
15
+ context "operations" do
16
16
 
17
- before :each do
17
+ before :each do
18
18
  VCR.use_cassette("Table/each_create") do
19
19
  @name = "rspec_schema"
20
- GoogleBigquery::Dataset.create(@project, {"datasetReference"=> { "datasetId" => @name }} )["id"]
20
+ BigBroda::Dataset.create(@project, {"datasetReference"=> { "datasetId" => @name }} )["id"]
21
21
  end
22
22
  end
23
23
 
24
- after(:each) do
24
+ after(:each) do
25
25
  VCR.use_cassette("Table/each_delete") do
26
- GoogleBigquery::Dataset.delete(@project, @name)
26
+ BigBroda::Dataset.delete(@project, @name)
27
27
  end
28
28
  end
29
29
 
30
30
  it "list", :vcr do
31
- expect(GoogleBigquery::Table.list(@project, @name )["totalItems"]).to be_zero
31
+ expect(BigBroda::Table.list(@project, @name )["totalItems"]).to be_zero
32
32
  end
33
33
 
34
- context "creation, edition" do
35
- before :each do
34
+ context "creation, edition" do
35
+ before :each do
36
36
  @table_name = "users"
37
37
  @table_body = { "tableReference"=> {
38
38
  "projectId"=> @project,
@@ -45,57 +45,57 @@ describe "Table", :vcr => { :allow_unused_http_interactions => true } do
45
45
  {:name=> "is_magic", :type=> "boolean"}
46
46
  ]
47
47
  ]
48
- }
48
+ }
49
49
  end
50
50
 
51
51
  it ".create & .delete", :vcr do
52
- GoogleBigquery::Table.create(@project, @name, @table_body )
52
+ BigBroda::Table.create(@project, @name, @table_body )
53
53
  #If successful, this method returns a Tables resource in the response body.
54
- expect(GoogleBigquery::Table.list(@project, @name )["totalItems"]).to be 1
55
- GoogleBigquery::Table.delete(@project, @name, @table_name )
56
- expect(GoogleBigquery::Table.list(@project, @name )["totalItems"]).to be 0
54
+ expect(BigBroda::Table.list(@project, @name )["totalItems"]).to be 1
55
+ BigBroda::Table.delete(@project, @name, @table_name )
56
+ expect(BigBroda::Table.list(@project, @name )["totalItems"]).to be 0
57
57
  end
58
58
 
59
59
  it ".create & .update .delete", :vcr do
60
- GoogleBigquery::Table.create(@project, @name, @table_body )
60
+ BigBroda::Table.create(@project, @name, @table_body )
61
61
 
62
62
  #If successful, this method returns a Tables resource in the response body.
63
- expect(GoogleBigquery::Table.list(@project, @name )["totalItems"]).to be 1
64
-
63
+ expect(BigBroda::Table.list(@project, @name )["totalItems"]).to be 1
64
+
65
65
  opts = {"tableReference"=> {
66
66
  "projectId" => @project,
67
67
  "datasetId" =>@name,
68
68
  "tableId" => @table_name },
69
69
  "description"=> "foobar"}
70
-
70
+
71
71
 
72
72
  expect(
73
- GoogleBigquery::Table.update(@project, @name, @table_name, opts )["description"]
73
+ BigBroda::Table.update(@project, @name, @table_name, opts )["description"]
74
74
  ).to include "foobar"
75
75
 
76
- GoogleBigquery::Table.delete(@project, @name, @table_name )
77
- expect(GoogleBigquery::Table.list(@project, @name )["totalItems"]).to be 0
76
+ BigBroda::Table.delete(@project, @name, @table_name )
77
+ expect(BigBroda::Table.list(@project, @name )["totalItems"]).to be 0
78
78
  end
79
79
 
80
80
 
81
81
  it ".create & .update .delete", :vcr do
82
- GoogleBigquery::Table.create(@project, @name, @table_body )
82
+ BigBroda::Table.create(@project, @name, @table_body )
83
83
  #If successful, this method returns a Tables resource in the response body.
84
- expect(GoogleBigquery::Table.list(@project, @name )["totalItems"]).to be 1
85
-
84
+ expect(BigBroda::Table.list(@project, @name )["totalItems"]).to be 1
85
+
86
86
  opts = {"tableReference"=> {
87
87
  "projectId" => @project,
88
88
  "datasetId" =>@name,
89
- "tableId" => @table_name },
89
+ "tableId" => @table_name },
90
90
  "description"=> "foobar"}
91
-
92
-
91
+
92
+
93
93
  expect(
94
- GoogleBigquery::Table.update(@project, @name, @table_name, opts)["description"]
94
+ BigBroda::Table.update(@project, @name, @table_name, opts)["description"]
95
95
  ).to include "foobar"
96
96
 
97
- GoogleBigquery::Table.delete(@project, @name, @table_name )
98
- expect(GoogleBigquery::Table.list(@project, @name )["totalItems"]).to be 0
97
+ BigBroda::Table.delete(@project, @name, @table_name )
98
+ expect(BigBroda::Table.list(@project, @name )["totalItems"]).to be 0
99
99
  end
100
100
 
101
101
  end
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  require 'rspec'
3
3
  require 'debugger' if Gem.ruby_version < Gem::Version.new('2.0')
4
- require File.join(File.dirname(__FILE__), '../lib', 'google_bigquery')
4
+ require File.join(File.dirname(__FILE__), '../lib', 'bigbroda')
5
5
  require 'stringio'
6
6
  require "pry"
7
7
  require "certified"
@@ -33,7 +33,7 @@ RSpec.configure do |config|
33
33
  end
34
34
 
35
35
  def config_setup
36
- GoogleBigquery::Config.setup do |config|
36
+ BigBroda::Config.setup do |config|
37
37
  config.pass_phrase = config_options["pass_phrase"]
38
38
  config.key_file = config_options["key_file"]
39
39
  config.scope = config_options["scope"]
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.7
4
+ version: 0.1.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - miguel michelson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-13 00:00:00.000000000 Z
11
+ date: 2015-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -120,28 +120,40 @@ files:
120
120
  - .rspec
121
121
  - .ruby-gemset
122
122
  - .ruby-version
123
+ - Appraisals
123
124
  - Gemfile
124
125
  - LICENSE.txt
125
126
  - README.md
126
127
  - Rakefile
127
- - google_bigquery.gemspec
128
+ - bigbroda.gemspec
129
+ - gemfiles/rails_3.gemfile
130
+ - gemfiles/rails_4.0.3.gemfile
131
+ - gemfiles/rails_4.0.3.gemfile.lock
132
+ - gemfiles/rails_4.1.gemfile
133
+ - gemfiles/rails_4.1.gemfile.lock
134
+ - gemfiles/rails_4.2.gemfile
135
+ - gemfiles/rails_4.2.gemfile.lock
136
+ - gemfiles/rails_4.gemfile
137
+ - gemfiles/rails_4.gemfile.lock
128
138
  - lib/active_record/connection_adapters/bigquery_adapter.rb
139
+ - lib/active_record/connection_adapters/rails_41.rb
140
+ - lib/active_record/connection_adapters/rails_42.rb
129
141
  - lib/active_record/tasks/bigquery_database_tasks.rb
130
- - lib/generators/google_bigquery/install/install_generator.rb
142
+ - lib/bigbroda.rb
143
+ - lib/bigbroda/auth.rb
144
+ - lib/bigbroda/client.rb
145
+ - lib/bigbroda/config.rb
146
+ - lib/bigbroda/dataset.rb
147
+ - lib/bigbroda/engine.rb
148
+ - lib/bigbroda/jobs.rb
149
+ - lib/bigbroda/project.rb
150
+ - lib/bigbroda/railtie.rb
151
+ - lib/bigbroda/table.rb
152
+ - lib/bigbroda/table_data.rb
153
+ - lib/bigbroda/version.rb
154
+ - lib/generators/bigbroda/install/install_generator.rb
131
155
  - lib/generators/templates/README
132
- - lib/generators/templates/bigquery.rb.erb
133
- - lib/google_bigquery.rb
134
- - lib/google_bigquery/auth.rb
135
- - lib/google_bigquery/client.rb
136
- - lib/google_bigquery/config.rb
137
- - lib/google_bigquery/dataset.rb
138
- - lib/google_bigquery/engine.rb
139
- - lib/google_bigquery/jobs.rb
140
- - lib/google_bigquery/project.rb
141
- - lib/google_bigquery/railtie.rb
142
- - lib/google_bigquery/table.rb
143
- - lib/google_bigquery/table_data.rb
144
- - lib/google_bigquery/version.rb
156
+ - lib/generators/templates/bigbroda.rb.erb
145
157
  - spec/dummy/.gitignore
146
158
  - spec/dummy/README.rdoc
147
159
  - spec/dummy/Rakefile
@@ -251,12 +263,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
251
263
  version: '0'
252
264
  required_rubygems_version: !ruby/object:Gem::Requirement
253
265
  requirements:
254
- - - '>='
266
+ - - '>'
255
267
  - !ruby/object:Gem::Version
256
- version: '0'
268
+ version: 1.3.1
257
269
  requirements: []
258
270
  rubyforge_project:
259
- rubygems_version: 2.0.6
271
+ rubygems_version: 2.4.5
260
272
  signing_key:
261
273
  specification_version: 4
262
274
  summary: This library is build on top of google-api-client, ActiveRecord >4 compatible
@@ -1,16 +0,0 @@
1
-
2
- module GoogleBigquery
3
- class Project < GoogleBigquery::Client
4
-
5
- attr_accessor :options
6
-
7
- def initialize( opts={})
8
- super
9
- end
10
-
11
- def self.list
12
- parse_response GoogleBigquery::Auth.client.execute( GoogleBigquery::Auth.api.projects.list)
13
- end
14
-
15
- end
16
- end
@@ -1,3 +0,0 @@
1
- module GoogleBigquery
2
- VERSION = "0.0.7"
3
- end
@@ -1,27 +0,0 @@
1
- $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
2
-
3
- require "google/api_client"
4
- require "active_support"
5
-
6
- module GoogleBigquery
7
-
8
- autoload :VERSION, 'google_bigquery/version.rb'
9
- autoload :Config, 'google_bigquery/config.rb'
10
- autoload :Auth, 'google_bigquery/auth.rb'
11
- autoload :Client, 'google_bigquery/client.rb'
12
- autoload :Project, 'google_bigquery/project.rb'
13
- autoload :Dataset, 'google_bigquery/dataset.rb'
14
- autoload :Table, 'google_bigquery/table.rb'
15
- autoload :TableData,'google_bigquery/table_data.rb'
16
- autoload :Jobs, 'google_bigquery/jobs.rb'
17
-
18
- if defined?(::Rails::Railtie)
19
- autoload :Rails, 'google_bigquery/engine.rb' if ::Rails.version >= '3.1'
20
- end
21
-
22
- if defined?(::Rails::Railtie)
23
- autoload :Rails, 'google_bigquery/engine.rb' if ::Rails.version >= '3.1'
24
- require File.join(File.dirname(__FILE__), *%w[google_bigquery railtie]) if ::Rails.version.to_s >= '3.1'
25
- end
26
-
27
- end