active_model_serializers 0.10.7 → 0.10.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -0
  3. data/.travis.yml +14 -3
  4. data/CHANGELOG.md +29 -1
  5. data/Gemfile +5 -3
  6. data/README.md +2 -2
  7. data/Rakefile +2 -0
  8. data/active_model_serializers.gemspec +2 -1
  9. data/docs/general/serializers.md +16 -4
  10. data/lib/action_controller/serialization.rb +2 -0
  11. data/lib/active_model/serializable_resource.rb +2 -0
  12. data/lib/active_model/serializer/adapter/attributes.rb +2 -0
  13. data/lib/active_model/serializer/adapter/base.rb +2 -0
  14. data/lib/active_model/serializer/adapter/json.rb +2 -0
  15. data/lib/active_model/serializer/adapter/json_api.rb +2 -0
  16. data/lib/active_model/serializer/adapter/null.rb +2 -0
  17. data/lib/active_model/serializer/adapter.rb +2 -0
  18. data/lib/active_model/serializer/array_serializer.rb +2 -0
  19. data/lib/active_model/serializer/association.rb +2 -0
  20. data/lib/active_model/serializer/attribute.rb +2 -0
  21. data/lib/active_model/serializer/belongs_to_reflection.rb +2 -0
  22. data/lib/active_model/serializer/collection_serializer.rb +6 -6
  23. data/lib/active_model/serializer/concerns/caching.rb +5 -1
  24. data/lib/active_model/serializer/error_serializer.rb +2 -0
  25. data/lib/active_model/serializer/errors_serializer.rb +2 -0
  26. data/lib/active_model/serializer/field.rb +2 -0
  27. data/lib/active_model/serializer/fieldset.rb +2 -0
  28. data/lib/active_model/serializer/has_many_reflection.rb +2 -0
  29. data/lib/active_model/serializer/has_one_reflection.rb +2 -0
  30. data/lib/active_model/serializer/lazy_association.rb +6 -2
  31. data/lib/active_model/serializer/link.rb +23 -0
  32. data/lib/active_model/serializer/lint.rb +2 -0
  33. data/lib/active_model/serializer/null.rb +2 -0
  34. data/lib/active_model/serializer/reflection.rb +5 -0
  35. data/lib/active_model/serializer/version.rb +3 -1
  36. data/lib/active_model/serializer.rb +22 -14
  37. data/lib/active_model_serializers/adapter/attributes.rb +2 -0
  38. data/lib/active_model_serializers/adapter/base.rb +2 -0
  39. data/lib/active_model_serializers/adapter/json.rb +2 -0
  40. data/lib/active_model_serializers/adapter/json_api/deserialization.rb +2 -0
  41. data/lib/active_model_serializers/adapter/json_api/error.rb +2 -0
  42. data/lib/active_model_serializers/adapter/json_api/jsonapi.rb +2 -0
  43. data/lib/active_model_serializers/adapter/json_api/link.rb +2 -0
  44. data/lib/active_model_serializers/adapter/json_api/meta.rb +2 -0
  45. data/lib/active_model_serializers/adapter/json_api/pagination_links.rb +2 -0
  46. data/lib/active_model_serializers/adapter/json_api/relationship.rb +2 -0
  47. data/lib/active_model_serializers/adapter/json_api/resource_identifier.rb +2 -0
  48. data/lib/active_model_serializers/adapter/json_api.rb +14 -9
  49. data/lib/active_model_serializers/adapter/null.rb +2 -0
  50. data/lib/active_model_serializers/adapter.rb +3 -1
  51. data/lib/active_model_serializers/callbacks.rb +2 -0
  52. data/lib/active_model_serializers/deprecate.rb +2 -0
  53. data/lib/active_model_serializers/deserialization.rb +2 -0
  54. data/lib/active_model_serializers/json_pointer.rb +2 -0
  55. data/lib/active_model_serializers/logging.rb +2 -0
  56. data/lib/active_model_serializers/lookup_chain.rb +2 -0
  57. data/lib/active_model_serializers/model.rb +2 -0
  58. data/lib/active_model_serializers/railtie.rb +4 -0
  59. data/lib/active_model_serializers/register_jsonapi_renderer.rb +2 -0
  60. data/lib/active_model_serializers/serializable_resource.rb +4 -2
  61. data/lib/active_model_serializers/serialization_context.rb +2 -0
  62. data/lib/active_model_serializers/test/schema.rb +2 -0
  63. data/lib/active_model_serializers/test/serializer.rb +2 -0
  64. data/lib/active_model_serializers/test.rb +2 -0
  65. data/lib/active_model_serializers.rb +20 -10
  66. data/lib/generators/rails/resource_override.rb +2 -0
  67. data/lib/generators/rails/serializer_generator.rb +2 -0
  68. data/lib/grape/active_model_serializers.rb +2 -0
  69. data/lib/grape/formatters/active_model_serializers.rb +2 -0
  70. data/lib/grape/helpers/active_model_serializers.rb +2 -0
  71. data/lib/tasks/rubocop.rake +2 -0
  72. data/test/action_controller/adapter_selector_test.rb +2 -0
  73. data/test/action_controller/explicit_serializer_test.rb +2 -0
  74. data/test/action_controller/json/include_test.rb +2 -0
  75. data/test/action_controller/json_api/deserialization_test.rb +2 -0
  76. data/test/action_controller/json_api/errors_test.rb +2 -0
  77. data/test/action_controller/json_api/fields_test.rb +2 -0
  78. data/test/action_controller/json_api/linked_test.rb +2 -0
  79. data/test/action_controller/json_api/pagination_test.rb +2 -0
  80. data/test/action_controller/json_api/transform_test.rb +2 -0
  81. data/test/action_controller/lookup_proc_test.rb +2 -0
  82. data/test/action_controller/namespace_lookup_test.rb +2 -0
  83. data/test/action_controller/serialization_scope_name_test.rb +2 -0
  84. data/test/action_controller/serialization_test.rb +11 -3
  85. data/test/active_model_serializers/adapter_for_test.rb +2 -0
  86. data/test/active_model_serializers/json_pointer_test.rb +2 -0
  87. data/test/active_model_serializers/logging_test.rb +2 -0
  88. data/test/active_model_serializers/model_test.rb +2 -0
  89. data/test/active_model_serializers/railtie_test_isolated.rb +2 -0
  90. data/test/active_model_serializers/register_jsonapi_renderer_test_isolated.rb +2 -0
  91. data/test/active_model_serializers/serialization_context_test_isolated.rb +2 -0
  92. data/test/active_model_serializers/test/schema_test.rb +2 -0
  93. data/test/active_model_serializers/test/serializer_test.rb +2 -0
  94. data/test/active_record_test.rb +2 -0
  95. data/test/adapter/attributes_test.rb +2 -0
  96. data/test/adapter/deprecation_test.rb +2 -0
  97. data/test/adapter/json/belongs_to_test.rb +2 -0
  98. data/test/adapter/json/collection_test.rb +2 -0
  99. data/test/adapter/json/has_many_test.rb +2 -0
  100. data/test/adapter/json/transform_test.rb +2 -0
  101. data/test/adapter/json_api/belongs_to_test.rb +2 -0
  102. data/test/adapter/json_api/collection_test.rb +2 -0
  103. data/test/adapter/json_api/errors_test.rb +2 -0
  104. data/test/adapter/json_api/fields_test.rb +2 -0
  105. data/test/adapter/json_api/has_many_explicit_serializer_test.rb +2 -0
  106. data/test/adapter/json_api/has_many_test.rb +2 -0
  107. data/test/adapter/json_api/has_one_test.rb +2 -0
  108. data/test/adapter/json_api/include_data_if_sideloaded_test.rb +2 -0
  109. data/test/adapter/json_api/json_api_test.rb +2 -0
  110. data/test/adapter/json_api/linked_test.rb +2 -0
  111. data/test/adapter/json_api/links_test.rb +18 -1
  112. data/test/adapter/json_api/pagination_links_test.rb +2 -0
  113. data/test/adapter/json_api/parse_test.rb +2 -0
  114. data/test/adapter/json_api/relationship_test.rb +2 -0
  115. data/test/adapter/json_api/resource_meta_test.rb +2 -0
  116. data/test/adapter/json_api/toplevel_jsonapi_test.rb +2 -0
  117. data/test/adapter/json_api/transform_test.rb +2 -0
  118. data/test/adapter/json_api/type_test.rb +2 -0
  119. data/test/adapter/json_test.rb +2 -0
  120. data/test/adapter/null_test.rb +2 -0
  121. data/test/adapter/polymorphic_test.rb +2 -0
  122. data/test/adapter_test.rb +2 -0
  123. data/test/array_serializer_test.rb +2 -0
  124. data/test/benchmark/app.rb +2 -0
  125. data/test/benchmark/benchmarking_support.rb +2 -0
  126. data/test/benchmark/bm_active_record.rb +2 -0
  127. data/test/benchmark/bm_adapter.rb +2 -0
  128. data/test/benchmark/bm_caching.rb +2 -0
  129. data/test/benchmark/bm_lookup_chain.rb +2 -0
  130. data/test/benchmark/bm_transform.rb +2 -0
  131. data/test/benchmark/controllers.rb +2 -0
  132. data/test/benchmark/fixtures.rb +2 -0
  133. data/test/cache_test.rb +69 -3
  134. data/test/collection_serializer_test.rb +2 -0
  135. data/test/fixtures/active_record.rb +2 -0
  136. data/test/fixtures/poro.rb +2 -0
  137. data/test/generators/scaffold_controller_generator_test.rb +2 -0
  138. data/test/generators/serializer_generator_test.rb +2 -0
  139. data/test/grape_test.rb +2 -0
  140. data/test/lint_test.rb +2 -0
  141. data/test/logger_test.rb +2 -0
  142. data/test/poro_test.rb +2 -0
  143. data/test/serializable_resource_test.rb +2 -0
  144. data/test/serializers/association_macros_test.rb +2 -0
  145. data/test/serializers/associations_test.rb +52 -0
  146. data/test/serializers/attribute_test.rb +2 -0
  147. data/test/serializers/attributes_test.rb +2 -0
  148. data/test/serializers/caching_configuration_test_isolated.rb +2 -0
  149. data/test/serializers/configuration_test.rb +2 -0
  150. data/test/serializers/fieldset_test.rb +2 -0
  151. data/test/serializers/meta_test.rb +2 -0
  152. data/test/serializers/options_test.rb +2 -0
  153. data/test/serializers/read_attribute_for_serialization_test.rb +2 -0
  154. data/test/serializers/reflection_test.rb +54 -0
  155. data/test/serializers/root_test.rb +2 -0
  156. data/test/serializers/serialization_test.rb +2 -0
  157. data/test/serializers/serializer_for_test.rb +2 -0
  158. data/test/serializers/serializer_for_with_namespace_test.rb +2 -0
  159. data/test/support/isolated_unit.rb +2 -0
  160. data/test/support/rails5_shims.rb +2 -0
  161. data/test/support/rails_app.rb +2 -0
  162. data/test/support/serialization_testing.rb +2 -0
  163. data/test/test_helper.rb +2 -0
  164. metadata +56 -35
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_model_serializers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.7
4
+ version: 0.10.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Klabnik
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-15 00:00:00.000000000 Z
11
+ date: 2019-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
+ name: activemodel
14
15
  requirement: !ruby/object:Gem::Requirement
