google-gax 1.2.0 → 1.3.0
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 +4 -4
- data/lib/google/gax/grpc.rb +12 -5
- data/lib/google/gax/settings.rb +3 -3
- data/lib/google/gax/version.rb +1 -1
- data/spec/google/gax/grpc_spec.rb +53 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d54006c2b0494a7908f5510bc48ef77a98c2ff02
|
4
|
+
data.tar.gz: d19197493f156c95c153f9c8a2cd3501ecdffc67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 806f18271c7a31698639466e5a6900598226eb53ed807cfc7ca84b17f898aa5c5b77cb68478dc0c329d5e299943143f6d4b974d3045a53b277d3bde272bf97e9
|
7
|
+
data.tar.gz: 671837be39ed1a7fe642f9652ab766535b44e07dc46892cd56499990d57a26ba318846de9fed4918eca8db1ca06c94dd21c52c06769a0e275aef37b6b50d59f0
|
data/lib/google/gax/grpc.rb
CHANGED
@@ -100,10 +100,15 @@ module Google
|
|
100
100
|
# The OAuth scopes for this service. This parameter is ignored if
|
101
101
|
# a custom metadata_transformer is supplied.
|
102
102
|
#
|
103
|
+
# @param interceptors [Array<GRPC::ClientInterceptor>] An array of
|
104
|
+
# GRPC::ClientInterceptor objects that will be used for
|
105
|
+
# intercepting calls before they are executed
|
106
|
+
# Interceptors are an EXPERIMENTAL API.
|
107
|
+
#
|
103
108
|
# @raise [ArgumentError] if a combination channel, chan_creds, and
|
104
109
|
# updater_proc are passed.
|
105
110
|
#
|
106
|
-
# @yield [address, creds]
|
111
|
+
# @yield [address, creds, channel_override, interceptors]
|
107
112
|
# the generated gRPC method to create a stub.
|
108
113
|
#
|
109
114
|
# @return A gRPC client stub.
|
@@ -112,13 +117,15 @@ module Google
|
|
112
117
|
channel: nil,
|
113
118
|
chan_creds: nil,
|
114
119
|
updater_proc: nil,
|
115
|
-
scopes: nil
|
120
|
+
scopes: nil,
|
121
|
+
interceptors: [])
|
116
122
|
verify_params(channel, chan_creds, updater_proc)
|
117
123
|
address = "#{service_path}:#{port}"
|
118
124
|
if channel
|
119
|
-
yield(address, nil, channel_override: channel
|
125
|
+
yield(address, nil, channel_override: channel,
|
126
|
+
interceptors: interceptors)
|
120
127
|
elsif chan_creds
|
121
|
-
yield(address, chan_creds)
|
128
|
+
yield(address, chan_creds, interceptors: interceptors)
|
122
129
|
else
|
123
130
|
if updater_proc.nil?
|
124
131
|
auth_creds = Google::Auth.get_application_default(scopes)
|
@@ -126,7 +133,7 @@ module Google
|
|
126
133
|
end
|
127
134
|
call_creds = GRPC::Core::CallCredentials.new(updater_proc)
|
128
135
|
chan_creds = GRPC::Core::ChannelCredentials.new.compose(call_creds)
|
129
|
-
yield(address, chan_creds)
|
136
|
+
yield(address, chan_creds, interceptors: interceptors)
|
130
137
|
end
|
131
138
|
end
|
132
139
|
|
data/lib/google/gax/settings.rb
CHANGED
@@ -463,9 +463,9 @@ module Google
|
|
463
463
|
# API client config file.
|
464
464
|
# @param config_overrides [Hash] A hash in the same structure of
|
465
465
|
# client_config to override the settings.
|
466
|
-
# @param retry_names [Hash] A
|
467
|
-
#
|
468
|
-
#
|
466
|
+
# @param retry_names [Hash] A hash mapping the string names
|
467
|
+
# used in the standard API client config file to API response
|
468
|
+
# status codes.
|
469
469
|
# @param timeout [Numeric] The timeout parameter for all API calls
|
470
470
|
# in this dictionary.
|
471
471
|
# @param bundle_descriptors [Hash{String => BundleDescriptor}]
|
data/lib/google/gax/version.rb
CHANGED
@@ -45,21 +45,66 @@ describe Google::Gax::Grpc do
|
|
45
45
|
|
46
46
|
expect do |blk|
|
47
47
|
Google::Gax::Grpc.create_stub('service', 'port', &blk)
|
48
|
-
end.to yield_with_args('service:port', composed_mock)
|
48
|
+
end.to yield_with_args('service:port', composed_mock, interceptors: [])
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'yields given channel' do
|
52
52
|
mock = instance_double(GRPC::Core::Channel)
|
53
|
+
interceptors = instance_double(Array)
|
53
54
|
expect do |blk|
|
54
|
-
Google::Gax::Grpc.create_stub(
|
55
|
-
|
55
|
+
Google::Gax::Grpc.create_stub(
|
56
|
+
'service', 'port', channel: mock, interceptors: interceptors, &blk
|
57
|
+
)
|
58
|
+
end.to yield_with_args(
|
59
|
+
'service:port', nil, channel_override: mock, interceptors: interceptors
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'yields given channel and interceptors' do
|
64
|
+
mock = instance_double(GRPC::Core::Channel)
|
65
|
+
expect do |blk|
|
66
|
+
Google::Gax::Grpc.create_stub(
|
67
|
+
'service', 'port', channel: mock, &blk
|
68
|
+
)
|
69
|
+
end.to yield_with_args(
|
70
|
+
'service:port', nil, channel_override: mock, interceptors: []
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'yields given interceptors' do
|
75
|
+
interceptors = instance_double(Array)
|
76
|
+
channel = instance_double(GRPC::Core::Channel)
|
77
|
+
expect do |blk|
|
78
|
+
Google::Gax::Grpc.create_stub(
|
79
|
+
'service', 'port', channel: channel, interceptors: interceptors, &blk
|
80
|
+
)
|
81
|
+
end.to yield_with_args(
|
82
|
+
'service:port', anything, channel_override: channel,
|
83
|
+
interceptors: interceptors
|
84
|
+
)
|
56
85
|
end
|
57
86
|
|
58
87
|
it 'yields given channel credentials' do
|
59
88
|
mock = instance_double(GRPC::Core::ChannelCredentials)
|
60
89
|
expect do |blk|
|
61
|
-
Google::Gax::Grpc.create_stub(
|
62
|
-
|
90
|
+
Google::Gax::Grpc.create_stub(
|
91
|
+
'service', 'port', chan_creds: mock, &blk
|
92
|
+
)
|
93
|
+
end.to yield_with_args(
|
94
|
+
'service:port', mock, interceptors: []
|
95
|
+
)
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'yields given channel credentials and interceptors' do
|
99
|
+
mock = instance_double(GRPC::Core::ChannelCredentials)
|
100
|
+
interceptors = instance_double(Array)
|
101
|
+
expect do |blk|
|
102
|
+
Google::Gax::Grpc.create_stub(
|
103
|
+
'service', 'port', chan_creds: mock, interceptors: interceptors, &blk
|
104
|
+
)
|
105
|
+
end.to yield_with_args(
|
106
|
+
'service:port', mock, interceptors: interceptors
|
107
|
+
)
|
63
108
|
end
|
64
109
|
|
65
110
|
it 'yields channel credentials composed of the given updater_proc' do
|
@@ -78,7 +123,9 @@ describe Google::Gax::Grpc do
|
|
78
123
|
Google::Gax::Grpc.create_stub(
|
79
124
|
'service', 'port', updater_proc: updater_proc, &blk
|
80
125
|
)
|
81
|
-
end.to yield_with_args(
|
126
|
+
end.to yield_with_args(
|
127
|
+
'service:port', composed_chan_creds, interceptors: []
|
128
|
+
)
|
82
129
|
end
|
83
130
|
|
84
131
|
it 'raise an argument error if multiple creds are passed in' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-gax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.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: 2018-
|
11
|
+
date: 2018-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: googleauth
|