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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34fe59f1bfcd32a791b319ddb7ac77d8dadf7922
4
- data.tar.gz: 0d77001cd6917bc5fe0b4bc9960b189437b22e0f
3
+ metadata.gz: d54006c2b0494a7908f5510bc48ef77a98c2ff02
4
+ data.tar.gz: d19197493f156c95c153f9c8a2cd3501ecdffc67
5
5
  SHA512:
6
- metadata.gz: bb35c9359dd55066155c0607a647365a7b75cf0cef86ba7e91dd539542b0437915db0b29c09b00e57a83d48f35161ecfc938e00ea47643c2dbf219c456790742
7
- data.tar.gz: 00bb1dcce002d4ee67450a5825bfd02d949583b1909707c5dabed153ddf329d00d89ea364b9ac9953830952c40a7e6f8893e815e3e9b3f35d48ec2c1e94ba996
6
+ metadata.gz: 806f18271c7a31698639466e5a6900598226eb53ed807cfc7ca84b17f898aa5c5b77cb68478dc0c329d5e299943143f6d4b974d3045a53b277d3bde272bf97e9
7
+ data.tar.gz: 671837be39ed1a7fe642f9652ab766535b44e07dc46892cd56499990d57a26ba318846de9fed4918eca8db1ca06c94dd21c52c06769a0e275aef37b6b50d59f0
@@ -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
 
@@ -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 dictionary mapping the strings
467
- # referring to response status codes to the Python objects
468
- # representing those codes.
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}]
@@ -29,6 +29,6 @@
29
29
 
30
30
  module Google
31
31
  module Gax
32
- VERSION = '1.2.0'.freeze
32
+ VERSION = '1.3.0'.freeze
33
33
  end
34
34
  end
@@ -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('service', 'port', channel: mock, &blk)
55
- end.to yield_with_args('service:port', nil, channel_override: mock)
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('service', 'port', chan_creds: mock, &blk)
62
- end.to yield_with_args('service:port', mock)
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('service:port', composed_chan_creds)
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.2.0
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-04-11 00:00:00.000000000 Z
11
+ date: 2018-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: googleauth