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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd696857ed8bae4310e491e9b4bb96fb7cd1320d
4
- data.tar.gz: 1587490e4eef333e4a29e971de0a10ccc97e90e9
3
+ metadata.gz: 179cbb4fbac529e58ced08b20fb02ca82bf77bba
4
+ data.tar.gz: 1218e1583824ce7f04f686edac03e68bc5e4fa54
5
5
  SHA512:
6
- metadata.gz: 91b507e9cc2f09f7c2fb263d20548a3215f4476f7e39ec9cd40ec5058656d62a01d98422b31ab674ab48f851e15259497df33d55f1eca875d94476de2eaa0392
7
- data.tar.gz: a2ff36909bfc38def9c12730ce4e965d39fefb5b98f7a1fd1a9ae2b7130ddee106289126108de313882762e0b85c168c4ccca67602cf14416773cdd3d3811cb1
6
+ metadata.gz: 4396211e73d1d968b088a08d7f0d0d6d4ba74f267a2112897393299d94466d72c7e82d17dec1a0b872f59e4fee12913a48b812bfbb63280251cde0d4b98c6d12
7
+ data.tar.gz: 32a4f303b627198c99a6d97bc21846dae4283431e08da917b027b85ad648c647e4acc8d4803df59aba8ee18847c9b1df6384fae28a0476900b3612b4ca37283e
@@ -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(resource)
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
@@ -1,4 +1,6 @@
1
1
  module HalApi::Controller::Cache
2
+ extend ActiveSupport::Concern
3
+
2
4
  private
3
5
 
4
6
  def index_cache_path
@@ -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)
@@ -1,4 +1,5 @@
1
1
  module HalApi::Controller::Resources
2
+ extend ActiveSupport::Concern
2
3
  private
3
4
 
4
5
  # action specific resources
@@ -1,5 +1,5 @@
1
1
  module HalApi
2
2
  module Rails
3
- VERSION = "0.2.8"
3
+ VERSION = "0.2.9"
4
4
  end
5
5
  end
@@ -5,9 +5,13 @@ require 'active_support/concern'
5
5
  module HalApi::Representer::UriMethods
6
6
  extend ActiveSupport::Concern
7
7
 
8
- module ClassMethods
9
- attr_accessor :profile_host, :alternate_host
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.8
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-07-20 00:00:00.000000000 Z
12
+ date: 2016-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel