active_model_serializers 0.8.3 → 0.10.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -0
  3. data/.rubocop.yml +82 -0
  4. data/.rubocop_todo.yml +315 -0
  5. data/.simplecov +99 -0
  6. data/.travis.yml +26 -20
  7. data/CHANGELOG.md +14 -67
  8. data/CONTRIBUTING.md +31 -0
  9. data/Gemfile +45 -1
  10. data/{MIT-LICENSE.txt → LICENSE.txt} +3 -2
  11. data/README.md +186 -488
  12. data/Rakefile +33 -12
  13. data/active_model_serializers.gemspec +49 -23
  14. data/appveyor.yml +25 -0
  15. data/docs/README.md +29 -0
  16. data/docs/general/adapters.md +110 -0
  17. data/docs/general/configuration_options.md +11 -0
  18. data/docs/general/getting_started.md +73 -0
  19. data/docs/howto/add_pagination_links.md +112 -0
  20. data/docs/howto/add_root_key.md +51 -0
  21. data/docs/howto/outside_controller_use.md +42 -0
  22. data/lib/action_controller/serialization.rb +31 -31
  23. data/lib/active_model/serializable_resource.rb +70 -0
  24. data/lib/active_model/serializer/adapter/flatten_json.rb +12 -0
  25. data/lib/active_model/serializer/adapter/fragment_cache.rb +75 -0
  26. data/lib/active_model/serializer/adapter/json/fragment_cache.rb +5 -0
  27. data/lib/active_model/serializer/adapter/json.rb +47 -0
  28. data/lib/active_model/serializer/adapter/json_api/fragment_cache.rb +13 -0
  29. data/lib/active_model/serializer/adapter/json_api/pagination_links.rb +50 -0
  30. data/lib/active_model/serializer/adapter/json_api.rb +158 -0
  31. data/lib/active_model/serializer/adapter/null.rb +5 -0
  32. data/lib/active_model/serializer/adapter.rb +159 -0
  33. data/lib/active_model/serializer/array_serializer.rb +40 -0
  34. data/lib/active_model/serializer/association.rb +20 -0
  35. data/lib/active_model/serializer/associations.rb +83 -219
  36. data/lib/active_model/serializer/belongs_to_reflection.rb +10 -0
  37. data/lib/active_model/serializer/collection_reflection.rb +7 -0
  38. data/lib/active_model/serializer/configuration.rb +14 -0
  39. data/lib/active_model/serializer/fieldset.rb +40 -0
  40. data/lib/active_model/serializer/has_many_reflection.rb +10 -0
  41. data/lib/active_model/serializer/has_one_reflection.rb +10 -0
  42. data/lib/active_model/serializer/lint.rb +129 -0
  43. data/lib/active_model/serializer/railtie.rb +15 -0
  44. data/lib/active_model/serializer/reflection.rb +74 -0
  45. data/lib/active_model/serializer/singular_reflection.rb +7 -0
  46. data/lib/active_model/serializer/utils.rb +35 -0
  47. data/lib/active_model/{serializers → serializer}/version.rb +1 -1
  48. data/lib/active_model/serializer.rb +121 -465
  49. data/lib/active_model_serializers.rb +26 -88
  50. data/lib/generators/serializer/USAGE +0 -3
  51. data/lib/generators/serializer/resource_override.rb +12 -0
  52. data/lib/generators/serializer/serializer_generator.rb +8 -13
  53. data/lib/generators/serializer/templates/serializer.rb.erb +8 -0
  54. data/lib/tasks/rubocop.rake +0 -0
  55. data/test/action_controller/adapter_selector_test.rb +53 -0
  56. data/test/action_controller/explicit_serializer_test.rb +134 -0
  57. data/test/action_controller/json_api/linked_test.rb +179 -0
  58. data/test/action_controller/json_api/pagination_test.rb +116 -0
  59. data/test/{serialization_scope_name_test.rb → action_controller/serialization_scope_name_test.rb} +15 -15
  60. data/test/action_controller/serialization_test.rb +420 -0
  61. data/test/active_record_test.rb +9 -0
  62. data/test/adapter/fragment_cache_test.rb +37 -0
  63. data/test/adapter/json/belongs_to_test.rb +47 -0
  64. data/test/adapter/json/collection_test.rb +82 -0
  65. data/test/adapter/json/has_many_test.rb +47 -0
  66. data/test/adapter/json_api/belongs_to_test.rb +157 -0
  67. data/test/adapter/json_api/collection_test.rb +95 -0
  68. data/test/adapter/json_api/has_many_embed_ids_test.rb +45 -0
  69. data/test/adapter/json_api/has_many_explicit_serializer_test.rb +98 -0
  70. data/test/adapter/json_api/has_many_test.rb +145 -0
  71. data/test/adapter/json_api/has_one_test.rb +81 -0
  72. data/test/adapter/json_api/json_api_test.rb +37 -0
  73. data/test/adapter/json_api/linked_test.rb +283 -0
  74. data/test/adapter/json_api/pagination_links_test.rb +115 -0
  75. data/test/adapter/json_api/resource_type_config_test.rb +59 -0
  76. data/test/adapter/json_test.rb +47 -0
  77. data/test/adapter/null_test.rb +25 -0
  78. data/test/adapter_test.rb +42 -0
  79. data/test/array_serializer_test.rb +99 -73
  80. data/test/capture_warnings.rb +65 -0
  81. data/test/fixtures/active_record.rb +56 -0
  82. data/test/fixtures/poro.rb +261 -0
  83. data/test/generators/scaffold_controller_generator_test.rb +23 -0
  84. data/test/generators/serializer_generator_test.rb +56 -0
  85. data/test/lint_test.rb +37 -0
  86. data/test/logger_test.rb +18 -0
  87. data/test/poro_test.rb +9 -0
  88. data/test/serializable_resource_test.rb +27 -0
  89. data/test/serializers/adapter_for_test.rb +170 -0
  90. data/test/serializers/association_macros_test.rb +36 -0
  91. data/test/serializers/associations_test.rb +150 -0
  92. data/test/serializers/attribute_test.rb +62 -0
  93. data/test/serializers/attributes_test.rb +57 -0
  94. data/test/serializers/cache_test.rb +165 -0
  95. data/test/serializers/configuration_test.rb +15 -0
  96. data/test/serializers/fieldset_test.rb +25 -0
  97. data/test/serializers/meta_test.rb +121 -0
  98. data/test/serializers/options_test.rb +21 -0
  99. data/test/serializers/root_test.rb +21 -0
  100. data/test/serializers/serializer_for_test.rb +65 -0
  101. data/test/support/rails_app.rb +21 -0
  102. data/test/support/serialization_testing.rb +13 -0
  103. data/test/support/simplecov.rb +6 -0
  104. data/test/support/stream_capture.rb +50 -0
  105. data/test/support/test_case.rb +5 -0
  106. data/test/test_helper.rb +48 -24
  107. data/test/utils/include_args_to_hash_test.rb +79 -0
  108. metadata +219 -47
  109. data/DESIGN.textile +0 -586
  110. data/Gemfile.edge +0 -9
  111. data/bench/perf.rb +0 -43
  112. data/cruft.md +0 -19
  113. data/lib/active_model/array_serializer.rb +0 -104
  114. data/lib/active_record/serializer_override.rb +0 -16
  115. data/lib/generators/resource_override.rb +0 -13
  116. data/lib/generators/serializer/templates/serializer.rb +0 -19
  117. data/test/association_test.rb +0 -592
  118. data/test/caching_test.rb +0 -96
  119. data/test/generators_test.rb +0 -85
  120. data/test/no_serialization_scope_test.rb +0 -34
  121. data/test/serialization_test.rb +0 -392
  122. data/test/serializer_support_test.rb +0 -51
  123. data/test/serializer_test.rb +0 -1465
  124. data/test/test_fakes.rb +0 -217
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_model_serializers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.10.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
- - José Valim
8
- - Yehuda Katz
7
+ - Steve Klabnik
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-12-10 00:00:00.000000000 Z
11
+ date: 2015-09-16 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activemodel
@@ -17,100 +16,221 @@ dependencies:
17
16
  requirements:
