kura 0.4.1 → 0.4.2

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
  SHA256:
3
- metadata.gz: 6b1e26ce3831c008052f7c6d923e137dbcd75ab9ed1603020cd44ef66b1aec1a
4
- data.tar.gz: 5368c0a514c6e1ec1bb71991ff0628e0e92f838053d84dc29e55ef5b17ede8d3
3
+ metadata.gz: 2333eaf23a195c96789fec8b1a9f2f7ecae62be3437c1c492d8afa00c1438203
4
+ data.tar.gz: 88895cb72f099b98481235903fe3145de8fa07e13b9eb7f12a9ef1b2023a769c
5
5
  SHA512:
6
- metadata.gz: 9f8d0b1d35c0b082fe03517529e7f8d7e10a1f8acc307ecb2c8c3a67a047e4d00313443df148e9ae19bfca8ace00bf742bc57674dbc38f81601c35490360120a
7
- data.tar.gz: 939dc6e930cd52896c0acaf341ffed403491ab8fe18ae002560f22cb3bce39910606b52870d4b8165dad01115e213e4a8e9e0e131e78855082bb18d91ad1ffc5
6
+ metadata.gz: b830c2859892d4283ab44f583676ba7da8c4f4dfede607a3d9e8d0cf08fd540c08c2c5f56d2d91f6b4d238934f5d4141557dd669f7a7df23ae737fb4183ec479
7
+ data.tar.gz: afa73e1709e3310287f64165b5551598c9055646e97c891f669c5cdee6239e615a31890ef232b818910bf49bf33191fed7acece362d36921d08d986cae9e1247
data/ChangeLog.md CHANGED
@@ -1,3 +1,10 @@
1
+ # 0.4.2
2
+
3
+ ## Enhancements
4
+
5
+ * Add `jobs` to wrap `jobs.list` API method (https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/list)
6
+ * Add `Job#children` as a shortcut method to obtain child jobs for SCRIPT type job.
7
+
1
8
  # 0.4.1
2
9
 
3
10
  ## Fixes
data/README.md CHANGED
@@ -43,7 +43,7 @@ client = Kura.client(.., scope: "https://www.googleapis.com/auth/drive")
43
43
 
44
44
  ```
45
45
  client.load("dataset", "table", "gs://mybucket/data.csv", wait: 120)
46
- client.query("SELECT * FROM [dataset.table];", dataset_id: "dest_dataset", table_id: dest_table", wait: 120)
46
+ client.query("SELECT * FROM [dataset.table];", dataset_id: "dest_dataset", table_id: "dest_table", wait: 120)
47
47
  client.extract("dataset", "result", "gs://mybucket/extracted.csv", wait: 120)
48
48
  client.copy("src_dataset", "src_table", "dest_dataset", "dest_table", wait: 120)
49
49
  ```
data/lib/kura.rb CHANGED
@@ -50,7 +50,13 @@ module Kura
50
50
  elsif project_id.is_a?(Hash)
51
51
  credential = project_id
52
52
  else
53
- raise ArgumentError, "#{self.class.name}.client accept JSON credential file path or decoded Hash object."
53
+ begin
54
+ # get project id from metadata server
55
+ project_id = URI.open("http://metadata/computeMetadata/v1/project/project-id", "Metadata-Flavor" => "Google") do |f| f.read end
56
+ return self::Client.new(default_project_id: project_id)
57
+ rescue
58
+ raise ArgumentError, "#{self.class.name}.client accept JSON credential file path or decoded Hash object."
59
+ end
54
60
  end
55
61
  project_id = credential["project_id"]
56
62
  email_address = credential["client_email"]
data/lib/kura/client.rb CHANGED
@@ -596,6 +596,27 @@ module Kura
596
596
  insert_job(configuration, wait: wait, job_id: job_id, project_id: job_project_id, &blk)
597
597
  end
598
598
 
599
+ def jobs(project_id: @default_project_id,
600
+ all_users: nil,
601
+ max_creation_time: nil,
602
+ min_creation_time: nil,
603
+ max_results: nil,
604
+ page_token: nil,
605
+ parent_job_id: nil,
606
+ projection: nil,
607
+ state_filter: nil)
608
+ @api.list_jobs(
609
+ project_id,
610
+ all_users: all_users,
611
+ max_creation_time: max_creation_time,
612
+ min_creation_time: min_creation_time,
613
+ max_results: max_results,
614
+ page_token: page_token,
615
+ parent_job_id: parent_job_id,
616
+ projection: projection,
617
+ state_filter: state_filter)
618
+ end
619
+
599
620
  def job(job_id, location: nil, project_id: @default_project_id, &blk)
600
621
  if blk
601
622
  @api.get_job(project_id, job_id, location: location) do |j, e|
@@ -16,5 +16,9 @@ class Google::Apis::BigqueryV2::Job
16
16
  def inspect
17
17
  "<##{self.class} job_id=#{self.job_reference.job_id rescue nil}>"
18
18
  end
19
+
20
+ def children
21
+ kura_api.jobs(parent_job_id: self.job_reference.job_id)
22
+ end
19
23
  end
20
24
 
data/lib/kura/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kura
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kura
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chikanaga Tomoyuki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-23 00:00:00.000000000 Z
11
+ date: 2020-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-api-client
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
156
  requirements: []
157
- rubygems_version: 3.0.3
157
+ rubygems_version: 3.1.2
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: Interface to BigQuery API v2.