hal_api-rails 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hal_api.rb +1 -0
- data/lib/hal_api/controller.rb +5 -0
- data/lib/hal_api/rails/version.rb +1 -1
- data/lib/hal_api/responders/api_responder.rb +19 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d17fee58879f4f95b3f32e05bd626d6242f9c2d1e321073ce48aa6c2cfb2e37
|
4
|
+
data.tar.gz: f23c5f2dcee52f79701947acdb1ee6835b7ab864aaa606f065758a82617c0750
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d96ae095dfa08377102ca42a3ad02294d04a44d37df600d69beb7e69428ec5621ad8e257dcca5a668f76ab19717c753cbe5e4b5bfc66b44830bf1821b10a7a9c
|
7
|
+
data.tar.gz: a7889a43949e18dbf54796de43a15ce5f3868fcbf6711db4911b4f2e2d56278f8698b8bcdfd486af425904594da2be8ce9ec7f5978158bf8d66d8add2be1c2ef
|
data/lib/hal_api.rb
CHANGED
data/lib/hal_api/controller.rb
CHANGED
@@ -9,6 +9,7 @@ module HalApi::Controller
|
|
9
9
|
require 'hal_api/controller/cache'
|
10
10
|
require 'hal_api/controller/resources'
|
11
11
|
require 'hal_api/controller/exceptions'
|
12
|
+
require 'hal_api/responders/api_responder'
|
12
13
|
|
13
14
|
include HalApi::Controller::Actions
|
14
15
|
include HalApi::Controller::Cache
|
@@ -22,6 +23,10 @@ module HalApi::Controller
|
|
22
23
|
respond_to :hal, :json
|
23
24
|
|
24
25
|
hal_rescue_standard_errors
|
26
|
+
|
27
|
+
def self.responder
|
28
|
+
HalApi::Responders::ApiResponder
|
29
|
+
end
|
25
30
|
end
|
26
31
|
|
27
32
|
private
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'roar/rails/responder'
|
2
|
+
|
3
|
+
module HalApi::Responders
|
4
|
+
class ApiResponder < Roar::Rails::Responder
|
5
|
+
def api_behavior
|
6
|
+
raise MissingRenderer.new(format) unless has_renderer?
|
7
|
+
|
8
|
+
if post?
|
9
|
+
display(resource, status: :created)
|
10
|
+
elsif put?
|
11
|
+
display(resource, status: :ok)
|
12
|
+
elsif delete?
|
13
|
+
display(resource, status: :no_content)
|
14
|
+
else
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hal_api-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Rhoden
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-08-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -232,6 +232,7 @@ files:
|
|
232
232
|
- lib/hal_api/representer/format_keys.rb
|
233
233
|
- lib/hal_api/representer/link_serialize.rb
|
234
234
|
- lib/hal_api/representer/uri_methods.rb
|
235
|
+
- lib/hal_api/responders/api_responder.rb
|
235
236
|
homepage: https://www.github.com/PRX/
|
236
237
|
licenses:
|
237
238
|
- MIT
|