18
17
  - - ">="
19
18
  - !ruby/object:Gem::Version
20
- version: '3.0'
19
+ version: '4.0'
21
20
  type: :runtime
22
21
  prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
23
  requirements:
25
24
  - - ">="
26
25
  - !ruby/object:Gem::Version
27
- version: '3.0'
26
+ version: '4.0'
28
27
  - !ruby/object:Gem::Dependency
29
- name: rails
28
+ name: actionpack
30
29
  requirement: !ruby/object:Gem::Requirement
31
30
  requirements:
32
31
  - - ">="
33
32
  - !ruby/object:Gem::Version
34
- version: '3.0'
35
- type: :development
33
+ version: '4.0'
34
+ type: :runtime
36
35
  prerelease: false
37
36
  version_requirements: !ruby/object:Gem::Requirement
38
37
  requirements:
39
38
  - - ">="
40
39
  - !ruby/object:Gem::Version
41
- version: '3.0'
40
+ version: '4.0'
42
41
  - !ruby/object:Gem::Dependency
43
- name: pry
42
+ name: railties
44
43
  requirement: !ruby/object:Gem::Requirement
45
44
  requirements:
46
45
  - - ">="
47
46
  - !ruby/object:Gem::Version
48
- version: '0'
49
- type: :development
47
+ version: '4.0'
48
+ type: :runtime
50
49
  prerelease: false
51
50
  version_requirements: !ruby/object:Gem::Requirement
52
51
  requirements:
53
52
  - - ">="
54
53
  - !ruby/object:Gem::Version
55
- version: '0'
54
+ version: '4.0'
56
55
  - !ruby/object:Gem::Dependency
57
- name: minitest
56
+ name: kaminari
58
57
  requirement: !ruby/object:Gem::Requirement
59
58
  requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.16.3
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.16.3
69
+ - !ruby/object:Gem::Dependency
70
+ name: will_paginate
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
60
76
  - - ">="
61
77
  - !ruby/object:Gem::Version
62
- version: '0'
78
+ version: 3.0.7
63
79
  type: :development
64
80
  prerelease: false
65
81
  version_requirements: !ruby/object:Gem::Requirement
66
82
  requirements:
83
+ - - "~>"
84
+ - !ruby/object:Gem::Version
85
+ version: '3.0'
67
86
  - - ">="
68
87
  - !ruby/object:Gem::Version
69
- version: '0'
70
- description: Making it easy to serialize models for client-side use
88
+ version: 3.0.7
89
+ - !ruby/object:Gem::Dependency
90
+ name: bundler
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '1.6'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '1.6'
103
+ - !ruby/object:Gem::Dependency
104
+ name: timecop
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '0.7'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '0.7'
117
+ description: ActiveModel::Serializers allows you to generate your JSON in an object-oriented
118
+ and convention-driven manner.
71
119
  email:
72
- - jose.valim@gmail.com
73
- - wycats@gmail.com
120
+ - steve@steveklabnik.com
74
121
  executables: []
75
122
  extensions: []
76
123
  extra_rdoc_files: []
77
124
  files:
78
125
  - ".gitignore"
126
+ - ".rubocop.yml"
127
+ - ".rubocop_todo.yml"
128
+ - ".simplecov"
79
129
  - ".travis.yml"
80
130
  - CHANGELOG.md
81
- - DESIGN.textile
131
+ - CONTRIBUTING.md
82
132
  - Gemfile
83
- - Gemfile.edge
84
- - MIT-LICENSE.txt
133
+ - LICENSE.txt
85
134
  - README.md
86
135
  - Rakefile
87
136
  - active_model_serializers.gemspec
88
- - bench/perf.rb
89
- - cruft.md
137
+ - appveyor.yml
138
+ - docs/README.md
139
+ - docs/general/adapters.md
140
+ - docs/general/configuration_options.md
141
+ - docs/general/getting_started.md
142
+ - docs/howto/add_pagination_links.md
143
+ - docs/howto/add_root_key.md
144
+ - docs/howto/outside_controller_use.md
90
145
  - lib/action_controller/serialization.rb
91
- - lib/active_model/array_serializer.rb
146
+ - lib/active_model/serializable_resource.rb
92
147
  - lib/active_model/serializer.rb
148
+ - lib/active_model/serializer/adapter.rb
149
+ - lib/active_model/serializer/adapter/flatten_json.rb
150
+ - lib/active_model/serializer/adapter/fragment_cache.rb
151
+ - lib/active_model/serializer/adapter/json.rb
152
+ - lib/active_model/serializer/adapter/json/fragment_cache.rb
153
+ - lib/active_model/serializer/adapter/json_api.rb
154
+ - lib/active_model/serializer/adapter/json_api/fragment_cache.rb
155
+ - lib/active_model/serializer/adapter/json_api/pagination_links.rb
156
+ - lib/active_model/serializer/adapter/null.rb
157
+ - lib/active_model/serializer/array_serializer.rb
158
+ - lib/active_model/serializer/association.rb
93
159
  - lib/active_model/serializer/associations.rb
