grpc-rest 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +3 -0
- data/Gemfile.lock +1 -1
- data/lib/grpc_rest/version.rb +1 -1
- data/lib/grpc_rest.rb +3 -3
- data/spec/grpc_rest_spec.rb +12 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cb358eab4313d2e6f4bc27e6e6e7f41694c4828bc176f91430696cc3153fabf
|
4
|
+
data.tar.gz: f73e835ef854696b65e2d92f2d650748f25e5d7ce2a16c9bcc397cfc4d96686d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc94a596a11a98b0bf69fa2f3215139d555429b1208d2c91c52266dfad9ddd2e867a1e40de258c8fc2f414b0234decfc5c00c17758291c2ac87d160c8d0c5b10
|
7
|
+
data.tar.gz: 95f30263280cf09bc426843c27a41afaf35c009079d238c3b611a20fc766b53cc57c16c566f94f3f526b31356cf8509bf1548be2e12322791773594e37699e71
|
data/CHANGELOG
CHANGED
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## UNRELEASED
|
9
9
|
|
10
|
+
# 0.1.13 - 2024-06-24
|
11
|
+
- Use JSON parsing / generation to fix inaccurate transformations (e.g. Timestamp).
|
12
|
+
|
10
13
|
# 0.1.12 - 2024-05-15
|
11
14
|
- Parse numbers into Ruby number objects.
|
12
15
|
|
data/Gemfile.lock
CHANGED
data/lib/grpc_rest/version.rb
CHANGED
data/lib/grpc_rest.rb
CHANGED
@@ -79,7 +79,7 @@ module GrpcRest
|
|
79
79
|
|
80
80
|
def init_request(request_class, params)
|
81
81
|
map_proto_type(request_class.descriptor, params)
|
82
|
-
request_class.
|
82
|
+
request_class.decode_json(JSON.generate(params))
|
83
83
|
end
|
84
84
|
|
85
85
|
def assign_params(request, param_hash, body_string, params)
|
@@ -141,10 +141,10 @@ module GrpcRest
|
|
141
141
|
k.bound_service == service_obj
|
142
142
|
end
|
143
143
|
if klass
|
144
|
-
return send_gruf_request(klass, service_obj, method, request)
|
144
|
+
return send_gruf_request(klass, service_obj, method, request)
|
145
145
|
end
|
146
146
|
end
|
147
|
-
send_grpc_request(service, method, request)
|
147
|
+
send_grpc_request(service, method, request)
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
data/spec/grpc_rest_spec.rb
CHANGED
@@ -28,8 +28,8 @@ RSpec.describe MyServiceController, type: :request do
|
|
28
28
|
get "/test/blah/xyz?test_id=abc"
|
29
29
|
expect(response).to be_successful
|
30
30
|
expect(response.parsed_body).to eq({
|
31
|
-
'
|
32
|
-
'
|
31
|
+
'someInt' => 1,
|
32
|
+
'fullResponse' => %({"testId":"abc","foobar":"xyz"})
|
33
33
|
})
|
34
34
|
end
|
35
35
|
end
|
@@ -44,8 +44,8 @@ RSpec.describe MyServiceController, type: :request do
|
|
44
44
|
post '/test2?test_id=abc&foobar=xyz×tamp_field=2024-04-03+01:02:03+UTC', params: params, as: :json
|
45
45
|
expect(response).to be_successful
|
46
46
|
expect(response.parsed_body).to eq({
|
47
|
-
'
|
48
|
-
'
|
47
|
+
'someInt' => 2,
|
48
|
+
'fullResponse' => %({"testId":"abc","foobar":"xyz","secondRecord":{"subId":"id1","anotherId":"id2"},"timestampField":"2024-04-03T01:02:03Z"})
|
49
49
|
})
|
50
50
|
end
|
51
51
|
|
@@ -56,8 +56,8 @@ RSpec.describe MyServiceController, type: :request do
|
|
56
56
|
post '/test3/xyz?test_id=abc'
|
57
57
|
expect(response).to be_successful
|
58
58
|
expect(response.parsed_body).to eq({
|
59
|
-
'
|
60
|
-
'
|
59
|
+
'someInt' => 3,
|
60
|
+
'fullResponse' => %({"testId":"abc","subRecord":{"subId":"xyz"}})
|
61
61
|
})
|
62
62
|
end
|
63
63
|
end
|
@@ -95,8 +95,8 @@ RSpec.describe MyServiceController, type: :request do
|
|
95
95
|
post '/test4', params: params, as: :json
|
96
96
|
expect(response).to be_successful
|
97
97
|
expect(response.parsed_body).to eq({
|
98
|
-
'
|
99
|
-
'
|
98
|
+
'someInt' => 4,
|
99
|
+
'fullResponse' => %({"testId":"abc","foobar":"xyz","repeatedString":["W","T","F"],"subRecord":{"subId":"id1","anotherId":"id2"},"secondRecord":{"subId":"id3","anotherId":"id4"},"structField":{"bool_key":true,"str_key":"val","nil_key":null,"list_key":[{"inner_key":"inner_val"}],"int_key":123},"timestampField":"2024-04-03T01:02:03Z","listValue":["F","Y","I"],"bareValue":45,\"someInt\":65})
|
100
100
|
})
|
101
101
|
end
|
102
102
|
end
|
@@ -109,8 +109,8 @@ RSpec.describe MyServiceController, type: :request do
|
|
109
109
|
post "/test4", params: params, as: :json
|
110
110
|
expect(response).to be_successful
|
111
111
|
expect(response.parsed_body).to eq({
|
112
|
-
'
|
113
|
-
'
|
112
|
+
'someInt' => 4,
|
113
|
+
'fullResponse' => %({"timestampField":"2024-04-09T19:54:12Z"})
|
114
114
|
})
|
115
115
|
end
|
116
116
|
end
|
@@ -127,8 +127,8 @@ RSpec.describe MyServiceController, type: :request do
|
|
127
127
|
post '/test4', params:, as: :json
|
128
128
|
expect(response).to be_successful
|
129
129
|
expect(response.parsed_body).to eq({
|
130
|
-
'
|
131
|
-
'
|
130
|
+
'someInt' => 4,
|
131
|
+
'fullResponse' => %({"subRecords":[{"subId":"id1","anotherId":"id2"}]})
|
132
132
|
})
|
133
133
|
end
|
134
134
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grpc-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Orner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grpc
|