gapic-common 0.13.0 → 0.14.0

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: 5b5964ec91020c76501e2424be598b345a114a16515fe209135e46f552100d4e
4
- data.tar.gz: 4a08e08fe15b6c6d6a3ad3097895a7d01bcfe3377f1392946a0cfe671ca97fdf
3
+ metadata.gz: ea69666c3f5162e9949825974c29af5ca636527a25e67d0ce034c2bb6c39b201
4
+ data.tar.gz: 68df57288727233549f5ababcd296b545bd4a1e10bdc29caae1891019c3995ba
5
5
  SHA512:
6
- metadata.gz: a0270a8d4933fda1f6297233f3465ae4fed20d34ebbf4bb766f228fe13746b5508c97179eb7c0b763d104c52079f59765b514c32a1d6cb2d61196791f007595a
7
- data.tar.gz: 437633278a8640eee28a975c7821270b11c2127c72970e0259c29b5b643db37b8d394ac5ae1cd80cb367e10c1384311cc018e0a276804dfda7d8a91f9fffb13a
6
+ metadata.gz: 8c83345123a2739aa89f31aefb00288c8ae7e831af653a654872601a2e646ddd9b7d7356aa82e403b5c2571cae2bd437fbf4ff8c38e70822cfc18c89ea89f883
7
+ data.tar.gz: a95b2ec76934bec8140e6c65b627644833143f313117cd86d867dcda0e3bfdf00407f86c8b33d0f52165de5549c3207119a8b5b506cba5b9da8c41a58846cf78
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Release History
2
2
 
3
+ ### 0.14.0 (2022-11-08)
4
+
5
+ #### Features
6
+
7
+ * add support for different types of credentials to REST
8
+ #### Bug Fixes
9
+
10
+ * deadlock fix ([#845](https://github.com/googleapis/gapic-generator-ruby/issues/845))
11
+
3
12
  ### 0.13.0 (2022-10-26)
4
13
 
5
14
  #### Features
@@ -14,6 +14,6 @@
14
14
 
15
15
  module Gapic
16
16
  module Common
17
- VERSION = "0.13.0".freeze
17
+ VERSION = "0.14.0".freeze
18
18
  end
19
19
  end
@@ -18,22 +18,43 @@ module Gapic
18
18
  # Registers the middleware with Faraday
19
19
  module FaradayMiddleware
20
20
  ##
21
+ # @private
21
22
  # Request middleware that constructs the Authorization HTTP header
22
23
  # using ::Google::Auth::Credentials
23
24
  #
24
25
  class GoogleAuthorization < Faraday::Middleware
25
26
  ##
27
+ # @private
26
28
  # @param app [#call]
27
- # @param credentials [::Google::Auth::Credentials]
29
+ # @param credentials [Google::Auth::Credentials, Signet::OAuth2::Client, Symbol, Proc]
30
+ # Provides the means for authenticating requests made by
31
+ # the client. This parameter can be many types:
32
+ # * A `Google::Auth::Credentials` uses a the properties of its represented keyfile for authenticating requests
33
+ # made by this client.
34
+ # * A `Signet::OAuth2::Client` object used to apply the OAuth credentials.
35
+ # * A `Proc` will be used as an updater_proc for the auth token.
36
+ # * A `Symbol` is treated as a signal that authentication is not required.
37
+ #
28
38
  def initialize app, credentials
29
- @credentials = credentials
39
+ @updater_proc = case credentials
40
+ when Symbol
41
+ credentials
42
+ else
43
+ updater_proc = credentials.updater_proc if credentials.respond_to? :updater_proc
44
+ updater_proc ||= credentials if credentials.is_a? Proc
45
+ raise ArgumentError, "invalid credentials (#{credentials.class})" if updater_proc.nil?
46
+ updater_proc
47
+ end
30
48
  super app
31
49
  end
32
50
 
51
+ # @private
33
52
  # @param env [Faraday::Env]
34
53
  def call env
35
- auth_hash = @credentials.client.apply({})
36
- env.request_headers["Authorization"] = auth_hash[:authorization]
54
+ unless @updater_proc.is_a? Symbol
55
+ auth_hash = @updater_proc.call({})
56
+ env.request_headers["Authorization"] = auth_hash[:authorization]
57
+ end
37
58
 
38
59
  @app.call env
39
60
  end
@@ -44,6 +44,7 @@ module Gapic
44
44
 
45
45
  Thread.new do
46
46
  yield @in_q, @out_q
47
+ @out_q.enq nil
47
48
  rescue StandardError => e
48
49
  @out_q.push e
49
50
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gapic-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google API Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-26 00:00:00.000000000 Z
11
+ date: 2022-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday