jsonapionify 0.12.0 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWMyMjExNTU5ZmE5NzgyMWYyN2E4ZjFmZGFmY2FkN2I0MTZlZDliYw==
4
+ YWU0OGU1ODA1MjVkZmYzOGIxZTBmZTQyNGE3YTc4ZWQzNDM2OTY0OQ==
5
5
  data.tar.gz: !binary |-
6
- NDM2YzE2YjRhMzIzNzNhNWZlNGZmNmY0NmExOWQ5NTUwOGI4ZmMzMQ==
6
+ YjI5NTNmNzdkOThkYzgwYWU0NTMwOTY2YzdiZmM1NTMzZDhkNmZlZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTM3ZTczNTQzZTUwN2Q1MmVmNTAwNWI0ZGEzN2E2MjYwMTM4MzhjZTJlYjVk
10
- NTNiYTEyZWZjMTgwN2M0OWY5MzBmMjY1MGNhNzFmNjUxOTM1ZTkxYzZiYjU5
11
- MWQ5Y2Q0ZmY5MzYyOWRiZDFjYjJhMjRjYjgwNDRmYjBlMGY3MTk=
9
+ OGFiY2IzNWNhNWRlY2U1Zjk0MTQzMDI3YjlhZGNmNTI4ZThkYjYyOGU3ZmFl
10
+ M2M5YTc2YjI3MDkzOGIxMTFiMGZjYTVkY2EzODc1OTgxNTBkNWNjNGZiNWI4
11
+ ZGM0NGU3M2RhNDVkMWY2YzI1YTJiOTAxNTNhNDVkNGYyNjhkZGE=
12
12
  data.tar.gz: !binary |-
13
- OTI0Y2Q0NGZlZDA3MjYzMmVmNWE4OGVmYmExY2JlMDJiNjc4MzE5ODk5OGQ3
14
- M2VmY2U4ZGUxZGI4ZjE3YzAxNjdiMjVkNzJmYWU5ZmZjOTczYzExMzFiMzI4
15
- NzdhYzcxOTMwY2M5MjQ3ZjAwYjQxNzlhMzY0ZGRkYmY1MjIyODg=
13
+ MDhjNzZkMTc1M2YwYzJkOWFiODkzMzEzYzNiZjU4MGMyNTcyYThlN2JiYzdl
14
+ OGFmNjNjYjdjOTI2NDU4N2MyZmJlYjU4MGVjY2NhZDM0Y2I3MjM3OWE5YjZl
15
+ YTAyNzMzYjBlNjk1ZDM2OTUzMDNhNWEyNGMzYWQxMzgwMDY0ZDE=
@@ -49,20 +49,6 @@ module JSONAPIonify::Api
49
49
  def self.extended(klass)
50
50
  klass.class_eval do
51
51
  extend JSONAPIonify::InheritedAttributes
52
- define_callbacks(
53
- :request,
54
- :exception,
55
- :response,
56
- :list, :commit_list,
57
- :create, :commit_create,
58
- :read, :commit_read,
59
- :update, :commit_update,
60
- :delete, :commit_delete,
61
- :show, :commit_show,
62
- :add, :commit_add,
63
- :remove, :commit_remove,
64
- :replace, :commit_replace
65
- )
66
52
  inherited_array_attribute :action_definitions
67
53
  end
68
54
  end
@@ -110,15 +96,6 @@ module JSONAPIonify::Api
110
96
  end
111
97
  end
112
98
 
113
- %i{before after}.each do |cb|
114
- define_method(cb) do |*action_names, &block|
115
- return send(:"#{cb}_request", &block) if action_names.blank?
116
- action_names.each do |action_name|
117
- send("#{cb}_#{action_name}", &block)
118
- end
119
- end
120
- end
121
-
122
99
  def define_action(name, *args, **options, &block)
123
100
  Action.new(name, *args, **options, &block).tap do |new_action|
124
101
  action_definitions.delete new_action
@@ -19,9 +19,5 @@ module JSONAPIonify::Api
19
19
  end
20
20
  end
21
21
 
22
- def on_exception(&block)
23
- before_exception(&block)
24
- end
25
-
26
22
  end
27
23
  end
@@ -0,0 +1,36 @@
1
+ module JSONAPIonify::Api
2
+ module Resource::Definitions::Hooks
3
+ def self.extended(klass)
4
+ klass.class_eval do
5
+ define_callbacks(
6
+ :request,
7
+ :exception,
8
+ :response,
9
+ :list, :commit_list,
10
+ :create, :commit_create,
11
+ :read, :commit_read,
12
+ :update, :commit_update,
13
+ :delete, :commit_delete,
14
+ :show, :commit_show,
15
+ :add, :commit_add,
16
+ :remove, :commit_remove,
17
+ :replace, :commit_replace
18
+ )
19
+ class << klass
20
+ alias_method :on_exeception, :before_exception
21
+ remove_method :before_exception
22
+ remove_method :after_exception
23
+ end
24
+ end
25
+ end
26
+
27
+ %i{before after}.each do |cb|
28
+ define_method(cb) do |*action_names, &block|
29
+ return send(:"#{cb}_request", &block) if action_names.blank?
30
+ action_names.each do |action_name|
31
+ send("#{cb}_#{action_name}", &block)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -5,6 +5,7 @@ module JSONAPIonify::Api
5
5
 
6
6
  def self.extended(klass)
7
7
  klass.extend Contexts
8
+ klass.extend Hooks
8
9
  constants(false).each do |const|
9
10
  mod = const_get(const, false)
10
11
  klass.extend mod unless klass.singleton_class < mod
@@ -1,3 +1,3 @@
1
1
  module JSONAPIonify
2
- VERSION = "0.12.0"
2
+ VERSION = "0.12.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapionify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Waldrip
@@ -583,6 +583,7 @@ files:
583
583
  - lib/jsonapionify/api/resource/definitions/attributes.rb
584
584
  - lib/jsonapionify/api/resource/definitions/contexts.rb
585
585
  - lib/jsonapionify/api/resource/definitions/helpers.rb
586
+ - lib/jsonapionify/api/resource/definitions/hooks.rb
586
587
  - lib/jsonapionify/api/resource/definitions/includes.rb
587
588
  - lib/jsonapionify/api/resource/definitions/pagination.rb
588
589
  - lib/jsonapionify/api/resource/definitions/params.rb