94
- - lib/active_model/serializers/version.rb
160
+ - lib/active_model/serializer/belongs_to_reflection.rb
161
+ - lib/active_model/serializer/collection_reflection.rb
162
+ - lib/active_model/serializer/configuration.rb
163
+ - lib/active_model/serializer/fieldset.rb
164
+ - lib/active_model/serializer/has_many_reflection.rb
165
+ - lib/active_model/serializer/has_one_reflection.rb
166
+ - lib/active_model/serializer/lint.rb
167
+ - lib/active_model/serializer/railtie.rb
168
+ - lib/active_model/serializer/reflection.rb
169
+ - lib/active_model/serializer/singular_reflection.rb
170
+ - lib/active_model/serializer/utils.rb
171
+ - lib/active_model/serializer/version.rb
95
172
  - lib/active_model_serializers.rb
96
- - lib/active_record/serializer_override.rb
97
- - lib/generators/resource_override.rb
98
173
  - lib/generators/serializer/USAGE
174
+ - lib/generators/serializer/resource_override.rb
99
175
  - lib/generators/serializer/serializer_generator.rb
100
- - lib/generators/serializer/templates/serializer.rb
176
+ - lib/generators/serializer/templates/serializer.rb.erb
177
+ - lib/tasks/rubocop.rake
178
+ - test/action_controller/adapter_selector_test.rb
179
+ - test/action_controller/explicit_serializer_test.rb
180
+ - test/action_controller/json_api/linked_test.rb
181
+ - test/action_controller/json_api/pagination_test.rb
182
+ - test/action_controller/serialization_scope_name_test.rb
183
+ - test/action_controller/serialization_test.rb
184
+ - test/active_record_test.rb
185
+ - test/adapter/fragment_cache_test.rb
186
+ - test/adapter/json/belongs_to_test.rb
187
+ - test/adapter/json/collection_test.rb
188
+ - test/adapter/json/has_many_test.rb
189
+ - test/adapter/json_api/belongs_to_test.rb
190
+ - test/adapter/json_api/collection_test.rb
191
+ - test/adapter/json_api/has_many_embed_ids_test.rb
192
+ - test/adapter/json_api/has_many_explicit_serializer_test.rb
193
+ - test/adapter/json_api/has_many_test.rb
194
+ - test/adapter/json_api/has_one_test.rb
195
+ - test/adapter/json_api/json_api_test.rb
196
+ - test/adapter/json_api/linked_test.rb
197
+ - test/adapter/json_api/pagination_links_test.rb
198
+ - test/adapter/json_api/resource_type_config_test.rb
199
+ - test/adapter/json_test.rb
200
+ - test/adapter/null_test.rb
201
+ - test/adapter_test.rb
101
202
  - test/array_serializer_test.rb
102
- - test/association_test.rb
103
- - test/caching_test.rb
104
- - test/generators_test.rb
105
- - test/no_serialization_scope_test.rb
106
- - test/serialization_scope_name_test.rb
107
- - test/serialization_test.rb
108
- - test/serializer_support_test.rb
109
- - test/serializer_test.rb
110
- - test/test_fakes.rb
203
+ - test/capture_warnings.rb
204
+ - test/fixtures/active_record.rb
205
+ - test/fixtures/poro.rb
206
+ - test/generators/scaffold_controller_generator_test.rb
207
+ - test/generators/serializer_generator_test.rb
208
+ - test/lint_test.rb
209
+ - test/logger_test.rb
210
+ - test/poro_test.rb
211
+ - test/serializable_resource_test.rb
212
+ - test/serializers/adapter_for_test.rb
213
+ - test/serializers/association_macros_test.rb
214
+ - test/serializers/associations_test.rb
215
+ - test/serializers/attribute_test.rb
216
+ - test/serializers/attributes_test.rb
217
+ - test/serializers/cache_test.rb
218
+ - test/serializers/configuration_test.rb
219
+ - test/serializers/fieldset_test.rb
220
+ - test/serializers/meta_test.rb
221
+ - test/serializers/options_test.rb
222
+ - test/serializers/root_test.rb
223
+ - test/serializers/serializer_for_test.rb
224
+ - test/support/rails_app.rb
225
+ - test/support/serialization_testing.rb
226
+ - test/support/simplecov.rb
227
+ - test/support/stream_capture.rb
228
+ - test/support/test_case.rb
111
229
  - test/test_helper.rb
230
+ - test/utils/include_args_to_hash_test.rb
112
231
  homepage: https://github.com/rails-api/active_model_serializers
113
- licenses: []
232
+ licenses:
233
+ - MIT
114
234
  metadata: {}
115
235
  post_install_message:
116
236
  rdoc_options: []
@@ -120,17 +240,69 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
240
  requirements:
121
241
  - - ">="
122
242
  - !ruby/object:Gem::Version
123
- version: '0'
243
+ version: 1.9.3
124
244
  required_rubygems_version: !ruby/object:Gem::Requirement
125
245
  requirements:
126
- - - ">="
246
+ - - ">"
127
247
  - !ruby/object:Gem::Version
128
- version: '0'
248
+ version: 1.3.1
129
249
  requirements: []
130
250
  rubyforge_project:
131
- rubygems_version: 2.2.2
251
+ rubygems_version: 2.4.5
132
252
  signing_key:
133
253
  specification_version: 4
134
- summary: Bringing consistency and object orientation to model serialization. Works
135
- great for client-side MVC frameworks!
136
- test_files: []
254
+ summary: Conventions-based JSON generation for Rails.
255
+ test_files:
256
+ - test/action_controller/adapter_selector_test.rb
257
+ - test/action_controller/explicit_serializer_test.rb
258
+ - test/action_controller/json_api/linked_test.rb
259
+ - test/action_controller/json_api/pagination_test.rb
260
+ - test/action_controller/serialization_scope_name_test.rb
261
+ - test/action_controller/serialization_test.rb
262
+ - test/active_record_test.rb
263
+ - test/adapter/fragment_cache_test.rb
264
+ - test/adapter/json/belongs_to_test.rb
265
+ - test/adapter/json/collection_test.rb
266
+ - test/adapter/json/has_many_test.rb
267
+ - test/adapter/json_api/belongs_to_test.rb
268
+ - test/adapter/json_api/collection_test.rb
269
+ - test/adapter/json_api/has_many_embed_ids_test.rb
270
+ - test/adapter/json_api/has_many_explicit_serializer_test.rb
271
+ - test/adapter/json_api/has_many_test.rb
272
+ - test/adapter/json_api/has_one_test.rb
273
+ - test/adapter/json_api/json_api_test.rb
274
+ - test/adapter/json_api/linked_test.rb
275
+ - test/adapter/json_api/pagination_links_test.rb
276
+ - test/adapter/json_api/resource_type_config_test.rb
277
+ - test/adapter/json_test.rb
278
+ - test/adapter/null_test.rb
279
+ - test/adapter_test.rb
280
+ - test/array_serializer_test.rb
281
+ - test/capture_warnings.rb
282
+ - test/fixtures/active_record.rb
283
+ - test/fixtures/poro.rb
284
+ - test/generators/scaffold_controller_generator_test.rb
285
+ - test/generators/serializer_generator_test.rb
286
+ - test/lint_test.rb
287
+ - test/logger_test.rb
288
+ - test/poro_test.rb
289
+ - test/serializable_resource_test.rb
290
+ - test/serializers/adapter_for_test.rb
291
+ - test/serializers/association_macros_test.rb
292
+ - test/serializers/associations_test.rb
293
+ - test/serializers/attribute_test.rb
294
+ - test/serializers/attributes_test.rb
295
+ - test/serializers/cache_test.rb
296
+ - test/serializers/configuration_test.rb
297
+ - test/serializers/fieldset_test.rb
298
+ - test/serializers/meta_test.rb
299
+ - test/serializers/options_test.rb
300
+ - test/serializers/root_test.rb
301
+ - test/serializers/serializer_for_test.rb
302
+ - test/support/rails_app.rb
303
+ - test/support/serialization_testing.rb
304
+ - test/support/simplecov.rb
305
+ - test/support/stream_capture.rb
306
+ - test/support/test_case.rb
307
+ - test/test_helper.rb
308
+ - test/utils/include_args_to_hash_test.rb