jsonapi_actions 0.2.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: adf742b138dbab22fae3dce7055502194e04bc8817c0af104d974fc767a6bdf5
4
- data.tar.gz: 2d6e39470f0d0c22ffbbcb742b8f0eae2aecc4eb7b90c94e9ac5f5cf6819bd01
3
+ metadata.gz: 5565cb462ad2ab745d869fca29361b1c89a44971f113798018daa83e57968d85
4
+ data.tar.gz: 48f0986b798c14456211e08414ceb620f56bde53011247c3409230057964c3d9
5
5
  SHA512:
6
- metadata.gz: d65af3d4872162bd162df4894b454fe4f204488976bcf65e2bbc6dd3085ba0f46079e899352cdb32f5457d7298077784324a93e8288a30a549732c1bff5cfb56
7
- data.tar.gz: 237490111ce9cda4f310bd90b6e9bfe092a6093a8403d3daf6fdfe54aab951d231deac03e29c8291c537233cc01b052d71f128f9a21c6899534d3fc798d55829
6
+ metadata.gz: b0d2a68fd3c6ba77c676cf5cb3093b1c27e4fe908d224923409a4100afe1a7734a21d3412050c51dc0d52337df456a77bc00c0cf68c1df8c0b7e723246037b4e
7
+ data.tar.gz: a76ef4cebec31d45817efc50cf227cc5a685d1bca87c3876212042e23b68cc56fa9933211dc011b0f59ae05a2eb3664978c7594e25bf54b6b24bfe33a0691db6
data/Gemfile.lock CHANGED
@@ -8,127 +8,127 @@ PATH
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (6.0.1)
12
- actionpack (= 6.0.1)
11
+ actioncable (6.0.2.2)
12
+ actionpack (= 6.0.2.2)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailbox (6.0.1)
16
- actionpack (= 6.0.1)
17
- activejob (= 6.0.1)
18
- activerecord (= 6.0.1)
19
- activestorage (= 6.0.1)
20
- activesupport (= 6.0.1)
15
+ actionmailbox (6.0.2.2)
16
+ actionpack (= 6.0.2.2)
17
+ activejob (= 6.0.2.2)
18
+ activerecord (= 6.0.2.2)
19
+ activestorage (= 6.0.2.2)
20
+ activesupport (= 6.0.2.2)
21
21
  mail (>= 2.7.1)
22
- actionmailer (6.0.1)
23
- actionpack (= 6.0.1)
24
- actionview (= 6.0.1)
25
- activejob (= 6.0.1)
22
+ actionmailer (6.0.2.2)
23
+ actionpack (= 6.0.2.2)
24
+ actionview (= 6.0.2.2)
25
+ activejob (= 6.0.2.2)
26
26
  mail (~> 2.5, >= 2.5.4)
27
27
  rails-dom-testing (~> 2.0)
28
- actionpack (6.0.1)
29
- actionview (= 6.0.1)
30
- activesupport (= 6.0.1)
31
- rack (~> 2.0)
28
+ actionpack (6.0.2.2)
29
+ actionview (= 6.0.2.2)
30
+ activesupport (= 6.0.2.2)
31
+ rack (~> 2.0, >= 2.0.8)
32
32
  rack-test (>= 0.6.3)
33
33
  rails-dom-testing (~> 2.0)
34
34
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
35
- actiontext (6.0.1)
36
- actionpack (= 6.0.1)
37
- activerecord (= 6.0.1)
38
- activestorage (= 6.0.1)
39
- activesupport (= 6.0.1)
35
+ actiontext (6.0.2.2)
36
+ actionpack (= 6.0.2.2)
37
+ activerecord (= 6.0.2.2)
38
+ activestorage (= 6.0.2.2)
39
+ activesupport (= 6.0.2.2)
40
40
  nokogiri (>= 1.8.5)
41
- actionview (6.0.1)
42
- activesupport (= 6.0.1)
41
+ actionview (6.0.2.2)
42
+ activesupport (= 6.0.2.2)
43
43
  builder (~> 3.1)
44
44
  erubi (~> 1.4)
45
45
  rails-dom-testing (~> 2.0)
46
46
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
47
- activejob (6.0.1)
48
- activesupport (= 6.0.1)
47
+ activejob (6.0.2.2)
48
+ activesupport (= 6.0.2.2)
49
49
  globalid (>= 0.3.6)