15
16
  requirements:
16
17
  - - ">="
@@ -19,9 +20,8 @@ dependencies:
19
20
  - - "<"
20
21
  - !ruby/object:Gem::Version
21
22
  version: '6'
22
- name: activemodel
23
- prerelease: false
24
23
  type: :runtime
24
+ prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
@@ -31,6 +31,7 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  version: '6'
33
33
  - !ruby/object:Gem::Dependency
34
+ name: actionpack
34
35
  requirement: !ruby/object:Gem::Requirement
35
36
  requirements:
36
37
  - - ">="
@@ -39,9 +40,8 @@ dependencies:
39
40
  - - "<"
40
41
  - !ruby/object:Gem::Version
41
42
  version: '6'
42
- name: actionpack
43
- prerelease: false
44
43
  type: :runtime
44
+ prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
@@ -51,6 +51,7 @@ dependencies:
51
51
  - !ruby/object:Gem::Version
52
52
  version: '6'
53
53
  - !ruby/object:Gem::Dependency
54
+ name: railties
54
55
  requirement: !ruby/object:Gem::Requirement
55
56
  requirements:
56
57
  - - ">="
@@ -59,9 +60,8 @@ dependencies:
59
60
  - - "<"
60
61
  - !ruby/object:Gem::Version
61
62
  version: '6'
62
- name: railties
63
- prerelease: false
64
63
  type: :development
64
+ prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ">="
@@ -71,6 +71,27 @@ dependencies:
71
71
  - !ruby/object:Gem::Version
72
72
  version: '6'
73
73
  - !ruby/object:Gem::Dependency
74
+ name: minitest
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '5.0'
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: '5.11'
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '5.0'
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '5.11'
93
+ - !ruby/object:Gem::Dependency
94
+ name: jsonapi-renderer
74
95
  requirement: !ruby/object:Gem::Requirement
75
96
  requirements:
76
97
  - - ">="
@@ -79,9 +100,8 @@ dependencies:
79
100
  - - "<"
80
101
  - !ruby/object:Gem::Version
81
102
  version: '0.3'
82
- name: jsonapi-renderer
83
- prerelease: false
84
103
  type: :runtime
104
+ prerelease: false
85
105
  version_requirements: !ruby/object:Gem::Requirement
86
106
  requirements:
87
107
  - - ">="
@@ -91,20 +111,21 @@ dependencies:
91
111
  - !ruby/object:Gem::Version
92
112
  version: '0.3'
93
113
  - !ruby/object:Gem::Dependency
114
+ name: case_transform
94
115
  requirement: !ruby/object:Gem::Requirement
