Commit graph

68 commits

Author SHA1 Message Date
Stephane Bounmy
94a6122c9e fix: when resource is empty, keep json resource root 2014-07-06 00:12:41 +02:00
Stephane Bounmy
e30af569b2 support active model serializer 0.9.x 2014-06-29 22:18:08 +02:00
jrhe
cfc6a02c65 Merge pull request #15 from zph/issue_13
[Issue #13] Add render syntactic sugar
2014-06-19 14:51:51 +01:00
Zander Hill
a7ce076ec7 [Issue #13] Add render syntactic sugar
As in issue #13 an example solution provided by @jrhe an implementation
of said feature has been created.

As per the discussion in the thread this is only a helper to be able to
reach the available options provided in the active_model_serializer gem.

usage is as follows:

```ruby
get '/some_path' do
  collection = Collection.all
  render collection, { meta: { current_page: 5 }, meta_key:
    :pagination_info }
end
```

The return value would be:
`{ pagination_info: { current_page: 5 }, collection: [item, item] }`

If given without a `meta_key` it would return as:
`{ meta: { current_page: 5 }, collection: [item, item] }`

Any feedback appreciated.

@zph, @olleolleolle and @bjoska
2014-02-09 22:51:17 +00:00
jrhe
3a35a468a5 Merge pull request #14 from wjp2013/master
fix default_root method to support symbol route in grape.
2013-12-19 07:32:33 -08:00
Victor Wang
cb4482d827 fix default_root method to support symbol route in grape. 2013-12-18 16:46:38 +08:00
jrhe
c41e24070e Merge pull request #12 from blue-kite/master
Add basic support for 'current_user'
2013-12-12 08:41:26 -08:00
Kyle Passarelli
beb9057b97 add support for 'current_user' 2013-10-07 19:30:20 -06:00
Kyle Passarelli
4b474ef8f2 remove '.DS_Store's 2013-10-07 18:20:06 -06:00
jrhe
29753df643 Merge pull request #11 from schickling/patch-1
Fixed require path
2013-10-04 00:47:10 -07:00
Johannes Schickling
ee911f2669 Fixed require path 2013-10-03 14:38:20 +02:00
Jonathan Richard Henry Evans
c84a0ea230 Adds warning about change of array root behaviour in 1.0 2013-09-09 15:54:43 +01:00
Jonathan Richard Henry Evans
02c2b1451b Bump version to 1.0.1 2013-09-09 13:19:02 +01:00
Jonathan Richard Henry Evans
6837bbc8d9 Fixes grammar in gemspec description 2013-09-09 13:18:24 +01:00
Jonathan Richard Henry Evans
9171351282 Adds licence and better description to gemspec so rubygems doesn't moan 2013-09-09 13:15:51 +01:00
Jonathan Richard Henry Evans
47772b28e8 Bump version to 1.0.0 2013-09-09 13:10:41 +01:00
Jonathan Richard Henry Evans
e138ea4276 Updated readme as to new root behaviour 2013-09-09 13:09:51 +01:00
Jonathan Richard Henry Evans
639daa9e4f Moves EndpointExtension into grape-active_model_serializers folder as we are not directly monkeypatching 2013-09-09 12:41:24 +01:00
Jonathan Richard Henry Evans
a936f119aa Adds stub specs 2013-09-09 12:38:03 +01:00
Jonathan Richard Henry Evans
6df2165f9f Moves aside old tests 2013-09-09 12:26:55 +01:00
Jonathan Richard Henry Evans
57335b7bd9 Seperates out spec_fakes.rb into support directory" 2013-09-09 12:23:43 +01:00
Jonathan Richard Henry Evans
251144d257 Changes root behaviour for arrays. If in a namspace the namespace name is used, if not the route name is used 2013-09-09 12:17:19 +01:00
Jonathan Richard Henry Evans
25e19804c3 Removes rspec version specifier 2013-09-09 11:15:44 +01:00
Jonathan Richard Henry Evans
32952064c8 Adds DS_Store to gitignore 2013-08-30 09:58:32 +01:00
Jonathan Richard Henry Evans
f50a86f890 Added guard-rspec 2013-08-30 09:56:25 +01:00
Jonathan Richard Henry Evans
dddd528ea4 Refactors Formatter 2013-08-29 16:41:03 +01:00
Jonathan Richard Henry Evans
811b6ce583 Tidied up readme 2013-08-29 16:13:13 +01:00
Jonathan Richard Henry Evans
4cba68f095 remove unused class attribute 2013-08-29 15:53:10 +01:00
Jonathan Richard Henry Evans
ea019c721e Remove disabling inferrence as it is no longer handled by us 2013-08-29 15:50:10 +01:00
Jonathan Richard Henry Evans
c599c489c3 Cleaned up tests 2013-08-29 15:46:31 +01:00
Jonathan Richard Henry Evans
d025cdba34 Added jazz_hands for debugging in development 2013-08-29 15:22:29 +01:00
Jonathan Richard Henry Evans
a1ae2166de Changed tests to use Plain Old Ruby Objects instead of ActiveRecord models to make testing easier. Gets rid of NullDB and ActiveRecord development dependencies 2013-08-21 10:31:11 +01:00
Jonathan Richard Henry Evans
02f4b154e4 Removed Gemfile.lock 2013-08-21 10:16:12 +01:00
Jonathan Richard Henry Evans
6b9bf5976a Remove active_record require 2013-08-21 10:15:48 +01:00
jrhe
e3fa92406b Merge pull request #8 from blackxored/small-fixes
Fixes the build and upgrades the locked gems
2013-08-10 16:12:30 -07:00
Jonathan Evans
998e4b31e6 Added MIT License 2013-08-11 00:01:26 +01:00
Jonathan Evans
593d6498f0 Added code climate 2013-08-10 23:46:21 +01:00
Adrian Perez
c64bbf22f3 Fix examples, should green the build 2013-08-03 18:06:12 +04:00
Adrian Perez
4ec628cd1f Update Gemfile.lock 2013-08-03 18:05:54 +04:00
jrhe
6700eb2cca Merge pull request #6 from tfe/master
Conform to ActiveModel::Serializers' way of determining array-ness
2013-07-19 09:26:14 -07:00
Todd Eichel
5f3f4d5904 Use the same test for resource array-ness that ActiveModel::Serializers itself uses. This should be more reliable and it's probably good to conform to AM::Serializers behavior wherever possible. 2013-06-20 00:55:29 -07:00
jrhe
77e3b26251 Merge pull request #5 from campaignio/master
Re-add Active Model Serializers Dependency
2013-06-06 03:04:18 -07:00
John Allen
503b05b53d Requires compatible version of AMS 2013-05-24 10:13:55 -04:00
John Allen
1005a65513 Re-adds active_model_serializers as dependency
Thanks to @george pointing out that the current code base is currently
dependent on AMS 0.8.0 so let's enforce that dependency.
2013-05-24 09:01:28 -04:00
jrhe
cb7fd7a811 Merge pull request #2 from tevanoff/remove-pry-requirement
Removed the pry requirement since it created an unnecessary dependency.
2013-05-18 23:25:47 -07:00
jrhe
b55a8586fe Merge pull request #4 from campaignio/master
Support for namespace options and rely more on active_model_serializers
2013-05-18 23:24:55 -07:00
John Allen
3b02d16211 Ensures there is a root available for arrays 2013-05-16 18:58:35 -04:00
John Allen
7933a1796b Spec setup updates, almost passing 2013-05-16 09:56:13 -04:00
John Allen
9d9f166925 Moves Grape::Endpoint extension into a module
Adding methods into the Grape::Endpoint class that
ActiveModel::Serializers are relying on from ActionController as well as
a few convenience methods for Route and Namespace options. I believe we
can expand on some of the empty methods here to allow for higher (api)
level option setting and defaults. This is a first step in that
direction.
2013-05-16 09:14:11 -04:00
John Allen
7f02d8f0d5 Removes unnecessary dependencies
There are some dependencies that are not required for this gem (eg.
tilt) that I'm removing. In addition some of the dependencies were only
necessary for development/test so I'm moving all of that into the gempsec and
making that clear there.
2013-05-16 09:06:37 -04:00