google-gax 0.7.0 → 0.7.1
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/operation.rb +3 -12
- data/lib/google/gax/version.rb +1 -1
- data/spec/google/gax/operation_spec.rb +3 -15
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec76cdd33b0b9fa99cacf500fe8dfdffb3d74a38
|
4
|
+
data.tar.gz: ab2e1c9b639932dc661876970be636890339a2bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 641d4a0082acdff4c9d33e22e9e6ce06686863c913d3401fb8204dc0ecaaa5bce4ae2d20296557f6e4f6ce160d64ad9653db9762af31913347de04d3d1152548
|
7
|
+
data.tar.gz: da6bf4c3bdb36641c935ebd0e9bf23254927d23d2a117ed6d07d5330ee28ad272f887503de9ced775b0161d8d19304c94091e6be6a6308108a74fe5a95d0a80f
|
data/lib/google/gax/operation.rb
CHANGED
@@ -32,6 +32,7 @@ require 'time'
|
|
32
32
|
# These must be loaded separate from google/gax to avoid circular dependency.
|
33
33
|
require 'google/gax/constants'
|
34
34
|
require 'google/gax/settings'
|
35
|
+
require 'google/protobuf/well_known_types'
|
35
36
|
|
36
37
|
module Google
|
37
38
|
module Gax
|
@@ -135,7 +136,7 @@ module Google
|
|
135
136
|
def results
|
136
137
|
return nil unless done?
|
137
138
|
return @grpc_op.error if error?
|
138
|
-
|
139
|
+
@grpc_op.response.unpack(@result_type)
|
139
140
|
end
|
140
141
|
|
141
142
|
# Returns the metadata of an operation. If a type is provided,
|
@@ -150,7 +151,7 @@ module Google
|
|
150
151
|
# The metadata of the operation. Can be nil.
|
151
152
|
def metadata
|
152
153
|
return nil if @grpc_op.metadata.nil?
|
153
|
-
|
154
|
+
@grpc_op.metadata.unpack(@metadata_type)
|
154
155
|
end
|
155
156
|
|
156
157
|
# Checks if the operation is done. This does not send a new api call,
|
@@ -238,16 +239,6 @@ module Google
|
|
238
239
|
@callbacks.push(block)
|
239
240
|
end
|
240
241
|
end
|
241
|
-
|
242
|
-
# TODO: This is from google/protobuf/well_known_types.rb.
|
243
|
-
# Using google/protobuf in gax-ruby is currently causing a dependency
|
244
|
-
# conflict with grpc. When grpc depends on google-protobuf v3.1.0
|
245
|
-
# remove this function and use Google::Protobuf::Any#unpack.
|
246
|
-
def unpack(any_pb, klass)
|
247
|
-
type_name = any_pb.type_url.split('/')[-1]
|
248
|
-
return klass.decode(any_pb.value) if type_name == klass.descriptor.name
|
249
|
-
end
|
250
|
-
private :unpack
|
251
242
|
end
|
252
243
|
end
|
253
244
|
end
|
data/lib/google/gax/version.rb
CHANGED
@@ -33,6 +33,7 @@ require 'google/gax/operation'
|
|
33
33
|
require 'google/gax/settings'
|
34
34
|
require 'google/gax/constants'
|
35
35
|
require 'google/protobuf/any_pb'
|
36
|
+
require 'google/protobuf/well_known_types'
|
36
37
|
require 'google/rpc/status_pb'
|
37
38
|
require 'google/longrunning/operations_pb'
|
38
39
|
|
@@ -56,26 +57,13 @@ class MockLroClient
|
|
56
57
|
end
|
57
58
|
end
|
58
59
|
|
59
|
-
# TODO: This is from google/protobuf/well_known_types.rb.
|
60
|
-
# Using google/protobuf in gax-ruby is currently causing a dependency
|
61
|
-
# conflict with grpc. When grpc depends on google-protobuf v3.1.0
|
62
|
-
# remove this function and use Google::Protobuf::Any#pack.
|
63
|
-
def pack(any_pb, msg, type_url_prefix = 'type.googleapis.com/')
|
64
|
-
if type_url_prefix.empty? || type_url_prefix[-1] != '/'
|
65
|
-
any_pb.type_url = "#{type_url_prefix}/#{msg.class.descriptor.name}"
|
66
|
-
else
|
67
|
-
any_pb.type_url = "#{type_url_prefix}#{msg.class.descriptor.name}"
|
68
|
-
end
|
69
|
-
any_pb.value = msg.to_proto
|
70
|
-
end
|
71
|
-
|
72
60
|
RESULT_ANY = Google::Protobuf::Any.new
|
73
61
|
RESULT = Google::Rpc::Status.new(code: 1, message: 'Result')
|
74
|
-
pack(
|
62
|
+
RESULT_ANY.pack(RESULT)
|
75
63
|
|
76
64
|
METADATA_ANY = Google::Protobuf::Any.new
|
77
65
|
METADATA = Google::Rpc::Status.new(code: 2, message: 'Metadata')
|
78
|
-
pack(
|
66
|
+
METADATA_ANY.pack(METADATA)
|
79
67
|
|
80
68
|
DONE_GET_METHOD = proc do
|
81
69
|
GrpcOp.new(done: true, response: RESULT_ANY, metadata: METADATA_ANY)
|
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: 0.7.
|
4
|
+
version: 0.7.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: 2017-
|
11
|
+
date: 2017-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: googleauth
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.
|
61
|
+
version: '3.2'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.
|
68
|
+
version: '3.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rly
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|