jsonapi-resources 0.4.2 → 0.4.3

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/README.md +103 -71
  4. data/Rakefile +2 -2
  5. data/jsonapi-resources.gemspec +2 -2
  6. data/lib/jsonapi-resources.rb +0 -1
  7. data/lib/jsonapi/active_record_operations_processor.rb +10 -2
  8. data/lib/jsonapi/acts_as_resource_controller.rb +26 -24
  9. data/lib/jsonapi/association.rb +50 -15
  10. data/lib/jsonapi/callbacks.rb +1 -2
  11. data/lib/jsonapi/configuration.rb +8 -24
  12. data/lib/jsonapi/error.rb +1 -2
  13. data/lib/jsonapi/error_codes.rb +3 -1
  14. data/lib/jsonapi/exceptions.rb +59 -47
  15. data/lib/jsonapi/include_directives.rb +11 -11
  16. data/lib/jsonapi/mime_types.rb +2 -2
  17. data/lib/jsonapi/operation.rb +28 -11
  18. data/lib/jsonapi/operations_processor.rb +16 -5
  19. data/lib/jsonapi/paginator.rb +19 -19
  20. data/lib/jsonapi/request.rb +175 -196
  21. data/lib/jsonapi/resource.rb +158 -105
  22. data/lib/jsonapi/resource_serializer.rb +37 -26
  23. data/lib/jsonapi/resources/version.rb +2 -2
  24. data/lib/jsonapi/response_document.rb +5 -4
  25. data/lib/jsonapi/routing_ext.rb +24 -19
  26. data/test/controllers/controller_test.rb +261 -31
  27. data/test/fixtures/active_record.rb +206 -8
  28. data/test/fixtures/book_comments.yml +2 -1
  29. data/test/fixtures/books.yml +1 -0
  30. data/test/fixtures/documents.yml +3 -0
  31. data/test/fixtures/people.yml +8 -1
  32. data/test/fixtures/pictures.yml +15 -0
  33. data/test/fixtures/products.yml +3 -0
  34. data/test/fixtures/vehicles.yml +8 -0
  35. data/test/helpers/{hash_helpers.rb → assertions.rb} +6 -1
  36. data/test/integration/requests/request_test.rb +14 -3
  37. data/test/integration/routes/routes_test.rb +47 -0
  38. data/test/test_helper.rb +27 -4
  39. data/test/unit/serializer/include_directives_test.rb +5 -0
  40. data/test/unit/serializer/polymorphic_serializer_test.rb +384 -0
  41. data/test/unit/serializer/serializer_test.rb +19 -1
  42. metadata +14 -4
@@ -254,6 +254,12 @@ class SerializerTest < ActionDispatch::IntegrationTest
254
254
  related: "/people/1/hairCut"
255
255
  },
256
256
  data: nil
257
+ },
258
+ vehicles: {
259
+ links: {
260
+ self: "/people/1/relationships/vehicles",
261
+ related: "/people/1/vehicles"
262
+ }
257
263
  }
258
264
  }
259
265
  }
@@ -356,6 +362,12 @@ class SerializerTest < ActionDispatch::IntegrationTest
356
362
  related: '/people/1/hairCut'
357
363
  },
358
364
  data: nil
365
+ },
366
+ vehicles: {
367
+ links: {
368
+ self: "/people/1/relationships/vehicles",
369
+ related: "/people/1/vehicles"
370
+ }
359
371
  }
360
372
  }
361
373
  }
@@ -611,7 +623,13 @@ class SerializerTest < ActionDispatch::IntegrationTest
611
623
  related: "/people/2/hairCut"
612
624
  },
613
625
  data: nil
614
- }
626
+ },
627
+ vehicles: {
628
+ links: {
629
+ self: "/people/2/relationships/vehicles",
630
+ related: "/people/2/vehicles"
631
+ }
632
+ },
615
633
  }
616
634
  },
617
635
  included: [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Gebhardt
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-06-19 00:00:00.000000000 Z
12
+ date: 2015-07-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -171,6 +171,7 @@ files:
171
171
  - test/fixtures/comments.yml
172
172
  - test/fixtures/comments_tags.yml
173
173
  - test/fixtures/customers.yml
174
+ - test/fixtures/documents.yml
174
175
  - test/fixtures/expense_entries.yml
175
176
  - test/fixtures/facts.yml
176
177
  - test/fixtures/hair_cuts.yml
@@ -179,14 +180,17 @@ files:
179
180
  - test/fixtures/numeros_telefone.yml
180
181
  - test/fixtures/order_flags.yml
181
182
  - test/fixtures/people.yml
183
+ - test/fixtures/pictures.yml
182
184
  - test/fixtures/posts.yml
183
185
  - test/fixtures/posts_tags.yml
184
186
  - test/fixtures/preferences.yml
187
+ - test/fixtures/products.yml
185
188
  - test/fixtures/purchase_orders.yml
186
189
  - test/fixtures/sections.yml
187
190
  - test/fixtures/tags.yml
191
+ - test/fixtures/vehicles.yml
192
+ - test/helpers/assertions.rb
188
193
  - test/helpers/functional_helpers.rb
189
- - test/helpers/hash_helpers.rb
190
194
  - test/helpers/value_matchers.rb
191
195
  - test/helpers/value_matchers_test.rb
192
196
  - test/integration/requests/request_test.rb
@@ -198,6 +202,7 @@ files:
198
202
  - test/unit/pagination/paged_paginator_test.rb
199
203
  - test/unit/resource/resource_test.rb
200
204
  - test/unit/serializer/include_directives_test.rb
205
+ - test/unit/serializer/polymorphic_serializer_test.rb
201
206
  - test/unit/serializer/response_document_test.rb
202
207
  - test/unit/serializer/serializer_test.rb
203
208
  homepage: https://github.com/cerebris/jsonapi-resources
@@ -233,6 +238,7 @@ test_files:
233
238
  - test/fixtures/comments.yml
234
239
  - test/fixtures/comments_tags.yml
235
240
  - test/fixtures/customers.yml
241
+ - test/fixtures/documents.yml
236
242
  - test/fixtures/expense_entries.yml
237
243
  - test/fixtures/facts.yml
238
244
  - test/fixtures/hair_cuts.yml
@@ -241,14 +247,17 @@ test_files:
241
247
  - test/fixtures/numeros_telefone.yml
242
248
  - test/fixtures/order_flags.yml
243
249
  - test/fixtures/people.yml
250
+ - test/fixtures/pictures.yml
244
251
  - test/fixtures/posts.yml
245
252
  - test/fixtures/posts_tags.yml
246
253
  - test/fixtures/preferences.yml
254
+ - test/fixtures/products.yml
247
255
  - test/fixtures/purchase_orders.yml
248
256
  - test/fixtures/sections.yml
249
257
  - test/fixtures/tags.yml
258
+ - test/fixtures/vehicles.yml
259
+ - test/helpers/assertions.rb
250
260
  - test/helpers/functional_helpers.rb
251
- - test/helpers/hash_helpers.rb
252
261
  - test/helpers/value_matchers.rb
253
262
  - test/helpers/value_matchers_test.rb
254
263
  - test/integration/requests/request_test.rb
@@ -260,5 +269,6 @@ test_files:
260
269
  - test/unit/pagination/paged_paginator_test.rb
261
270
  - test/unit/resource/resource_test.rb
262
271
  - test/unit/serializer/include_directives_test.rb
272
+ - test/unit/serializer/polymorphic_serializer_test.rb
263
273
  - test/unit/serializer/response_document_test.rb
264
274
  - test/unit/serializer/serializer_test.rb