Commit Graph

195 Commits

Author SHA1 Message Date
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
Bruno Bacarini
e040d6fcce add action test to pagination links 2015-08-18 19:04:02 -03:00
Bruno Bacarini
1fe8b06986 exchange pagination class to inside json_api scope 2015-08-18 19:04:02 -03:00
Aaron Lerch
35c8f0d835 Update fragment cache to support namespaced objects 2015-08-17 17:12:30 -04:00
Mikhail Topolskiy
e8e4bdefd2 Use underscored json_root 2015-08-13 20:31:48 +03:00
Josh Lane
033ce8e88d allow for a type attribute
* "namespace" json_api specific type method
2015-08-11 08:33:05 -07:00
Josh Lane
f6e3d4e1f9 allow id attribute to be overriden 2015-08-04 09:22:05 -07:00
João Moura
c703d0f35c Merge pull request #985 from bolshakov/feature/each_association
Associations implementation refactoring
2015-07-31 10:57:03 -03:00
João M. D. Moura
88eabdf6ac fixing tests by using a Profile intance to avoid unrelated warning 2015-07-31 03:28:50 -03:00
João Moura
b78126565c Merge pull request #954 from bf4/encapsulate_serialization
Encapsulate serialization in ActiveModel::SerializableResource
2015-07-31 03:09:58 -03:00
João Moura
7bc16666fe Merge pull request #972 from bf4/capture_app_warnings
Capture app warnings on test run
2015-07-30 22:24:08 -03:00
Артём Большаков
2952a332e0 Associations refactoring
* Move all associations related code from Serializer class to Associations module
* Introduce Reflection class hierarchy
* Introduce Association class
* Rid off Serializer#each_association
* Introduce Serializer#associations enumerator
2015-07-30 11:20:29 +03:00
Benjamin Fleischer
df140293d3 Remove unused controller rescue_with_handler
Per
https://github.com/rails-api/active_model_serializers/pull/954#discussion_r32589882

Ref 917, 918
2015-07-23 11:06:11 -05:00
Benjamin Fleischer
a66df3009a Encapsulate serialization in ActiveModel::SerializableResource
Usage: ActiveModel::SerializableResource.serialize(resource, options)
2015-07-23 11:05:23 -05:00
João Moura
9817a5b595 updating tests 2015-07-23 02:11:34 -04:00
João Moura
6266b6a002 Merge pull request #1006 from bf4/inflector-testing
Fix adapter inflection bug for api -> API
2015-07-20 23:20:00 -04:00
vyrak bunleang
1b09d0ec42 array serializer uses root option for json_key if available 2015-07-16 15:34:19 -06:00
vyrak bunleang
1d31096600 include old implicit serialization custom root tests with failing empty array test 2015-07-16 15:32:09 -06:00
Marek Pietrucha
e5ccb8e4dd root option is working (fixed #986) 2015-07-16 15:32:09 -06:00
Jiajia Wang
91ffec41af Add test for ArraySerializer json_key method
test json key when resource is empty
2015-07-16 11:11:14 +10:00
Benjamin Fleischer
e7174a7820 Capture and print app warnings on test run
Configure not to fail the test, for now
2015-07-14 01:05:26 -05:00
Rodrigo Ra
851d121ea8 fix transient test failures 2015-07-13 22:44:04 -03:00
João Moura
775737619a Merge pull request #996 from bf4/serializer_lint
Add linter for serializable resource
2015-07-13 19:37:39 -04:00
Rob McFadzean
506739d4fb Added a (failing) test for when inflecting API 2015-07-10 11:23:55 +09:30
Benjamin Fleischer
28174e297d Add linter for serializable resource 2015-07-09 11:20:19 -05:00
João Moura
7fb94234a8 adding json-api meta test help 2015-07-08 10:15:14 -03:00
Rodrigo Ra
df63b59512 Add key option to serializer associations 2015-07-05 19:47:58 -03:00
João Moura
ac1991fd6b Merge pull request #982 from bf4/typo
Fix typo
2015-07-02 19:06:32 -03:00
Benjamin Fleischer
58a237ead1 Fix typo 2015-07-02 16:35:27 -05:00
Benjamin Fleischer
1bf2825909 Remove unused PORO#to_param 2015-07-02 16:34:10 -05:00
João Moura
952d8adcdc Merge pull request #978 from regonn/fix-generators-template
fix generators template bug
2015-07-02 00:31:55 -03:00
regonn
59a177e8b5 add serializer template test 2015-07-01 13:42:16 +09:00
Hugo Almeida
f25071ca70 Fixes virtual value not being used 2015-06-29 10:48:12 +09:00
Rodrigo Ra
7412c8d1c8 Fix transient tests failures 2015-06-26 09:33:53 -03:00
Benjamin Fleischer
17d560eae4 Account for different handling of symbol keys in Rails 4.0
Comparing as a JSON string vs. as the Hash that is convert to JSON
works around the different Hash representations.

This likely has to do with the introduction of
config.action_dispatch.perform_deep_munge in Rails 4.1
See Rails issue 13420

  1) Failure:
  ActiveModel::Serializer::Adapter::Json::HasManyTestTest#test_has_many_with_no_serializer
  [active_model_serializers/test/adapter/json/has_many_test.rb:36]:
  --- expected
  +++ actual
  @@ -1 +1 @@
  -{:id=>42, :tags=>[{"attributes"=>{"id"=>1, "name"=>"#hash_tag"}}]}
  +{:id=>42, :tags=>[{"attributes"=>{:id=>1, :name=>"#hash_tag"}}]}

  2) Failure:
  ActiveModel::Serializer::AssociationsTest#test_has_many_with_no_serializer
  [active_model_serializers/test/serializers/associations_test.rb:74]:
  --- expected
  +++ actual
  @@ -1 +1 @@
  -[{"attributes"=>{"name"=>"#hashtagged"}}]
  +[{"attributes"=>{:name=>"#hashtagged"}}]
2015-06-26 02:16:35 -03: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
d589268f95 adding new tests to cover array and object rendering 2015-06-26 02:15:42 -03:00
Aaron Lerch
6892ca39c9 Default the generated cache key to use custom #strftime instead of raw #to_s to achieve more accurate precision 2015-06-25 23:40:18 -04:00
Benjamin Fleischer
81935c8114 Restore has_one to generator
per #822 since it was readded in #725
2015-06-25 14:00:27 -05:00
João Moura
f67fd976ec Removing/Updating tests based on new FlattenJson adapter 2015-06-18 19:18:11 -03:00
João Moura
65e0d79195 pluralising root key when using arraySerializer 2015-06-15 15:59:01 -03:00
João Moura
329691276a disabling custom root option 2015-06-15 15:58:39 -03:00
João Moura
d061b2e9f4 enabling flatten json as default adapter 2015-06-15 13:49:24 -03:00