camille 0.5.7 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +1 -1
- data/lib/camille/controller.rb +18 -13
- data/lib/camille/version.rb +1 -1
- 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: 60434d249fd905789f0c9fd812d097163cda296655c56fde57569269d8188e39
|
4
|
+
data.tar.gz: 422d993e72473270985d6ade710ae39e3ada83ef85942e83291176dc8bff9dcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6561b6b4c62f85c22d28b27c9693a1dfe8a3cccaaf95251d3995b50b0457363ea82ef971fa03d10959bcf505ee0188b2189b6de5d3cd984930830bc2a9bdcd3e
|
7
|
+
data.tar.gz: 4266ecec3ab26f2e1af40b83fe60d337ed81b8fa6f953200c14f6e1dfb2ffe9519ea2d0519882b4790cc34cc1c7f84b18fb8481d0ec3cba88636c73236998761
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/lib/camille/controller.rb
CHANGED
@@ -15,21 +15,25 @@ module Camille
|
|
15
15
|
def render *args
|
16
16
|
if endpoint = camille_endpoint
|
17
17
|
render_options = args.last
|
18
|
-
|
19
|
-
|
20
|
-
if
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
18
|
+
intended_status = render_options[:status] || 200
|
19
|
+
if intended_status == 200 || intended_status == :ok
|
20
|
+
if value = render_options[:json]
|
21
|
+
error, transformed = endpoint.response_type.transform_and_check(value)
|
22
|
+
if error
|
23
|
+
string_io = StringIO.new
|
24
|
+
Camille::TypeErrorPrinter.new(error).print(string_io)
|
25
|
+
raise TypeError.new("\nType check failed for response.\n#{string_io.string}")
|
26
|
+
else
|
27
|
+
if transformed.is_a? Hash
|
28
|
+
transformed.deep_transform_keys!{|k| k.to_s.camelize(:lower)}
|
29
|
+
end
|
30
|
+
super(json: transformed)
|
27
31
|
end
|
28
|
-
|
29
|
-
|
32
|
+
else
|
33
|
+
raise ArgumentError.new("Expected key :json for `render` call.")
|
30
34
|
end
|
31
35
|
else
|
32
|
-
|
36
|
+
super
|
33
37
|
end
|
34
38
|
else
|
35
39
|
super
|
@@ -42,7 +46,8 @@ module Camille
|
|
42
46
|
begin
|
43
47
|
params.deep_transform_keys!{|key| key.to_s.underscore}
|
44
48
|
result = super
|
45
|
-
|
49
|
+
# When there's no `render` call, Rails will return status 204
|
50
|
+
if response.status == 204
|
46
51
|
raise_missing_render_error
|
47
52
|
end
|
48
53
|
result
|
data/lib/camille/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: camille
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 辻彩
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|