95
116
  requirements:
96
117
  - - ">="
97
118
  - !ruby/object:Gem::Version
98
119
  version: '0.2'
99
- name: case_transform
100
- prerelease: false
101
120
  type: :runtime
121
+ prerelease: false
102
122
  version_requirements: !ruby/object:Gem::Requirement
103
123
  requirements:
104
124
  - - ">="
105
125
  - !ruby/object:Gem::Version
106
126
  version: '0.2'
107
127
  - !ruby/object:Gem::Dependency
128
+ name: activerecord
108
129
  requirement: !ruby/object:Gem::Requirement
109
130
  requirements:
110
131
  - - ">="
@@ -113,9 +134,8 @@ dependencies:
113
134
  - - "<"
114
135
  - !ruby/object:Gem::Version
115
136
  version: '6'
116
- name: activerecord
117
- prerelease: false
118
137
  type: :development
138
+ prerelease: false
119
139
  version_requirements: !ruby/object:Gem::Requirement
120
140
  requirements:
121
141
  - - ">="
@@ -125,20 +145,21 @@ dependencies:
125
145
  - !ruby/object:Gem::Version
126
146
  version: '6'
127
147
  - !ruby/object:Gem::Dependency
148
+ name: kaminari
128
149
  requirement: !ruby/object:Gem::Requirement
129
150
  requirements:
130
151
  - - "~>"
131
152
  - !ruby/object:Gem::Version
132
153
  version: 0.16.3
133
- name: kaminari
134
- prerelease: false
135
154
  type: :development
155
+ prerelease: false
136
156
  version_requirements: !ruby/object:Gem::Requirement
137
157
  requirements:
138
158
  - - "~>"
139
159
  - !ruby/object:Gem::Version
140
160
  version: 0.16.3
141
161
  - !ruby/object:Gem::Dependency
162
+ name: will_paginate
142
163
  requirement: !ruby/object:Gem::Requirement
143
164
  requirements:
144
165
  - - "~>"
@@ -147,9 +168,8 @@ dependencies:
147
168
  - - ">="
148
169
  - !ruby/object:Gem::Version
149
170
  version: 3.0.7
150
- name: will_paginate
151
- prerelease: false
152
171
  type: :development
172
+ prerelease: false
153
173
  version_requirements: !ruby/object:Gem::Requirement
154
174
  requirements:
155
175
  - - "~>"
@@ -159,48 +179,49 @@ dependencies:
159
179
  - !ruby/object:Gem::Version
160
180
  version: 3.0.7
161
181
  - !ruby/object:Gem::Dependency
182
+ name: bundler
162
183
  requirement: !ruby/object:Gem::Requirement
163
184
  requirements:
164
185
  - - "~>"
165
186
  - !ruby/object:Gem::Version
166
187
  version: '1.6'
167
- name: bundler
168
- prerelease: false
169
188
  type: :development
189
+ prerelease: false
170
190
  version_requirements: !ruby/object:Gem::Requirement
171
191
  requirements:
172
192
  - - "~>"
173
193
  - !ruby/object:Gem::Version
174
194
  version: '1.6'
