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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed5a3084cfaaca9c13bbda1c1bf057110469a49a3cce9f57dee5bdc6a65ee937
4
- data.tar.gz: fa84c28dd30b11455c2f3d1350b1d229cd0ade874d400cb86454f9e0def4e509
3
+ metadata.gz: 0d17fee58879f4f95b3f32e05bd626d6242f9c2d1e321073ce48aa6c2cfb2e37
4
+ data.tar.gz: f23c5f2dcee52f79701947acdb1ee6835b7ab864aaa606f065758a82617c0750
5
5
  SHA512:
6
- metadata.gz: a47f6659d39e02398b9a133b1d3b8185af7c6a4f129931cef91ad96cc9b1148f229b70607c8a7ae64d34eb52cdeec272725f584a99cba46f654604120c3ea72d
7
- data.tar.gz: 9bd7ee64509e4f8cd06701a0f65b9de5fd3774df09f30751e3772123d3c7fb65890f15983c6f92238c3c22a4ec501c9563c2d39a043738997c296de46e616c62
6
+ metadata.gz: d96ae095dfa08377102ca42a3ad02294d04a44d37df600d69beb7e69428ec5621ad8e257dcca5a668f76ab19717c753cbe5e4b5bfc66b44830bf1821b10a7a9c
7
+ data.tar.gz: a7889a43949e18dbf54796de43a15ce5f3868fcbf6711db4911b4f2e2d56278f8698b8bcdfd486af425904594da2be8ce9ec7f5978158bf8d66d8add2be1c2ef
@@ -3,6 +3,7 @@ module HalApi
3
3
  require 'hal_api/errors'
4
4
  require 'hal_api/controller'
5
5
  require 'hal_api/represented_model'
6
+ require 'hal_api/responders/api_responder'
6
7
 
7
8
  def self.rails_major_version
8
9
  ::Rails.version.split('.')[0].to_i
@@ -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
@@ -1,5 +1,5 @@
1
1
  module HalApi
2
2
  module Rails
3
- VERSION = "0.4.1"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  end
@@ -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.1
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-07-08 00:00:00.000000000 Z
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