big_shift 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23fd6d24d216c3453b6dabffd4b3f5bd17a3b68c
4
- data.tar.gz: cfec79938ce528f75d886ab73aaa8d3eb67ca88e
3
+ metadata.gz: 87b2c7fe32a944200af6758ce383745c57a0870b
4
+ data.tar.gz: d7562991089a865a9de97617914d3d20c56839ea
5
5
  SHA512:
6
- metadata.gz: c91709f44f4c26633c9d90b1caf732ab6631dffaccf21a33db50087a7344640273e900ea8af4c95b3131e540f3eb2a10fe86a660f9de9e4ba3dc221809413b0c
7
- data.tar.gz: 0c25524a9db25f478091cde261052a7d3388e841b5aafc9dc82dcddd24b71d8e09b2d98d3c9212f6f8f6881842696ef837680ccc5ad5478e5488305b50abbb6b
6
+ metadata.gz: 1d9573f27091efc79cf6e3dd6555e353bb9352c3f955d63d45835bb1f4e1a4e68dd324b2c7806f1ced6eb087a3610a3fa24a69685a360054c1c0dc3f62c320e7
7
+ data.tar.gz: bee096c4b929fee9fa888a74b5aecb3867d0a90a211a433241970826dc3e4cd0b1e4ba20fac016f78ae5288daa5d0949e4352312069b7e562ee9ef94295f390c
data/lib/big_shift.rb CHANGED
@@ -19,6 +19,8 @@ require_relative 'big_shift/commands/base_command'
19
19
  require_relative 'big_shift/commands/base_table_command'
20
20
  require_relative 'big_shift/commands/create_table_command'
21
21
  require_relative 'big_shift/commands/insert_rows_command'
22
+ require_relative 'big_shift/commands/create_view_command'
23
+ require_relative 'big_shift/commands/update_view_command'
22
24
 
23
25
  require_relative 'big_shift/services/access_token_service'
24
26
 
@@ -23,6 +23,10 @@ module BigShift
23
23
  connection.post url, request_body, headers
24
24
  end
25
25
 
26
+ def patch
27
+ connection.patch url, request_body, headers
28
+ end
29
+
26
30
  def url
27
31
  connection.build_url endpoint, params
28
32
  end
@@ -0,0 +1,29 @@
1
+ module BigShift
2
+ class CreateViewCommand < BaseCommand
3
+ def initialize(name, query)
4
+ @name = name
5
+ @query = query
6
+ end
7
+
8
+ def on_execute
9
+ CreateTableResponse.new post
10
+ end
11
+
12
+ def endpoint
13
+ 'tables'
14
+ end
15
+
16
+ def body
17
+ {
18
+ 'tableReference' => {
19
+ 'projectId' => project_id,
20
+ 'datasetId' => dataset_id,
21
+ 'tableId' => @name,
22
+ },
23
+ 'view': {
24
+ 'query': @query
25
+ }
26
+ }
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ module BigShift
2
+ class UpdateViewCommand < BaseCommand
3
+ def initialize(name, query)
4
+ @name = name
5
+ @query = query
6
+ end
7
+
8
+ def on_execute
9
+ CreateTableResponse.new patch
10
+ end
11
+
12
+ def endpoint
13
+ "tables/#{@name}"
14
+ end
15
+
16
+ def body
17
+ {
18
+ 'tableReference' => {
19
+ 'projectId' => project_id,
20
+ 'datasetId' => dataset_id,
21
+ 'tableId' => @name,
22
+ },
23
+ 'view': {
24
+ 'query': @query
25
+ }
26
+ }
27
+ end
28
+ end
29
+ end
@@ -9,5 +9,13 @@ module BigShift
9
9
  def insert_rows(table_name, rows)
10
10
  InsertRowsCommand.execute table_name, rows
11
11
  end
12
+
13
+ def create_view(name, query)
14
+ CreateViewCommand.execute name, query
15
+ end
16
+
17
+ def update_view(name, query)
18
+ UpdateViewCommand.execute name, query
19
+ end
12
20
  end
13
21
  end
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: big_shift
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Herrick
8
- - Meagan Cooney
8
+ - Brett Ulrich
9
+ - data-wrangler
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2015-06-23 00:00:00.000000000 Z
13
+ date: 2015-12-09 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: faraday
@@ -180,7 +181,9 @@ files:
180
181
  - lib/big_shift/commands/base_command.rb
181
182
  - lib/big_shift/commands/base_table_command.rb
182
183
  - lib/big_shift/commands/create_table_command.rb
184
+ - lib/big_shift/commands/create_view_command.rb
183
185
  - lib/big_shift/commands/insert_rows_command.rb
186
+ - lib/big_shift/commands/update_view_command.rb
184
187
  - lib/big_shift/core.rb
185
188
  - lib/big_shift/models/access_token.rb
186
189
  - lib/big_shift/models/base_model.rb
@@ -212,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
215
  version: '0'
213
216
  requirements: []
214
217
  rubyforge_project:
215
- rubygems_version: 2.4.8
218
+ rubygems_version: 2.4.5
216
219
  signing_key:
217
220
  specification_version: 4
218
221
  summary: BigShift API interface