175
195
  - !ruby/object:Gem::Dependency
196
+ name: simplecov
176
197
  requirement: !ruby/object:Gem::Requirement
177
198
  requirements:
178
199
  - - "~>"
179
200
  - !ruby/object:Gem::Version
180
201
  version: '0.11'
181
- name: simplecov
182
- prerelease: false
183
202
  type: :development
203
+ prerelease: false
184
204
  version_requirements: !ruby/object:Gem::Requirement
185
205
  requirements:
186
206
  - - "~>"
187
207
  - !ruby/object:Gem::Version
188
208
  version: '0.11'
189
209
  - !ruby/object:Gem::Dependency
210
+ name: timecop
190
211
  requirement: !ruby/object:Gem::Requirement
191
212
  requirements:
192
213
  - - "~>"
193
214
  - !ruby/object:Gem::Version
194
215
  version: '0.7'
195
- name: timecop
196
- prerelease: false
197
216
  type: :development
217
+ prerelease: false
198
218
  version_requirements: !ruby/object:Gem::Requirement
199
219
  requirements:
200
220
  - - "~>"
201
221
  - !ruby/object:Gem::Version
202
222
  version: '0.7'
203
223
  - !ruby/object:Gem::Dependency
224
+ name: grape
204
225
  requirement: !ruby/object:Gem::Requirement
205
226
  requirements:
206
227
  - - ">="
@@ -209,9 +230,8 @@ dependencies:
209
230
  - - "<"
210
231
  - !ruby/object:Gem::Version
211
232
  version: 0.19.1
212
- name: grape
213
- prerelease: false
214
233
  type: :development
234
+ prerelease: false
215
235
  version_requirements: !ruby/object:Gem::Requirement
216
236
  requirements:
217
237
  - - ">="
@@ -221,20 +241,21 @@ dependencies:
221
241
  - !ruby/object:Gem::Version
222
242
  version: 0.19.1
223
243
  - !ruby/object:Gem::Dependency
244
+ name: json_schema
224
245
  requirement: !ruby/object:Gem::Requirement
225
246
  requirements:
226
247
  - - ">="
227
248
  - !ruby/object:Gem::Version
228
249
  version: '0'
229
- name: json_schema
230
- prerelease: false
231
250
  type: :development
251
+ prerelease: false
232
252
  version_requirements: !ruby/object:Gem::Requirement
233
253
  requirements:
234
254
  - - ">="
235
255
  - !ruby/object:Gem::Version
236
256
  version: '0'
237
257
  - !ruby/object:Gem::Dependency
258
+ name: rake
238
259
  requirement: !ruby/object:Gem::Requirement
239
260
  requirements:
240
261
  - - ">="
@@ -243,9 +264,8 @@ dependencies:
243
264
  - - "<"
244
265
  - !ruby/object:Gem::Version
245
266
  version: '12.0'
246
- name: rake
247
- prerelease: false
248
267
  type: :development
268
+ prerelease: false
249
269
  version_requirements: !ruby/object:Gem::Requirement
250
270
  requirements:
251
271
  - - ">="
@@ -333,6 +353,7 @@ files:
333
353
  - lib/active_model/serializer/has_many_reflection.rb
334
354
  - lib/active_model/serializer/has_one_reflection.rb
335
355
  - lib/active_model/serializer/lazy_association.rb
356
+ - lib/active_model/serializer/link.rb
336
357
  - lib/active_model/serializer/lint.rb
337
358
  - lib/active_model/serializer/null.rb
338
359
  - lib/active_model/serializer/reflection.rb
@@ -478,7 +499,7 @@ homepage: https://github.com/rails-api/active_model_serializers
478
499
  licenses:
479
500
  - MIT
480
501
  metadata: {}
481
- post_install_message:
502
+ post_install_message:
482
503
  rdoc_options: []
483
504
  require_paths:
484
505
  - lib
@@ -493,9 +514,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
493
514
  - !ruby/object:Gem::Version
494
515
  version: '0'
495
516
  requirements: []
496
- rubyforge_project:
497
- rubygems_version: 2.6.13
498
- signing_key:
517
+ rubyforge_project:
518
+ rubygems_version: 2.7.6
519
+ signing_key:
499
520
  specification_version: 4
500
521
  summary: Conventions-based JSON generation for Rails.
501
522
  test_files: