Commit Graph

1184 Commits

Author SHA1 Message Date
L. Preston Sego III
bbebeab348 Merge pull request #1280 from vasilakisfil/patch-1
Show how pagination can be done using meta tag from controller in JSON adapter
2016-03-10 12:53:41 -05:00
Yohan Robert
eb515060e0 Merge pull request #1576 from bf4/rename_dummy_to_benchmark
Rename dummy to benchmark
2016-03-10 08:58:54 +01:00
Benjamin Fleischer
666756f779 Rename dummy to benchmark 2016-03-09 22:06:42 -06:00
L. Preston Sego III
821dcda700 Merge pull request #1393 from bf4/benchmarking
Setup benchmark testing
2016-03-09 22:28:08 -05:00
L. Preston Sego III
c8a45db111 Merge pull request #1570 from bmorrall/fix-last-pagination-page-size
Fixed pagination issue with last page size
2016-03-09 17:57:03 -05:00
Ben Morrall
b5dd90c8f9 Fixed pagination issue with last page size 2016-03-10 09:30:29 +11:00
Benjamin Fleischer
4cc454d49b Setup benchmarking structure
- Setup dummy app files in `test/dummy`
- Setup dummy test server `bin/serve_dummy
  - Note:  Serializer caching can be completely disabled by passing in
  `CACHE_ON=off bin/serve_dummy start` since Serializer#_cache is only
  set at boot.
- run with
  - ./bin/bench
  - `bin/bench` etc adapted from ruby-bench-suite
  - target files are `test/dummy/bm_*.rb`. Just add another to run it.
  - benchmark cache/no cache
  - remove rake dependency that loads unnecessary files
- remove git gem dependency
  - Running over revisions to be added in subsequent PR
2016-03-09 12:42:25 -06:00
João Moura
952ab0438f AMS Benchmark tests #832
Adding a benchmak test structure to help contributors to keep track
of how their PR will impact overall performance.

It enables developers to create test inside of tests/benchmark.

This implementation adds a rake task: ```rake benchmark``` that checkout
one commit before, run the test of  tests/benchmark, then mover back to
the last commit and run it again. By comparing the benchmark results between
both commits the contributor will notice if and how much  his contribution
will impact overall performance.
2016-03-09 12:42:25 -06:00
L. Preston Sego III
31a30c8214 Merge pull request #1569 from korzonek/master
Update CHANGELOG with info about codebeat badge
2016-03-09 11:06:55 -05:00
L. Preston Sego III
1bfe697ec9 Merge pull request #1571 from remear/pin-rake
Pin rake to < 11.0
2016-03-09 11:02:08 -05:00
Ben Mills
7f29683cb6 Pin rake to < 11.0
https://stackoverflow.com/questions/35893584/nomethoderror-undefined-method-last-comment-after-upgrading-to-rake-11/35893625#35893625
2016-03-09 08:33:29 -07:00
Tomasz Korzeniowski
7a41d115df Info about codebeat badge in misc section. 2016-03-09 14:33:37 +01:00
L. Preston Sego III
bd2939db44 Merge pull request #1567 from bf4/remove_ci_rbx
Remove rbx from CI. Allowing failures is just wasting resources
2016-03-09 07:57:29 -05:00
Benjamin Fleischer
3e63596423 Remove rbx from CI. Allowing failures is just wasting resources
Breaks too often.

Happy to re-add if someone want to take charge of keeping it green.
2016-03-08 23:01:43 -06:00
Ben Mills
4219844c12 Add resource-level meta docs. Update top-level meta docs. 2016-03-08 20:47:22 -07:00
L. Preston Sego III
7ab39bed85 Merge pull request #1565 from groyoh/refactor_fragment_cache
Refactor fragment cache methods
2016-03-08 21:08:45 -05:00
Yohan Robert
efb09051ea Refactor fragment cache methods
Removed extra calls to constantize and DRY'd the code.
2016-03-08 23:51:10 +01:00
L. Preston Sego III
f8d2aabf38 Merge pull request #1560 from groyoh/update_rubocop
Update rubocop
2016-03-08 17:24:39 -05:00
Yohan Robert
666dae89c6 Add entry in CHANGELOG for #1560 2016-03-08 22:35:48 +01:00
Benjamin Fleischer
464acd2e78 Update rubocop todos 2016-03-08 22:32:34 +01:00
Benjamin Fleischer
68d5233b31 Address rubocop warnings 2016-03-08 22:32:34 +01:00
Benjamin Fleischer
a26d3e4425 Rubocop autocorrect 2016-03-08 22:32:34 +01:00
Benjamin Fleischer
ec36ab7f60 Update Rubocop 2016-03-08 22:32:34 +01:00
Ben Mills
c97a80db95 Merge pull request #1564 from NullVoxPopuli/organize-badges
organize badges
2016-03-08 13:20:11 -07:00
L. Preston Sego III
08d3160ded Organize the badges
styling updates

remove styles, as github doesn't allow them
2016-03-08 13:17:46 -05:00
L. Preston Sego III
f46890820d Merge pull request #1551 from korzonek/master
add codebeat badge - need a badge organization PR
2016-03-08 11:52:41 -05:00
L. Preston Sego III
2acea0b0b2 Merge pull request #1561 from groyoh/update_changelog
Add entry in CHANGELOG for #1545
2016-03-08 08:42:18 -05:00
Yohan Robert
f69450f5db [skip ci] Add entry in CHANGELOG for #1545 2016-03-08 14:13:28 +01:00
L. Preston Sego III
b3c6c7eadd Merge pull request #1496 from nadavshatz/add-jruby-to-ci
Run all branches against JRuby on CI
2016-03-08 07:26:20 -05:00
Ben Mills
1aa64f2ac3 Merge pull request #1550 from remear/url-helpers
Add Rails url_helpers
2016-03-07 14:53:59 -07:00
Ben Mills
cc10928472 Provide Rails url_helpers via SerializationContext 2016-03-07 10:40:34 -07:00
Nadav Shatz
84b87e7d92 Run all branches against JRuby on CI 2016-03-07 11:41:37 -05:00
L. Preston Sego III
3ba5254a46 Merge pull request #1559 from groyoh/deperecation_dsl
Deperecation dsl
2016-03-07 09:36:37 -05:00
Yohan Robert
8dfbc4818d Simplify adapter deprecation and delegation
The Adapter module was refactored a bit to use Active Support delegation
and remove duplicated code.
The CHANGELOG was also added.
2016-03-07 15:09:09 +01:00
Benjamin Fleischer
1a312bc2d3 Merge pull request #1545 from CodedBeardedSignedTaylor/1506-document-passing-arbitrary-options-to-serializer
[DOCS] 1506 document passing arbitrary options to serializer
2016-03-07 01:09:50 -06:00
Benjamin Fleischer
b50195fde7 Add a deprecation DSL 2016-03-07 01:07:06 -06:00
Benjamin Fleischer
6b4c8df6fb Clean up test deprecation warnings 2016-03-06 23:35:22 -06:00
Benjamin Fleischer
5d7a1a4889 Remove the last of ApiObjects 2016-03-06 23:24:53 -06:00
Benjamin Fleischer
e30b2a4417 Merge branch 'groyoh-follow_up_1535'
Needs followup
- way we deprecate classes to be generalized
  - initialize old json api https://github.com/rails-api/active_model_serializers/pull/1543#discussion_r54368858
  - consider restoring ensure https://github.com/rails-api/active_model_serializers/pull/1543#discussion_r54368925
2016-03-06 23:15:46 -06:00
Yohan Robert
dd94fe2163 Follow up to #1535
- The removed classes and modules were added back with deprecation
  warning and deprecation test were added for them.
- One test was renamed because it contained `__`.
- Some tests were refactored.
- The ActiveModelSerializers::Deserialization module is now called
  Adapter instead of ActiveModelSerializers::Adapter.
- The changelog was added for #1535
2016-03-06 23:15:39 -06:00
L. Preston Sego III
79e6acbc4a Merge pull request #1004 from bf4/json_api_errors
JSON API Errors (Initial implementation and roadmap for full feature-set)
2016-03-06 22:09:18 -05:00
NullVoxPopuli
d03db81070 add an extra format token to the primary data string so that JRuby doesn't break 2016-03-06 20:05:25 -06:00
Benjamin Fleischer
e6ae34b84c Update documentation with Yard links 2016-03-06 20:05:25 -06:00
Benjamin Fleischer
3d986377b6 Collapse JSON API success/failure documents in one adapter
Idea per remear (Ben Mills) in the slack:
https://amserializers.slack.com/archives/general/p1455140474000171

remear:

    just so i understand, the adapter in `render json: resource, status: 422, adapter: 'json_api/error',
    serializer: ActiveModel::Serializer::ErrorSerializer` is a different one than, say what i’ve
    specified in a base serializer with `ActiveModel::Serializer.config.adapter = :json_api`. correct?

    and a followup question of, why not same adapter but different serializer?

me:

   With the way the code is written now, it might be possible to not require a special jsonapi adapter.
   However, the behavior is pretty different from the jsonapi adapter.

   this first draft of the PR had it automatically set the adapter if there were errors.  since that
   requires more discussion, I took a step back and made it explicit for this PR

   If I were to re-use the json api adapter and remove the error one, it think the serializable hash
   method would look like

   ```
   def serializable_hash(options = nil)
     return { errors: JsonApi::Error.collection_errors } if serializer.is_a?(ErrorsSerializer)
     return { errors: JsonApi::Error.resource_errors(serializer) } if serializer.is_a?(ErrorSerializer)
     options ||= {}
   ```

   I suppose it could be something more duckish like

   ```
   def serializable_hash(options = nil)
     if serializer.errors? # object.errors.any? || object.any? {|o| o.errors.any? }
       JsonApi::Error.new(serializer).serializable_hash
     else
       # etc
   ```
2016-03-06 12:03:17 -06:00
Benjamin Fleischer
96107c56aa Require explicit adapter/serializer to render JSON API errors
- Separate collection errors from resource errors in adapter
- Refactor to ErrorsSerializer; first-class json error methods
- DOCS
- Rails 4.0 requires assert exact exception class, boo
2016-03-06 12:03:17 -06:00
Benjamin Fleischer
dfe162638c Generalize detection of serializable resource with errors 2016-03-06 12:03:17 -06:00
Benjamin Fleischer
0ba944dabf RFC: Json Api Errors (WIP)
- ActiveModelSerializers::JsonPointer
- ActiveModel::Serializer::Adapter::JsonApi::Error
- ActiveModel::Serializer::Adapter::JsonApi::Error.attributes
- Fix rubocop config
2016-03-06 12:03:14 -06:00
Taylor Jones
48f8a892e6 a little bit more trimming 2016-03-04 11:14:43 -05:00
Taylor Jones
60a207bb0d wrong link 2016-03-04 11:12:09 -05:00
Taylor Jones
32c6bccec7 edits and rearranging logic 2016-03-04 11:09:38 -05:00