reckoner_cdp 0.1.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: 676a986296672d387afef2efff263bd3c510f673680a3e587ef9ea269959e007
4
- data.tar.gz: 1bc6122596c19978a39aa9584e30f4be00ac0ae9541fcaec835fbc4302211a54
3
+ metadata.gz: 0d661170c1f5f49339573266a3ee9f0c6ce0c10d95f9d0a909bbf7b47cc94136
4
+ data.tar.gz: fddb7bcd553bef9b659a99902565387b4812ce2847eecbdf86bd31f6de2d463b
5
5
  SHA512:
6
- metadata.gz: 8fe63a5a7c0d15a253fb89a0782b48347e627731a0dfa74647a7e8e8f1810e7dc10788c28b051b15c0c8f5062f8e6d95bce027f6e247234cf3bcec9745e3e61c
7
- data.tar.gz: 18b8e6341a8ff2d72503c03bfd7ffe27127adb7fe49c4e6d866d7645dd2b1636a5cfe7d4efc63bb1abc040ea5afc4647d59c8c63ba41084e1d0e4c503f12a03c
6
+ metadata.gz: b99403da1390b0336f99c93c2f6d3970486cdcc026e86a57e3827dbf7719bee265df7a25399ed039d691240e891f8b6ad367e069ad647835edc35e72be41734b
7
+ data.tar.gz: 20dc1d1c5615a41c17e1a87bbd52c454ecd088b8354255fc5095e47ac381ba77f6f307c4db011f37602a89d372bddcba008a59ce9cea9be368261bed7162da6f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- reckoner_cdp (0.1.1)
4
+ reckoner_cdp (0.1.2)
5
5
  faraday_middleware (~> 0.12)
6
6
  google-api-client (~> 0.34)
7
7
  msgpack (~> 1.2)
@@ -11,22 +11,23 @@ GEM
11
11
  specs:
12
12
  addressable (2.7.0)
13
13
  public_suffix (>= 2.0.2, < 5.0)
14
- declarative (0.0.10)
14
+ declarative (0.0.20)
15
15
  declarative-option (0.1.0)
16
16
  diff-lcs (1.3)
17
17
  faraday (0.17.3)
18
18
  multipart-post (>= 1.2, < 3)
19
19
  faraday_middleware (0.14.0)
20
20
  faraday (>= 0.7.4, < 1.0)
21
- google-api-client (0.39.0)
21
+ google-api-client (0.48.0)
22
22
  addressable (~> 2.5, >= 2.5.1)
23
23
  googleauth (~> 0.9)
24
24
  httpclient (>= 2.8.1, < 3.0)
25
25
  mini_mime (~> 1.0)
26
26
  representable (~> 3.0)
27
27
  retriable (>= 2.0, < 4.0)
28
+ rexml
28
29
  signet (~> 0.12)
29
- googleauth (0.12.0)
30
+ googleauth (0.14.0)
30
31
  faraday (>= 0.17.3, < 2.0)
31
32
  jwt (>= 1.4, < 3.0)
32
33
  memoist (~> 0.16)
@@ -34,20 +35,21 @@ GEM
34
35
  os (>= 0.9, < 2.0)
35
36
  signet (~> 0.14)
36
37
  httpclient (2.8.3)
37
- jwt (2.2.1)
38
+ jwt (2.2.2)
38
39
  memoist (0.16.2)
39
40
  mini_mime (1.0.2)
40
41
  msgpack (1.3.3)
41
- multi_json (1.14.1)
42
+ multi_json (1.15.0)
42
43
  multipart-post (2.1.1)
43
- os (1.1.0)
44
- public_suffix (4.0.4)
44
+ os (1.1.1)
45
+ public_suffix (4.0.6)
45
46
  rake (10.5.0)
46
47
  representable (3.0.4)
47
48
  declarative (< 0.1.0)
48
49
  declarative-option (< 0.2.0)
49
50
  uber (< 0.2.0)
50
51
  retriable (3.1.2)
52
+ rexml (3.2.4)
51
53
  rspec (3.8.0)
52
54
  rspec-core (~> 3.8.0)
53
55
  rspec-expectations (~> 3.8.0)
@@ -18,11 +18,11 @@ module Reckoner
18
18
  server_error: 500..599,
19
19
  }.freeze
20
20
 
21
- def initialize(json_key_path, endpoint, client_id, connection)
22
- @json_key_path = json_key_path
21
+ def initialize(token, endpoint, client_id, connection)
23
22
  @endpoint = endpoint || Reckoner::Cdp::STREAMING_ENDPOINT
24
23
  @client_id = client_id || Reckoner::Cdp::STREAMING_CLIENT_ID
25
24
  @connection = connection || default_connection
25
+ @token = token || ""
26
26
  end
27
27
 
28
28
  private
@@ -34,7 +34,7 @@ module Reckoner
34
34
  req.options.open_timeout = 5
35
35
  req.headers['Date'] = Time.now.httpdate
36
36
  req.headers['Content-Type'] = 'application/json'
37
- req.headers['Authorization'] = authorization_header(req)
37
+ req.headers['Authorization'] = 'Bearer ' + @token
38
38
  end
39
39
  check_error(res)
40
40
  res.body
@@ -66,24 +66,6 @@ module Reckoner
66
66
  end
67
67
  end
68
68
 
69
- def authorization_header(req)
70
- iamcredentials = Google::Apis::IamcredentialsV1
71
- service = iamcredentials::IAMCredentialsService.new
72
-
73
- scopes = ['https://www.googleapis.com/auth/iam', 'https://www.googleapis.com/auth/cloud-platform']
74
- service.authorization = Google::Auth::ServiceAccountCredentials.make_creds(
75
- json_key_io: File.open(@json_key_path, "r"),
76
- scope: scopes
77
- )
78
-
79
- email = File.open(@json_key_path, "r") { |file| JSON.parse(file.read)["client_email"]}
80
- resource = 'projects/-/serviceAccounts/' + email
81
- req = iamcredentials::GenerateIdTokenRequest.new(audience: @client_id, include_email: true)
82
- service.generate_service_account_id_token(resource, req) do |result, err|
83
- return 'Bearer ' + result.token
84
- end
85
- end
86
-
87
69
  end
88
70
  end
89
71
  end
@@ -3,8 +3,8 @@ require_relative 'api/streaming_core'
3
3
  module Reckoner
4
4
  module Cdp
5
5
  class Client
6
- def initialize(json_key_path, endpoint: nil, client_id: nil, connection: nil)
7
- @json_key_path = json_key_path
6
+ def initialize(token, endpoint: nil, client_id: nil, connection: nil)
7
+ @token = token
8
8
  @endpoint = endpoint
9
9
  @client_id = client_id
10
10
  @connection = connection
@@ -18,7 +18,7 @@ module Reckoner
18
18
 
19
19
  def streaming_api
20
20
  @streaming_api ||= Reckoner::Cdp::API::StreamingCore.new(
21
- @json_key_path,
21
+ @token,
22
22
  @endpoint,
23
23
  @client_id,
24
24
  @connection
@@ -1,5 +1,5 @@
1
1
  module Reckoner
2
2
  module Cdp
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reckoner_cdp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ms03
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-13 00:00:00.000000000 Z
11
+ date: 2020-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
140
  requirements: []
141
- rubygems_version: 3.0.3
141
+ rubygems_version: 3.1.4
142
142
  signing_key:
143
143
  specification_version: 4
144
144
  summary: writer to reckoner-cdp