active_remote 3.0.0 → 3.1.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 +4 -4
- data/lib/active_remote/errors.rb +32 -1
- data/lib/active_remote/rpc_adapters/protobuf_adapter.rb +29 -1
- data/lib/active_remote/version.rb +1 -1
- metadata +44 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d760866cbe3d6f0cacdf06891814483c95ed63d
|
4
|
+
data.tar.gz: 25892d899421ca22630b5d1323296656bc2efba1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95a486e9d4af7765cf41667b0bb43fada6d20eb9e698fb72fa26b8e35b5f2302cd6d61912dfe1e01cebd8541035d792de079d26ba8c14f9fbd3f515c33f735d7
|
7
|
+
data.tar.gz: fdc545f109e1cfcb29145a01ac6fdadaae6523aad64390ff77263db19130e59bf94428e7dab13c51763c3f2b16d2a2070636ec8f94f49875465c0f4a3a4fa4a2
|
data/lib/active_remote/errors.rb
CHANGED
@@ -23,7 +23,7 @@ module ActiveRemote
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
# Raised by
|
26
|
+
# Raised by ActiveRemote::Base.find when remote record is not found when
|
27
27
|
# searching with the given arguments.
|
28
28
|
class RemoteRecordNotFound < ActiveRemoteError
|
29
29
|
attr_accessor :remote_record_class
|
@@ -47,4 +47,35 @@ module ActiveRemote
|
|
47
47
|
|
48
48
|
class UnknownAttributeError < ActiveRemoteError
|
49
49
|
end
|
50
|
+
|
51
|
+
# Errors from Protobuf
|
52
|
+
class BadRequestDataError < ActiveRemoteError
|
53
|
+
end
|
54
|
+
|
55
|
+
class BadRequestProtoError < ActiveRemoteError
|
56
|
+
end
|
57
|
+
|
58
|
+
class ServiceNotFoundError < ActiveRemoteError
|
59
|
+
end
|
60
|
+
|
61
|
+
class MethodNotFoundError < ActiveRemoteError
|
62
|
+
end
|
63
|
+
|
64
|
+
class RpcError < ActiveRemoteError
|
65
|
+
end
|
66
|
+
|
67
|
+
class RpcFailedError < ActiveRemoteError
|
68
|
+
end
|
69
|
+
|
70
|
+
class InvalidRequestProtoError < ActiveRemoteError
|
71
|
+
end
|
72
|
+
|
73
|
+
class BadResponseProtoError < ActiveRemoteError
|
74
|
+
end
|
75
|
+
|
76
|
+
class UnknownHostError < ActiveRemoteError
|
77
|
+
end
|
78
|
+
|
79
|
+
class IOError < ActiveRemoteError
|
80
|
+
end
|
50
81
|
end
|
@@ -22,7 +22,8 @@ module ActiveRemote
|
|
22
22
|
service_class.client.__send__(rpc_method, @last_request) do |c|
|
23
23
|
# In the event of service failure, raise the error.
|
24
24
|
c.on_failure do |error|
|
25
|
-
|
25
|
+
protobuf_error = protobuf_error_class(error)
|
26
|
+
raise protobuf_error, error.message
|
26
27
|
end
|
27
28
|
|
28
29
|
# In the event of service success, assign the response.
|
@@ -36,6 +37,33 @@ module ActiveRemote
|
|
36
37
|
|
37
38
|
private
|
38
39
|
|
40
|
+
def protobuf_error_class(error)
|
41
|
+
case error.error_type
|
42
|
+
when ::Protobuf::Socketrpc::ErrorReason::BAD_REQUEST_DATA
|
43
|
+
::ActiveRemote::BadRequestDataError
|
44
|
+
when ::Protobuf::Socketrpc::ErrorReason::BAD_REQUEST_PROTO
|
45
|
+
::ActiveRemote::BadRequestProtoError
|
46
|
+
when ::Protobuf::Socketrpc::ErrorReason::SERVICE_NOT_FOUND
|
47
|
+
::ActiveRemote::ServiceNotFoundError
|
48
|
+
when ::Protobuf::Socketrpc::ErrorReason::METHOD_NOT_FOUND
|
49
|
+
::ActiveRemote::MethodNotFoundError
|
50
|
+
when ::Protobuf::Socketrpc::ErrorReason::RPC_ERROR
|
51
|
+
::ActiveRemote::RpcError
|
52
|
+
when ::Protobuf::Socketrpc::ErrorReason::RPC_FAILED_ERROR
|
53
|
+
::ActiveRemote::RpcFailedError
|
54
|
+
when ::Protobuf::Socketrpc::ErrorReason::INVALID_REQUEST_PROTO
|
55
|
+
::ActiveRemote::InvalidRequestProtoError
|
56
|
+
when ::Protobuf::Socketrpc::ErrorReason::BAD_RESPONSE_PROTO
|
57
|
+
::ActiveRemote::BadResponseProtoError
|
58
|
+
when ::Protobuf::Socketrpc::ErrorReason::UNKNOWN_HOST
|
59
|
+
::ActiveRemote::UnknownHostError
|
60
|
+
when ::Protobuf::Socketrpc::ErrorReason::IO_ERROR
|
61
|
+
::ActiveRemote::IOError
|
62
|
+
else
|
63
|
+
ActiveRemoteError
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
39
67
|
# Return a protobuf request object for the given rpc request.
|
40
68
|
#
|
41
69
|
def request(rpc_method, request_args)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_remote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Hutchison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -262,8 +262,48 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
262
|
version: '0'
|
263
263
|
requirements: []
|
264
264
|
rubyforge_project:
|
265
|
-
rubygems_version: 2.6.
|
265
|
+
rubygems_version: 2.6.11
|
266
266
|
signing_key:
|
267
267
|
specification_version: 4
|
268
268
|
summary: Active Record for your platform
|
269
|
-
test_files:
|
269
|
+
test_files:
|
270
|
+
- spec/lib/active_remote/association_spec.rb
|
271
|
+
- spec/lib/active_remote/attributes_spec.rb
|
272
|
+
- spec/lib/active_remote/base_spec.rb
|
273
|
+
- spec/lib/active_remote/dirty_spec.rb
|
274
|
+
- spec/lib/active_remote/dsl_spec.rb
|
275
|
+
- spec/lib/active_remote/integration_spec.rb
|
276
|
+
- spec/lib/active_remote/persistence_spec.rb
|
277
|
+
- spec/lib/active_remote/primary_key_spec.rb
|
278
|
+
- spec/lib/active_remote/query_attribute_spec.rb
|
279
|
+
- spec/lib/active_remote/rpc_spec.rb
|
280
|
+
- spec/lib/active_remote/scope_keys_spec.rb
|
281
|
+
- spec/lib/active_remote/search_spec.rb
|
282
|
+
- spec/lib/active_remote/serialization_spec.rb
|
283
|
+
- spec/lib/active_remote/serializers/protobuf_spec.rb
|
284
|
+
- spec/lib/active_remote/typecasting_spec.rb
|
285
|
+
- spec/lib/active_remote/validations_spec.rb
|
286
|
+
- spec/spec_helper.rb
|
287
|
+
- spec/support/definitions/author.proto
|
288
|
+
- spec/support/definitions/category.proto
|
289
|
+
- spec/support/definitions/error.proto
|
290
|
+
- spec/support/definitions/post.proto
|
291
|
+
- spec/support/definitions/serializer.proto
|
292
|
+
- spec/support/definitions/tag.proto
|
293
|
+
- spec/support/helpers.rb
|
294
|
+
- spec/support/models.rb
|
295
|
+
- spec/support/models/author.rb
|
296
|
+
- spec/support/models/category.rb
|
297
|
+
- spec/support/models/default_author.rb
|
298
|
+
- spec/support/models/message_with_options.rb
|
299
|
+
- spec/support/models/no_attributes.rb
|
300
|
+
- spec/support/models/post.rb
|
301
|
+
- spec/support/models/tag.rb
|
302
|
+
- spec/support/models/typecasted_author.rb
|
303
|
+
- spec/support/protobuf.rb
|
304
|
+
- spec/support/protobuf/author.pb.rb
|
305
|
+
- spec/support/protobuf/category.pb.rb
|
306
|
+
- spec/support/protobuf/error.pb.rb
|
307
|
+
- spec/support/protobuf/post.pb.rb
|
308
|
+
- spec/support/protobuf/serializer.pb.rb
|
309
|
+
- spec/support/protobuf/tag.pb.rb
|