gapic-common 0.0.2 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/lib/gapic/call_options.rb +9 -1
- data/lib/gapic/common/version.rb +1 -1
- data/lib/gapic/config.rb +1 -1
- data/lib/gapic/grpc/service_stub/rpc_call.rb +1 -1
- data/lib/gapic/operation.rb +11 -6
- metadata +15 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b273a9734d7790746ebdd37a36fe67e7cd8d02d595ef98ece290f1659836c84
|
4
|
+
data.tar.gz: ecbf4561705eb6dcb260562c452dbb2f13ac803c08ea7b6df17ee811fa010a87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33dd83d1eafc82dd3fe79340e3780bbffd228e5373cd3f1c5ce28adea3c76896638e54a71e0a95a7de275d654460b1fc719766429f8d533b0849dbee57ccc9a1
|
7
|
+
data.tar.gz: b0094f935d8109734023d21c97f8d7436d8cc456a5882fe67ce1fc8f32ebf6643438dac8a14a90f7e14e772d0afe15fba31eae46535e9041eb6e6b58965060e1
|
data/CHANGELOG.md
CHANGED
@@ -1,2 +1,22 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 0.3.1 / 2020-06-19
|
4
|
+
|
5
|
+
* Fix file permissions
|
6
|
+
|
7
|
+
### 0.3.0 / 2020-06-18
|
8
|
+
|
9
|
+
* Update the dependency on google-protobuf to 3.12.2
|
10
|
+
|
11
|
+
### 0.2.1 / 2020-06-02
|
12
|
+
|
13
|
+
* Fix a crash when resetting a config field to nil when it has a parent but no default
|
14
|
+
|
15
|
+
### 0.2.0 / 2020-03-17
|
16
|
+
|
17
|
+
* Support default call options in Gapic::Operation
|
18
|
+
* Fix implicit kwarg warnings under Ruby 2.7
|
19
|
+
|
20
|
+
### 0.1.0 / 2020-01-09
|
21
|
+
|
22
|
+
Initial release
|
data/lib/gapic/call_options.rb
CHANGED
@@ -42,7 +42,7 @@ module Gapic
|
|
42
42
|
#
|
43
43
|
def initialize timeout: nil, metadata: nil, retry_policy: nil
|
44
44
|
# Converts hash and nil to a policy object
|
45
|
-
retry_policy = RetryPolicy.new
|
45
|
+
retry_policy = RetryPolicy.new(**retry_policy.to_h) if retry_policy.respond_to? :to_h
|
46
46
|
|
47
47
|
@timeout = timeout # allow to be nil so it can be overridden
|
48
48
|
@metadata = metadata.to_h # Ensure always hash, even for nil
|
@@ -64,5 +64,13 @@ module Gapic
|
|
64
64
|
@metadata = metadata.merge @metadata if metadata
|
65
65
|
@retry_policy.apply_defaults retry_policy if @retry_policy.respond_to? :apply_defaults
|
66
66
|
end
|
67
|
+
|
68
|
+
def to_h
|
69
|
+
{
|
70
|
+
timeout: timeout,
|
71
|
+
metadata: metadata,
|
72
|
+
retry_policy: retry_policy
|
73
|
+
}
|
74
|
+
end
|
67
75
|
end
|
68
76
|
end
|
data/lib/gapic/common/version.rb
CHANGED
data/lib/gapic/config.rb
CHANGED
@@ -88,7 +88,7 @@ module Gapic
|
|
88
88
|
valid_value ||= begin
|
89
89
|
# Allow nil if parent config has the getter method.
|
90
90
|
parent = instance_variable_get :@parent_config if instance_variable_defined? :@parent_config
|
91
|
-
parent&.respond_to?
|
91
|
+
parent&.respond_to? name_setter
|
92
92
|
end
|
93
93
|
end
|
94
94
|
raise ArgumentError unless valid_value
|
@@ -112,7 +112,7 @@ module Gapic
|
|
112
112
|
#
|
113
113
|
def call request, options: nil
|
114
114
|
# Converts hash and nil to an options object
|
115
|
-
options = Gapic::CallOptions.new
|
115
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
116
116
|
deadline = calculate_deadline options
|
117
117
|
metadata = options.metadata
|
118
118
|
|
data/lib/gapic/operation.rb
CHANGED
@@ -83,13 +83,15 @@ module Gapic
|
|
83
83
|
# looked up. Optional.
|
84
84
|
# @param metadata_type [Class] The class type to be unpacked from the metadata. If not provided the class type
|
85
85
|
# will be looked up. Optional.
|
86
|
+
# @param options [Gapic::CallOptions] call options for this operation
|
86
87
|
#
|
87
|
-
def initialize grpc_op, client, result_type: nil, metadata_type: nil
|
88
|
+
def initialize grpc_op, client, result_type: nil, metadata_type: nil, options: {}
|
88
89
|
@grpc_op = grpc_op
|
89
90
|
@client = client
|
90
91
|
@result_type = result_type
|
91
92
|
@metadata_type = metadata_type
|
92
93
|
@on_done_callbacks = []
|
94
|
+
@options = options
|
93
95
|
end
|
94
96
|
|
95
97
|
##
|
@@ -196,7 +198,7 @@ module Gapic
|
|
196
198
|
#
|
197
199
|
def cancel options: nil
|
198
200
|
# Converts hash and nil to an options object
|
199
|
-
options = Gapic::CallOptions.new
|
201
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
200
202
|
|
201
203
|
@client.cancel_operation({ name: @grpc_op.name }, options)
|
202
204
|
end
|
@@ -209,7 +211,7 @@ module Gapic
|
|
209
211
|
#
|
210
212
|
def delete options: nil
|
211
213
|
# Converts hash and nil to an options object
|
212
|
-
options = Gapic::CallOptions.new
|
214
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
213
215
|
|
214
216
|
@client.delete_operation({ name: @grpc_op.name }, options)
|
215
217
|
end
|
@@ -223,9 +225,12 @@ module Gapic
|
|
223
225
|
# @return [Gapic::Operation] Since this method changes internal state, it returns itself.
|
224
226
|
#
|
225
227
|
def reload! options: nil
|
226
|
-
|
227
|
-
|
228
|
-
|
228
|
+
options = if options.respond_to? :to_h
|
229
|
+
options.to_h.merge @options.to_h
|
230
|
+
else
|
231
|
+
@options.to_h
|
232
|
+
end
|
233
|
+
options = Gapic::CallOptions.new(**options)
|
229
234
|
gax_op = @client.get_operation({ name: @grpc_op.name }, options)
|
230
235
|
@grpc_op = gax_op.grpc_op
|
231
236
|
|
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.
|
4
|
+
version: 0.3.1
|
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:
|
11
|
+
date: 2020-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|
@@ -16,14 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.12'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.12.2
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '3.
|
29
|
+
version: '3.12'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.12.2
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: googleapis-common-protos
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,14 +104,14 @@ dependencies:
|
|
98
104
|
requirements:
|
99
105
|
- - "~>"
|
100
106
|
- !ruby/object:Gem::Version
|
101
|
-
version: '1.
|
107
|
+
version: '1.5'
|
102
108
|
type: :development
|
103
109
|
prerelease: false
|
104
110
|
version_requirements: !ruby/object:Gem::Requirement
|
105
111
|
requirements:
|
106
112
|
- - "~>"
|
107
113
|
- !ruby/object:Gem::Version
|
108
|
-
version: '1.
|
114
|
+
version: '1.5'
|
109
115
|
- !ruby/object:Gem::Dependency
|
110
116
|
name: google-style
|
111
117
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,14 +186,14 @@ dependencies:
|
|
180
186
|
name: rake
|
181
187
|
requirement: !ruby/object:Gem::Requirement
|
182
188
|
requirements:
|
183
|
-
- - "
|
189
|
+
- - ">="
|
184
190
|
- !ruby/object:Gem::Version
|
185
191
|
version: '12.0'
|
186
192
|
type: :development
|
187
193
|
prerelease: false
|
188
194
|
version_requirements: !ruby/object:Gem::Requirement
|
189
195
|
requirements:
|
190
|
-
- - "
|
196
|
+
- - ">="
|
191
197
|
- !ruby/object:Gem::Version
|
192
198
|
version: '12.0'
|
193
199
|
- !ruby/object:Gem::Dependency
|
@@ -268,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
268
274
|
- !ruby/object:Gem::Version
|
269
275
|
version: '0'
|
270
276
|
requirements: []
|
271
|
-
rubygems_version: 3.
|
277
|
+
rubygems_version: 3.0.3
|
272
278
|
signing_key:
|
273
279
|
specification_version: 4
|
274
280
|
summary: Common code for GAPIC-generated API clients
|