João Moura
da7e6dc795
Merge pull request #1247 from beauby/jsonapi-toplevel-links
...
Add support for toplevel JSON API links.
2015-10-10 17:52:08 -03:00
Lucas Hosseini
eccb359cb9
Fix unnecessary nested serializers.
2015-10-08 18:13:58 +02:00
Lucas Hosseini
54303b6290
Add support for toplevel JSON API links.
2015-10-06 20:01:46 +02:00
Lucas Hosseini
f4bb4c81b0
Fix duplicate resources between data and included.
2015-10-06 17:25:27 +02:00
Lucas Hosseini
658810e6a0
Extract attributes filtering from serializer into adapter.
2015-10-05 08:21:26 +02:00
Benjamin Fleischer
a2bfe190e3
Merge pull request #1050 from bf4/json_api_member
...
Add top-level jsonapi member to JSON API adapter
2015-10-01 23:03:11 -05:00
Ivan Yurov
2dd569ae51
Add Serializer 'type' directive to control type field, for use by the JsonApi adapter
2015-10-01 22:48:57 -04:00
Benjamin Fleischer
9d7da8afc4
Add support for top level jsonapi member.
2015-10-01 21:22:49 -05:00
Benjamin Fleischer
19de5f7722
Introduce Adapter::Base
...
Breaking change:
- Adapters now inherit Adapter::Base
- 'Adapter' is now a module, no longer a class
Why?
- using a class as a namespace that you also inherit from is complicated and circular at time i.e.
buggy (see https://github.com/rails-api/active_model_serializers/pull/1177 )
- The class methods on Adapter aren't necessarily related to the instance methods, they're more
Adapter functions
- named `Base` because it's a Rails-ism
- It helps to isolate and highlight what the Adapter interface actually is
2015-09-20 12:26:04 -05:00
Lucas Hosseini
ce7a839f3d
Extended format for JSONAPI include option.
2015-09-13 22:45:47 +02:00
Lucas Hosseini
890003b305
Minor style improvements.
2015-09-07 09:06:17 +02:00
Lucas Hosseini
ebb05959d3
Merge remote-tracking branch 'upstream/master' into improve-tests
2015-09-07 09:03:17 +02:00
Benjamin Fleischer
228cc1c92a
Rubocop: Consistent spacing
2015-09-03 20:51:40 -05:00
Benjamin Fleischer
bdfe13c527
Style/StringLiterals single quote all the things
2015-09-03 20:50:45 -05:00
Lucas Hosseini
4bba16bf4e
Factor with_adapter + force cache clear before each test.
2015-08-28 17:00:24 +02:00
Lucas Hosseini
91235ba7bc
Add configuration option to set resource type to singular/plural with jsonapi.
2015-08-24 22:55:22 +02:00
Bruno Bacarini
d50262edbe
test pagination links the way the controller does
2015-08-20 11:32:03 -03:00
Bruno Bacarini
01eab3bdb4
send whole request context to model serializer
2015-08-19 10:48:48 -03:00
Bruno Bacarini
2c2f948fa0
Add pagination links automatically
...
Pagination links will be included in your response automatically as long
as the resource is paginated using Kaminari or WillPaginate
and if you are using a JSON-API adapter. The others adapters does not have this feature.
2015-08-18 19:04:04 -03:00
Bruno Bacarini
a41d90cce4
add self to pagination links
2015-08-18 19:04:04 -03:00
Bruno Bacarini
e0d050d2af
remove resource and options attr_reader from array_serialize
2015-08-18 19:04:03 -03:00
Bruno Bacarini
7be25fef14
include query_parameters on pagination links as well
2015-08-18 19:04:03 -03:00
Bruno Bacarini
e62a7d6f34
return complete URIs on pagination links
2015-08-18 19:04:03 -03:00
Bruno Bacarini
331218d1c3
add test to class of pagination links
2015-08-18 19:04:03 -03:00
Rodrigo Ra
df63b59512
Add key option to serializer associations
2015-07-05 19:47:58 -03:00
Hugo Almeida
f25071ca70
Fixes virtual value not being used
2015-06-29 10:48:12 +09:00
João Moura
741c4a4b51
updating tests to work with new virtual_value implementation
2015-06-26 02:16:35 -03:00
Benjamin Fleischer
cf77786da2
Fix #955
2015-06-26 02:16:34 -03:00
Justin Aiken
3710c32cee
Add some failing tests around has_many assocs...
...
..where no serializer is defined for the thing that is has_many'd
2015-06-26 02:16:34 -03:00
João Moura
1ea5608e78
updating tests to match new adapters structure
2015-06-15 13:39:36 -03:00
Lachlan Sylvester
97e82c3eb7
use model name to determine the type
2015-06-13 19:45:46 +10:00
Benedikt Deicke
4f576a1463
Adjusts JsonApi adapter to serialize relationships in a nested relationships hash
2015-05-21 16:35:35 +02:00
Benedikt Deicke
ca41901fb8
Adjusts JsonApi adapter to serialize attributes in a nested attributes hash
2015-05-21 16:23:01 +02:00
Alexandre de Oliveira
168c36fc7d
Merge pull request #810 from joaomdmoura/fragment-cache
...
Adding Fragment Cache to AMS
2015-04-21 17:57:55 -03:00
João Moura
792fb8a905
Adding Fragment Cache to AMS
...
It's an upgrade based on the new Cache implementation #693 .
It allows to use the Rails conventions to cache
specific attributes or associations.
It's based on the Cache Composition implementation.
2015-04-05 18:19:57 -03:00
Yohan Robert
6a0564a241
Fixed a bug that appears when a nil association is included
2015-04-03 12:50:05 +02:00
Mateo Murphy
5e560ddbef
Fix skipped test and add test for duplicate links
2015-03-24 19:46:30 -04:00
Mateo Murphy
33f3a88ba0
Implement included and id and type as per spec
2015-03-22 20:43:56 -04:00
Mateo Murphy
d82c599c68
Always use plural for linked types
...
Although spec is agnostic about inflection rules, examples given are plural
2015-03-22 20:43:11 -04:00
Mateo Murphy
0f55f21266
Update format of links
2015-03-22 20:41:20 -04:00
Mateo Murphy
da86747a3e
Use symbol for root in jsonapi, fix tests
2015-03-22 20:38:29 -04:00
Mateo Murphy
ca985e1afd
Use association value for determining serializer used
...
Ensures overridden association value works when orignal association does not return a result.
2015-03-19 23:28:00 -04:00
Robbie Pitts
ad5677c4ec
Make json api adapter 'include' option accept an array, accommodate comma delimited string for legacy reasons
2015-03-11 10:01:44 -04:00
Gary Gordon
c6044286ef
Workaround order dependent test failure
2015-03-01 13:47:40 -05:00
Gary Gordon
651b99f22e
Support has_one to be compatible with 0.8.x
...
Update README and CHANGELOG
2015-03-01 13:47:34 -05:00
Alexandre de Oliveira
77fb050d24
Merge pull request #821 from wjordan/patch-1
...
Fix explicit serializer for associations
2015-03-01 08:46:27 -05:00
Alexandre de Oliveira
3505bc64a3
Merge pull request #798 from donbobka/feature/fix_lost_test
...
Fix lost test `test_include_multiple_posts_and_linked`
2015-03-01 08:41:13 -05:00
Will Jordan
f4eb33d6e9
Update test_includes_linked_comments with correct expected result
2015-02-24 18:46:04 -08:00
Joao Moura
8a432ad2b3
Adding cache support to version 0.10.0
...
It's a new implementation of cache based on ActiveSupport::Cache.
The implementation abstracts the cache in Adapter class on a
private method called cached_object, this method is intended
to be used on Adapters inside serializable_hash method in order
to cache each instance of the object that will be returned by
the serializer.
Some of its features are:
- A different syntax. (no longer need the cache_key method).
- An options argument that have the same arguments of ActiveSupport::Cache::Store, plus a key option that will be the prefix of the object cache on a pattern "#{key}-#{object.id}".
- It cache the objects individually and not the whole Serializer return, re-using it in different requests (as a show and a index method for example.)
2015-02-02 14:53:34 -02:00
Vladimir Lyzo
54d6696e7c
Fix lost test test_include_multiple_posts_and_linked
2015-01-31 19:44:22 +03:00