gapic-common 0.1.0 → 0.2.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
  SHA256:
3
- metadata.gz: 0143f9d02c69a21d4ade186df96585efeb5c54867b8113997b84c0c12db8514e
4
- data.tar.gz: 0b3491651b124ac6bf44c2b634212471bba01db45ab547cc8f4dad8d08f9301c
3
+ metadata.gz: 9f3b2d13b4fd64ffb7bf7d92dc1f76dda06c00d1f6a6f7347a8f196e19467dbd
4
+ data.tar.gz: 40990944ff16cd31ff46cd708e8efd8d607b958cbbb7dea3ef2e207561a0a5ba
5
5
  SHA512:
6
- metadata.gz: 4f6c9f8e0d878f5f5a257bf44f0bb9e055fc1fdde8a1f7294763e2d13c5cea662e19dff99ff74675ad582572c67e511845381c3392876003d6a7a055f42d63cf
7
- data.tar.gz: da2abcd93a21714474b5449b73cf3df246a94ffd6c8e1d9078b034be9f839265579069fe997af359ee283cc609e187b8b249020cf3972daf68ccec9b18736c5e
6
+ metadata.gz: 60db7a415a89b0fc864eeeef8e377e943c6f669c2ea4ce5c707af8617934f27ead164bf615e9d9dbe68706ce19a218196da2154b2a1c1132e81c2031d15525da
7
+ data.tar.gz: 203ee7c2a5245287db6b0b043dc42dfee37d31e47294201540bd5c4a351a5db51131273c58e8ffdcfb196198019e97d26faa336f7cb3aae7698124ef6baaf962
@@ -1,5 +1,10 @@
1
1
  # Release History
2
2
 
3
+ ### 0.2.0 / 2020-03-17
4
+
5
+ * Support default call options in Gapic::Operation
6
+ * Fix implicit kwarg warnings under Ruby 2.7
7
+
3
8
  ### 0.1.0 / 2020-01-09
4
9
 
5
10
  Initial release
@@ -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 retry_policy.to_h if retry_policy.respond_to? :to_h
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
@@ -14,6 +14,6 @@
14
14
 
15
15
  module Gapic
16
16
  module Common
17
- VERSION = "0.1.0".freeze
17
+ VERSION = "0.2.0".freeze
18
18
  end
19
19
  end
@@ -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 options.to_h if options.respond_to? :to_h
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
 
@@ -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 options.to_h if options.respond_to? :to_h
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 options.to_h if options.respond_to? :to_h
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
- # Converts hash and nil to an options object
227
- options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h
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.1.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-01-09 00:00:00.000000000 Z
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