hal_api-rails 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/hal_api/controller.rb +0 -7
- data/lib/hal_api/controller/actions.rb +13 -7
- data/lib/hal_api/controller/cache.rb +2 -0
- data/lib/hal_api/controller/exceptions.rb +2 -0
- data/lib/hal_api/controller/resources.rb +1 -0
- data/lib/hal_api/rails/version.rb +1 -1
- data/lib/hal_api/representer/uri_methods.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 179cbb4fbac529e58ced08b20fb02ca82bf77bba
|
4
|
+
data.tar.gz: 1218e1583824ce7f04f686edac03e68bc5e4fa54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4396211e73d1d968b088a08d7f0d0d6d4ba74f267a2112897393299d94466d72c7e82d17dec1a0b872f59e4fee12913a48b812bfbb63280251cde0d4b98c6d12
|
7
|
+
data.tar.gz: 32a4f303b627198c99a6d97bc21846dae4283431e08da917b027b85ad648c647e4acc8d4803df59aba8ee18847c9b1df6384fae28a0476900b3612b4ca37283e
|
data/lib/hal_api/controller.rb
CHANGED
@@ -24,13 +24,6 @@ module HalApi::Controller
|
|
24
24
|
hal_rescue_standard_errors
|
25
25
|
end
|
26
26
|
|
27
|
-
module ClassMethods
|
28
|
-
include HalApi::Controller::Actions::ClassMethods
|
29
|
-
include HalApi::Controller::Cache::ClassMethods
|
30
|
-
include HalApi::Controller::Resources::ClassMethods
|
31
|
-
include HalApi::Controller::Exceptions::ClassMethods
|
32
|
-
end
|
33
|
-
|
34
27
|
private
|
35
28
|
|
36
29
|
def set_accepts
|
@@ -1,4 +1,12 @@
|
|
1
1
|
module HalApi::Controller::Actions
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
class_eval do
|
6
|
+
class_attribute :valid_params
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
2
10
|
def index
|
3
11
|
respond_with index_collection, index_options
|
4
12
|
end
|
@@ -80,20 +88,18 @@ module HalApi::Controller::Actions
|
|
80
88
|
end
|
81
89
|
|
82
90
|
def hal_authorize(resource)
|
83
|
-
if respond_to?(:authorize)
|
84
|
-
authorize
|
85
|
-
else
|
86
|
-
define_singleton_method(:authorize, Proc.new(resource) do
|
91
|
+
if !respond_to?(:authorize)
|
92
|
+
define_singleton_method(:authorize) do |_resource|
|
87
93
|
true
|
88
|
-
end
|
94
|
+
end
|
89
95
|
singleton_class.send(:alias_method, :hal_authorize, :authorize)
|
90
96
|
end
|
97
|
+
|
98
|
+
authorize(resource)
|
91
99
|
end
|
92
100
|
|
93
101
|
|
94
102
|
module ClassMethods
|
95
|
-
attr_accessor :valid_params
|
96
|
-
|
97
103
|
def allow_params(action, *params)
|
98
104
|
self.valid_params ||= {}
|
99
105
|
valid_params[action.to_sym] = Array(params).flatten
|
@@ -4,6 +4,8 @@ require 'action_dispatch/middleware/exception_wrapper'
|
|
4
4
|
# Since we are taking over exception handling, make sure we log exceptions
|
5
5
|
# https://github.com/rails/rails/blob/4-2-stable/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
|
6
6
|
module HalApi::Controller::Exceptions
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
7
9
|
def respond_with_error(exception)
|
8
10
|
wrapper = ::ActionDispatch::ExceptionWrapper.new(env, exception)
|
9
11
|
log_error(env, wrapper)
|
@@ -5,9 +5,13 @@ require 'active_support/concern'
|
|
5
5
|
module HalApi::Representer::UriMethods
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
included do
|
9
|
+
class_eval do
|
10
|
+
class_attribute :profile_host, :alternate_host
|
11
|
+
end
|
12
|
+
end
|
10
13
|
|
14
|
+
module ClassMethods
|
11
15
|
def self_link
|
12
16
|
link(:self) do
|
13
17
|
{
|
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.2.
|
4
|
+
version: 0.2.9
|
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: 2016-
|
12
|
+
date: 2016-10-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|