json_apiable 0.5.2 → 0.6.0

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: 8badac374f5beeb1a450a13c9e15a9b51ecf3f7999a1584037df80234746365e
4
- data.tar.gz: 9731a6810c7bde962dfd7ff5874f18366b6bb378a7a0e4358200249ef12f569b
3
+ metadata.gz: e4ccd4b82cdad6de8e40b899171c1535d503e53b86a3e9524d86efc11b33a4ee
4
+ data.tar.gz: 4556e1e1416403fc695856bbe59d2e882155f3b01d575395dc61f7a872ec8b32
5
5
  SHA512:
6
- metadata.gz: e0a1e8c16896ba6bb97165654a6fa31d2565eb2ae03a9a1fb464ee44f62cbf73b9556fc1f68366b2b3a54665bcd2ad66e84c7947200efe345a3de185f3259a60
7
- data.tar.gz: 31e1bc0ce9505acc7234cc6dc0f1866ee1f7aa99411acedac3bff8db8d74360fa256b6e3fa11c969f2c8b6bb68f352604b5419f6b4c980fbe727975de63d48d4
6
+ metadata.gz: d7a1990f687feec45ef3fc291296de155ad47a60e6c5f4eff5be02fdc932ba0a748a6742247d501ef97f3a6fd320da2394d417f3b71cc084d3c97c94822fb501
7
+ data.tar.gz: 759e96816c876f7f570b5d8537e0db67af61343a6878cb22ca04638aa01460c04ef83fbc9d2f3d5b8fc28463fd6566d2c9daff4b6663b3fcb29c7e29a657a86f
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ Changelog
2
+ =========
3
+ ## 0.6.0 05/15/2021
4
+ * Adding support for "has_many" nested attributes
5
+ * Updating specs
6
+
7
+ ## 0.5.2 05/06/2021
8
+ * Updating dependency gems
@@ -34,7 +34,7 @@ module JsonApiable
34
34
  attributes&.each do |key, value|
35
35
  next if excluded_attributes&.include?(key.to_sym)
36
36
 
37
- new_key = value.is_a?(ActionController::Parameters) ? "#{key}_attributes" : key
37
+ new_key = nested_attributes?(value) ? "#{key}_attributes" : key
38
38
  attrs_hash[new_key] = value.is_a?(ActionController::Parameters) ? value.to_h : value
39
39
  end
40
40
  attrs_hash
@@ -78,5 +78,9 @@ module JsonApiable
78
78
  def self.hashify(allowed_relationships)
79
79
  allowed_relationships.map { |rel| { rel => {} } }
80
80
  end
81
+
82
+ def self.nested_attributes?(value)
83
+ value.is_a?(ActionController::Parameters) || value.is_a?(Array)
84
+ end
81
85
  end
82
86
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JsonApiable
4
- VERSION = "0.5.2"
4
+ VERSION = "0.6.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_apiable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Polischuk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-06 00:00:00.000000000 Z
11
+ date: 2021-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -203,8 +203,8 @@ files:
203
203
  - ".rspec"
204
204
  - ".rubocop.yml"
205
205
  - ".travis.yml"
206
+ - CHANGELOG.md
206
207
  - Gemfile
207
- - Gemfile.lock
208
208
  - LICENSE.txt
209
209
  - README.md
210
210
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,196 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- json_apiable (0.5)
5
- activerecord
6
- activesupport
7
- jsonapi-serializer
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- actioncable (6.1.3.1)
13
- actionpack (= 6.1.3.1)
14
- activesupport (= 6.1.3.1)
15
- nio4r (~> 2.0)
16
- websocket-driver (>= 0.6.1)
17
- actionmailbox (6.1.3.1)
18
- actionpack (= 6.1.3.1)
19
- activejob (= 6.1.3.1)
20
- activerecord (= 6.1.3.1)
21
- activestorage (= 6.1.3.1)
22
- activesupport (= 6.1.3.1)
23
- mail (>= 2.7.1)
24
- actionmailer (6.1.3.1)
25
- actionpack (= 6.1.3.1)
26
- actionview (= 6.1.3.1)
27
- activejob (= 6.1.3.1)
28
- activesupport (= 6.1.3.1)
29
- mail (~> 2.5, >= 2.5.4)
30
- rails-dom-testing (~> 2.0)
31
- actionpack (6.1.3.1)
32
- actionview (= 6.1.3.1)
33
- activesupport (= 6.1.3.1)
34
- rack (~> 2.0, >= 2.0.9)
35
- rack-test (>= 0.6.3)
36
- rails-dom-testing (~> 2.0)
37
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
38
- actiontext (6.1.3.1)
39
- actionpack (= 6.1.3.1)
40
- activerecord (= 6.1.3.1)
41
- activestorage (= 6.1.3.1)
42
- activesupport (= 6.1.3.1)
43
- nokogiri (>= 1.8.5)
44
- actionview (6.1.3.1)
45
- activesupport (= 6.1.3.1)
46
- builder (~> 3.1)
47
- erubi (~> 1.4)
48
- rails-dom-testing (~> 2.0)
49
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
50
- activejob (6.1.3.1)
51
- activesupport (= 6.1.3.1)
52
- globalid (>= 0.3.6)
53
- activemodel (6.1.3.1)
54
- activesupport (= 6.1.3.1)
55
- activerecord (6.1.3.1)
56
- activemodel (= 6.1.3.1)
57
- activesupport (= 6.1.3.1)
58
- activestorage (6.1.3.1)
59
- actionpack (= 6.1.3.1)
60
- activejob (= 6.1.3.1)
61
- activerecord (= 6.1.3.1)
62
- activesupport (= 6.1.3.1)
63
- marcel (~> 1.0.0)
64
- mini_mime (~> 1.0.2)
65
- activesupport (6.1.3.1)
66
- concurrent-ruby (~> 1.0, >= 1.0.2)
67
- i18n (>= 1.6, < 2)
68
- minitest (>= 5.1)
69
- tzinfo (~> 2.0)
70
- zeitwerk (~> 2.3)
71
- builder (3.2.4)
72
- byebug (11.1.1)
73
- coderay (1.1.2)
74
- concurrent-ruby (1.1.8)
75
- crass (1.0.6)
76
- diff-lcs (1.3)
77
- erubi (1.10.0)
78
- factory_bot (6.1.0)
79
- activesupport (>= 5.0.0)
80
- factory_bot_rails (6.1.0)
81
- factory_bot (~> 6.1.0)
82
- railties (>= 5.0.0)
83
- faker (2.10.2)
84
- i18n (>= 1.6, < 2)
85
- globalid (0.4.2)
86
- activesupport (>= 4.2.0)
87
- i18n (1.8.10)
88
- concurrent-ruby (~> 1.0)
89
- jsonapi-serializer (2.2.0)
90
- activesupport (>= 4.2)
91
- loofah (2.9.1)
92
- crass (~> 1.0.2)
93
- nokogiri (>= 1.5.9)
94
- mail (2.7.1)
95
- mini_mime (>= 0.1.1)
96
- marcel (1.0.1)
97
- method_source (0.9.2)
98
- mini_mime (1.0.3)
99
- mini_portile2 (2.5.1)
100
- minitest (5.14.4)
101
- nio4r (2.5.7)
102
- nokogiri (1.11.3)
103
- mini_portile2 (~> 2.5.0)
104
- racc (~> 1.4)
105
- pry (0.12.2)
106
- coderay (~> 1.1.0)
107
- method_source (~> 0.9.0)
108
- pry-byebug (3.8.0)
109
- byebug (~> 11.0)
110
- pry (~> 0.10)
111
- racc (1.5.2)
112
- rack (2.2.3)
113
- rack-test (1.1.0)
114
- rack (>= 1.0, < 3)
115
- rails (6.1.3.1)
116
- actioncable (= 6.1.3.1)
117
- actionmailbox (= 6.1.3.1)
118
- actionmailer (= 6.1.3.1)
119
- actionpack (= 6.1.3.1)
120
- actiontext (= 6.1.3.1)
121
- actionview (= 6.1.3.1)
122
- activejob (= 6.1.3.1)
123
- activemodel (= 6.1.3.1)
124
- activerecord (= 6.1.3.1)
125
- activestorage (= 6.1.3.1)
126
- activesupport (= 6.1.3.1)
127
- bundler (>= 1.15.0)
128
- railties (= 6.1.3.1)
129
- sprockets-rails (>= 2.0.0)
130
- rails-controller-testing (1.0.4)
131
- actionpack (>= 5.0.1.x)
132
- actionview (>= 5.0.1.x)
133
- activesupport (>= 5.0.1.x)
134
- rails-dom-testing (2.0.3)
135
- activesupport (>= 4.2.0)
136
- nokogiri (>= 1.6)
137
- rails-html-sanitizer (1.3.0)
138
- loofah (~> 2.3)
139
- railties (6.1.3.1)
140
- actionpack (= 6.1.3.1)
141
- activesupport (= 6.1.3.1)
142
- method_source
143
- rake (>= 0.8.7)
144
- thor (~> 1.0)
145
- rake (13.0.3)
146
- rspec-core (3.9.1)
147
- rspec-support (~> 3.9.1)
148
- rspec-expectations (3.9.0)
149
- diff-lcs (>= 1.2.0, < 2.0)
150
- rspec-support (~> 3.9.0)
151
- rspec-mocks (3.9.1)
152
- diff-lcs (>= 1.2.0, < 2.0)
153
- rspec-support (~> 3.9.0)
154
- rspec-rails (3.9.0)
155
- actionpack (>= 3.0)
156
- activesupport (>= 3.0)
157
- railties (>= 3.0)
158
- rspec-core (~> 3.9.0)
159
- rspec-expectations (~> 3.9.0)
160
- rspec-mocks (~> 3.9.0)
161
- rspec-support (~> 3.9.0)
162
- rspec-support (3.9.2)
163
- sprockets (4.0.2)
164
- concurrent-ruby (~> 1.0)
165
- rack (> 1, < 3)
166
- sprockets-rails (3.2.2)
167
- actionpack (>= 4.0)
168
- activesupport (>= 4.0)
169
- sprockets (>= 3.0.0)
170
- sqlite3 (1.4.2)
171
- thor (1.1.0)
172
- tzinfo (2.0.4)
173
- concurrent-ruby (~> 1.0)
174
- websocket-driver (0.7.3)
175
- websocket-extensions (>= 0.1.0)
176
- websocket-extensions (0.1.5)
177
- zeitwerk (2.4.2)
178
-
179
- PLATFORMS
180
- ruby
181
-
182
- DEPENDENCIES
183
- bundler (~> 2.0)
184
- factory_bot_rails
185
- faker
186
- json_apiable!
187
- pry
188
- pry-byebug
189
- rails
190
- rails-controller-testing
191
- rake (~> 13.0)
192
- rspec-rails (~> 3.9)
193
- sqlite3
194
-
195
- BUNDLED WITH
196
- 2.1.4