50
- activemodel (6.0.1)
51
- activesupport (= 6.0.1)
52
- activerecord (6.0.1)
53
- activemodel (= 6.0.1)
54
- activesupport (= 6.0.1)
55
- activestorage (6.0.1)
56
- actionpack (= 6.0.1)
57
- activejob (= 6.0.1)
58
- activerecord (= 6.0.1)
50
+ activemodel (6.0.2.2)
51
+ activesupport (= 6.0.2.2)
52
+ activerecord (6.0.2.2)
53
+ activemodel (= 6.0.2.2)
54
+ activesupport (= 6.0.2.2)
55
+ activestorage (6.0.2.2)
56
+ actionpack (= 6.0.2.2)
57
+ activejob (= 6.0.2.2)
58
+ activerecord (= 6.0.2.2)
59
59
  marcel (~> 0.3.1)
60
- activesupport (6.0.1)
60
+ activesupport (6.0.2.2)
61
61
  concurrent-ruby (~> 1.0, >= 1.0.2)
62
62
  i18n (>= 0.7, < 2)
63
63
  minitest (~> 5.1)
64
64
  tzinfo (~> 1.1)
65
65
  zeitwerk (~> 2.2)
66
- builder (3.2.3)
67
- concurrent-ruby (1.1.5)
68
- crass (1.0.5)
66
+ builder (3.2.4)
67
+ concurrent-ruby (1.1.6)
68
+ crass (1.0.6)
69
69
  diff-lcs (1.3)
70
70
  erubi (1.9.0)
71
71
  globalid (0.4.2)
72
72
  activesupport (>= 4.2.0)
73
- i18n (1.7.0)
73
+ i18n (1.8.2)
74
74
  concurrent-ruby (~> 1.0)
75
- kaminari (1.1.1)
75
+ kaminari (1.2.0)
76
76
  activesupport (>= 4.1.0)
77
- kaminari-actionview (= 1.1.1)
78
- kaminari-activerecord (= 1.1.1)
79
- kaminari-core (= 1.1.1)
80
- kaminari-actionview (1.1.1)
77
+ kaminari-actionview (= 1.2.0)
78
+ kaminari-activerecord (= 1.2.0)
79
+ kaminari-core (= 1.2.0)
80
+ kaminari-actionview (1.2.0)
81
81
  actionview
82
- kaminari-core (= 1.1.1)
83
- kaminari-activerecord (1.1.1)
82
+ kaminari-core (= 1.2.0)
83
+ kaminari-activerecord (1.2.0)
84
84
  activerecord
85
- kaminari-core (= 1.1.1)
86
- kaminari-core (1.1.1)
87
- loofah (2.3.1)
85
+ kaminari-core (= 1.2.0)
86
+ kaminari-core (1.2.0)
87
+ loofah (2.4.0)
88
88
  crass (~> 1.0.2)
89
89
  nokogiri (>= 1.5.9)
90
90
  mail (2.7.1)
91
91
  mini_mime (>= 0.1.1)
92
92
  marcel (0.3.3)
93
93
  mimemagic (~> 0.3.2)
94
- method_source (0.9.2)
95
- mimemagic (0.3.3)
94
+ method_source (1.0.0)
95
+ mimemagic (0.3.4)
96
96
  mini_mime (1.0.2)
97
97
  mini_portile2 (2.4.0)
98
- minitest (5.13.0)
98
+ minitest (5.14.0)
99
99
  nio4r (2.5.2)
100
- nokogiri (1.10.5)
100
+ nokogiri (1.10.9)
101
101
  mini_portile2 (~> 2.4.0)
102
- rack (2.0.8)
102
+ rack (2.2.2)
103
103
  rack-test (1.1.0)
104
104
  rack (>= 1.0, < 3)
105
- rails (6.0.1)
106
- actioncable (= 6.0.1)
107
- actionmailbox (= 6.0.1)
108
- actionmailer (= 6.0.1)
109
- actionpack (= 6.0.1)
110
- actiontext (= 6.0.1)
111
- actionview (= 6.0.1)
112
- activejob (= 6.0.1)
113
- activemodel (= 6.0.1)
114
- activerecord (= 6.0.1)
115
- activestorage (= 6.0.1)
116
- activesupport (= 6.0.1)
105
+ rails (6.0.2.2)
106
+ actioncable (= 6.0.2.2)
107
+ actionmailbox (= 6.0.2.2)
108
+ actionmailer (= 6.0.2.2)
109
+ actionpack (= 6.0.2.2)
110
+ actiontext (= 6.0.2.2)
111
+ actionview (= 6.0.2.2)
112
+ activejob (= 6.0.2.2)
113
+ activemodel (= 6.0.2.2)
114
+ activerecord (= 6.0.2.2)
115
+ activestorage (= 6.0.2.2)
116
+ activesupport (= 6.0.2.2)
117
117
  bundler (>= 1.3.0)
118
- railties (= 6.0.1)
118
+ railties (= 6.0.2.2)
119
119
  sprockets-rails (>= 2.0.0)
120
120
  rails-dom-testing (2.0.3)
121
121
  activesupport (>= 4.2.0)
122
122
  nokogiri (>= 1.6)
123
123
  rails-html-sanitizer (1.3.0)
124
124
  loofah (~> 2.3)
125
- railties (6.0.1)
126
- actionpack (= 6.0.1)
127
- activesupport (= 6.0.1)
125
+ railties (6.0.2.2)
126
+ actionpack (= 6.0.2.2)
127
+ activesupport (= 6.0.2.2)
128
128
  method_source
129
129
  rake (>= 0.8.7)
130
130
  thor (>= 0.20.3, < 2.0)
131
- rake (10.5.0)
131
+ rake (13.0.1)
132
132
  rspec (3.8.0)
133
133
  rspec-core (~> 3.8.0)
134
134
  rspec-expectations (~> 3.8.0)
@@ -149,14 +149,14 @@ GEM
149
149
  actionpack (>= 4.0)
150
150
  activesupport (>= 4.0)
151
151
  sprockets (>= 3.0.0)
152
- thor (0.20.3)
152
+ thor (1.0.1)
153
153
  thread_safe (0.3.6)
154
- tzinfo (1.2.5)
154
+ tzinfo (1.2.6)
155
155
  thread_safe (~> 0.1)
156
156
  websocket-driver (0.7.1)
157
157
  websocket-extensions (>= 0.1.0)
158
158
  websocket-extensions (0.1.4)
159
- zeitwerk (2.2.1)
159
+ zeitwerk (2.3.0)
160
160
 
161
161
  PLATFORMS
162
162
  ruby
@@ -164,7 +164,7 @@ PLATFORMS
164
164
  DEPENDENCIES
165
165
  bundler (~> 2.0)
166
166
  jsonapi_actions!
167
- rake (~> 10.0)
167
+ rake (~> 13.0)
168
168
  rspec (~> 3.0)
169
169
 
170
170
  BUNDLED WITH
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.require_paths = ["lib"]
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 2.0"
27
- spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "rake", "~> 13.0"
28
28
  spec.add_development_dependency "rspec", "~> 3.0"
29
29
 
30
30
  spec.add_dependency 'rails', '>= 4.0', '< 7.0'
@@ -1,3 +1,3 @@
1
1
  module JsonapiActions
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -194,27 +194,21 @@ module JsonapiActions
194
194
  end
195
195
 
196
196
  def serializer(data = nil)
197
- if self.class.serializer
198
- self.class.serializer
199
- else
200
- "#{model.name}Serializer".constantize
201
- end
202
-
203
- rescue NoMethodError, NameError
204
- serializer_lookup(data)
205
- end
206
-
207
- def serializer_lookup(data)
208
197
  serializer_classes = [
198
+ self.class.serializer,
209
199
  data.try(:serializer_class),
210
- "#{data.class.try(:name)}Serializer".try(:constantize),
200
+ "#{data.class.name}Serializer".safe_constantize,
211
201
  data.try(:first).try(:serializer_class),
212
- "#{data.try(:first).class.try(:name)}Serializer".try(:constantize)
202
+ "#{data.try(:first).class.name}Serializer".safe_constantize
213
203
  ].compact
214
204
 
215
- raise 'Unknown serializer' if serializer_classes.empty?
216
-
217
- serializer_classes.first
205
+ if serializer_classes.any?
206
+ serializer_classes.first
207
+ else
208
+ "#{model.name}Serializer".safe_constantize
209
+ end
210
+ rescue NoMethodError, NameError
211
+ raise 'Unknown serializer'
218
212
  end
219
213
 
220
214
  def eager_load(records)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Pheasey
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement