gapic-common 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/gapic/call_options.rb +9 -1
- data/lib/gapic/common/version.rb +1 -1
- data/lib/gapic/grpc/service_stub/rpc_call.rb +1 -1
- data/lib/gapic/operation.rb +11 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f3b2d13b4fd64ffb7bf7d92dc1f76dda06c00d1f6a6f7347a8f196e19467dbd
|
4
|
+
data.tar.gz: 40990944ff16cd31ff46cd708e8efd8d607b958cbbb7dea3ef2e207561a0a5ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60db7a415a89b0fc864eeeef8e377e943c6f669c2ea4ce5c707af8617934f27ead164bf615e9d9dbe68706ce19a218196da2154b2a1c1132e81c2031d15525da
|
7
|
+
data.tar.gz: 203ee7c2a5245287db6b0b043dc42dfee37d31e47294201540bd5c4a351a5db51131273c58e8ffdcfb196198019e97d26faa336f7cb3aae7698124ef6baaf962
|
data/CHANGELOG.md
CHANGED
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
@@ -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,14 @@ 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
|
-
#
|
87
|
-
def initialize grpc_op, client, result_type: nil, metadata_type: nil
|
86
|
+
# @param options [Gapic::CallOptions] call options for this operation
|
87
|
+
def initialize grpc_op, client, result_type: nil, metadata_type: nil, options: {}
|
88
88
|
@grpc_op = grpc_op
|
89
89
|
@client = client
|
90
90
|
@result_type = result_type
|
91
91
|
@metadata_type = metadata_type
|
92
92
|
@on_done_callbacks = []
|
93
|
+
@options = options
|
93
94
|
end
|
94
95
|
|
95
96
|
##
|
@@ -196,7 +197,7 @@ module Gapic
|
|
196
197
|
#
|
197
198
|
def cancel options: nil
|
198
199
|
# Converts hash and nil to an options object
|
199
|
-
options = Gapic::CallOptions.new
|
200
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
200
201
|
|
201
202
|
@client.cancel_operation({ name: @grpc_op.name }, options)
|
202
203
|
end
|
@@ -209,7 +210,7 @@ module Gapic
|
|
209
210
|
#
|
210
211
|
def delete options: nil
|
211
212
|
# Converts hash and nil to an options object
|
212
|
-
options = Gapic::CallOptions.new
|
213
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
213
214
|
|
214
215
|
@client.delete_operation({ name: @grpc_op.name }, options)
|
215
216
|
end
|
@@ -223,9 +224,13 @@ module Gapic
|
|
223
224
|
# @return [Gapic::Operation] Since this method changes internal state, it returns itself.
|
224
225
|
#
|
225
226
|
def reload! options: nil
|
226
|
-
|
227
|
-
|
227
|
+
options = if options.respond_to? :to_h
|
228
|
+
options.to_h.merge @options.to_h
|
229
|
+
else
|
230
|
+
@options.to_h
|
231
|
+
end
|
228
232
|
|
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.2.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: 2020-
|
11
|
+
date: 2020-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|
@@ -180,14 +180,14 @@ dependencies:
|
|
180
180
|
name: rake
|
181
181
|
requirement: !ruby/object:Gem::Requirement
|
182
182
|
requirements:
|
183
|
-
- - "
|
183
|
+
- - ">="
|
184
184
|
- !ruby/object:Gem::Version
|
185
185
|
version: '12.0'
|
186
186
|
type: :development
|
187
187
|
prerelease: false
|
188
188
|
version_requirements: !ruby/object:Gem::Requirement
|
189
189
|
requirements:
|
190
|
-
- - "
|
190
|
+
- - ">="
|
191
191
|
- !ruby/object:Gem::Version
|
192
192
|
version: '12.0'
|
193
193
|
- !ruby/object:Gem::Dependency
|