carrot_rpc 0.4.0 → 0.4.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 +25 -11
- data/lib/carrot_rpc/rpc_client.rb +21 -2
- data/lib/carrot_rpc/rpc_server.rb +1 -1
- data/lib/carrot_rpc/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b572d5d0139ae2c92283f32b320f917135f44dfd
|
4
|
+
data.tar.gz: 26e9cf234ef9c0f34c2856735424e2ffa43aa9b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db094e71f16fed9739c59444b294121db35813ccab080569779da8c63593f3d2732007fceb4efd955542a988896514c3c2b5dac06a5a51aa4005321140eec46a
|
7
|
+
data.tar.gz: 9f3a627db5a911aa7a8171ff0acf0671624d7c832f6de2420448493d3e19f4b6b05912e53511b0fed3b76535637f4f43755b602bc9475f9f5233e24557632d3f
|
data/CHANGELOG.md
CHANGED
@@ -3,25 +3,30 @@
|
|
3
3
|
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
|
4
4
|
|
5
5
|
- [Changelog](#changelog)
|
6
|
-
- [v0.
|
7
|
-
- [Enhancements](#enhancements)
|
6
|
+
- [v0.4.1](#v041)
|
8
7
|
- [Bug Fixes](#bug-fixes)
|
9
|
-
- [v0.
|
10
|
-
- [Enhancements](#enhancements
|
8
|
+
- [v0.4.0](#v040)
|
9
|
+
- [Enhancements](#enhancements)
|
11
10
|
- [Bug Fixes](#bug-fixes-1)
|
12
|
-
|
13
|
-
|
11
|
+
- [v0.3.0](#v030)
|
12
|
+
- [Enhancements](#enhancements-1)
|
14
13
|
- [Bug Fixes](#bug-fixes-2)
|
15
|
-
- [v0.2.
|
14
|
+
- [v0.2.3](#v023)
|
16
15
|
- [Enhancements](#enhancements-2)
|
17
16
|
- [Bug Fixes](#bug-fixes-3)
|
17
|
+
- [Upgrading](#upgrading)
|
18
|
+
- [v0.2.1](#v021)
|
19
|
+
- [Bug Fixes](#bug-fixes-4)
|
20
|
+
- [v0.2.0](#v020)
|
21
|
+
- [Enhancements](#enhancements-3)
|
22
|
+
- [Bug Fixes](#bug-fixes-5)
|
18
23
|
- [Incompatible Changes](#incompatible-changes)
|
19
24
|
- [v0.1.2](#v012)
|
20
|
-
- [Enhancements](#enhancements-3)
|
21
|
-
- [Bug Fixes](#bug-fixes-4)
|
22
|
-
- [v0.1.1](#v011)
|
23
25
|
- [Enhancements](#enhancements-4)
|
24
|
-
- [Bug Fixes](#bug-fixes-
|
26
|
+
- [Bug Fixes](#bug-fixes-6)
|
27
|
+
- [v0.1.1](#v011)
|
28
|
+
- [Enhancements](#enhancements-5)
|
29
|
+
- [Bug Fixes](#bug-fixes-7)
|
25
30
|
- [Incompatible Changes](#incompatible-changes-1)
|
26
31
|
|
27
32
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
@@ -29,6 +34,12 @@
|
|
29
34
|
# Changelog
|
30
35
|
All significant changes in the project are documented here.
|
31
36
|
|
37
|
+
## v0.4.1
|
38
|
+
### Bug Fixes
|
39
|
+
* [#23](https://githb.com/C-S-D/carrot_rpc/pull/23) - [shamil614](https://github.com/shamil614)
|
40
|
+
* Fixes errors for non-hash results being called with hash methods.
|
41
|
+
* RPC client parses response to account for jsonrpc error object as well as jsonrpc result object.
|
42
|
+
|
32
43
|
## v0.4.0
|
33
44
|
|
34
45
|
### Enhancements
|
@@ -38,6 +49,9 @@ All significant changes in the project are documented here.
|
|
38
49
|
* [#19](https://githb.com/C-S-D/carrot_rpc/pull/19) - [KronicDeth](http://github.com/kronicdeth)
|
39
50
|
* Put JSONAPI errors documents into the JSONRPC error fields instead of returning as normal results as consumers, such as `Rpc.Generic.Client` are expecting all errors to be in JSONRPC's error field and not have to check if the non-error `result` contains a JSONAPI level error. This achieves parity with the behavior in the Elixir `Rpc.Generic.Server`.
|
40
51
|
* Scrub JSONAPI error fields that are `nil` so they don't get transmitted as `null`. JSONAPI spec is quite clear that `null` columns shouldn't be transmitted except in the case of `null` data to signal a missing singleton resource. This achieves compatibility with the error parsing in `Rpc.Generic.Client` in Elixir.
|
52
|
+
|
53
|
+
### Incompatible Changes
|
54
|
+
* [#20](https://githb.com/C-S-D/carrot_rpc/pull/20) - `base_url`, which must be implemented by any RPC server that `include CarrotRpc::RpcServer::JSONAPIResources`, changes from `base_url() :: String` to `base_url(JSONAPI::OperationResult, JSONAPI::Request) :: String` - [shamil614](https://github.com/shamil614)
|
41
55
|
|
42
56
|
## v0.3.0
|
43
57
|
|
@@ -45,8 +45,10 @@ class CarrotRpc::RpcClient
|
|
45
45
|
# setup subscribe block to Service
|
46
46
|
# block => false is a non blocking IO option.
|
47
47
|
@reply_queue.subscribe(block: false) do |_delivery_info, properties, payload|
|
48
|
-
|
49
|
-
|
48
|
+
response = JSON.parse(payload).rename_keys("-", "_").with_indifferent_access
|
49
|
+
|
50
|
+
result = parse_response(response)
|
51
|
+
@results[properties[:correlation_id]].push(result)
|
50
52
|
end
|
51
53
|
end
|
52
54
|
|
@@ -125,4 +127,21 @@ class CarrotRpc::RpcClient
|
|
125
127
|
def update(params)
|
126
128
|
remote_call("update", params)
|
127
129
|
end
|
130
|
+
|
131
|
+
private
|
132
|
+
|
133
|
+
# Logic to find the data from the RPC response.
|
134
|
+
# @param [Hash] response from rpc call
|
135
|
+
# @return [Hash,nil]
|
136
|
+
def parse_response(response)
|
137
|
+
# successful response
|
138
|
+
if response.key?(:result)
|
139
|
+
response[:result]
|
140
|
+
# data is the key holding the error information
|
141
|
+
elsif response.key?(:error)
|
142
|
+
response[:error][:data]
|
143
|
+
else
|
144
|
+
response
|
145
|
+
end
|
146
|
+
end
|
128
147
|
end
|
@@ -67,7 +67,7 @@ class CarrotRpc::RpcServer
|
|
67
67
|
|
68
68
|
# See http://www.jsonrpc.org/specification#response_object
|
69
69
|
def reply_result(result, properties:, request_message:)
|
70
|
-
if result["errors"]
|
70
|
+
if result && result.is_a?(Hash) && result["errors"]
|
71
71
|
reply_result_with_errors(result, properties: properties, request_message: request_message)
|
72
72
|
else
|
73
73
|
reply_result_without_errors(result, properties: properties, request_message: request_message)
|
data/lib/carrot_rpc/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrot_rpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Hamilton
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-04-
|
12
|
+
date: 2016-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -180,3 +180,4 @@ signing_key:
|
|
180
180
|
specification_version: 4
|
181
181
|
summary: Remote Procedure Call (RPC) using the Bunny Gem over RabbitMQ
|
182
182
|
test_files: []
|
183
|
+
has_rdoc:
|