grape-active_model_serializers 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +7 -0
- data/Guardfile +24 -0
- data/LICENSE.txt +22 -0
- data/README.md +141 -0
- data/Rakefile +11 -0
- data/grape-active_model_serializers.gemspec +27 -0
- data/lib/.travis.yml +8 -0
- data/lib/grape-active_model_serializers.rb +5 -0
- data/lib/grape-active_model_serializers/endpoint_extension.rb +26 -0
- data/lib/grape-active_model_serializers/formatter.rb +44 -0
- data/lib/grape-active_model_serializers/version.rb +5 -0
- data/spec/grape-active_model_serializers/formatter_spec.rb +6 -0
- data/spec/grape-active_model_serializers_spec.rb +5 -0
- data/spec/old_grape_ams_spec.rb +118 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/support/models/blog_post.rb +10 -0
- data/spec/support/models/user.rb +10 -0
- data/spec/support/serializers/blog_post_serializer.rb +3 -0
- data/spec/support/serializers/user_serializer.rb +3 -0
- metadata +175 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 58bcfddca3256fcdbb1af668f25f340bc2000ab8
|
4
|
+
data.tar.gz: 75b2aa6e107a1402d825bc4c4afddce3bde93570
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 84615c11bc2426db13caa2e541bec83eebfc8939c5d3c479d351bd3916d67d58ff6507b31ae9f23796d2998cf5ef8485253e2bde677304c8478d5f1de487f4fd
|
7
|
+
data.tar.gz: fd6273206d0fb5fd80ccf9a26580aa211d2a70dd1a172461136c346fc7ff3a49d1adb116a1709cd2537bc8825874d3eb72d9a3b525525a0a93ab363d88c95e17
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec' do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
|
9
|
+
# Rails example
|
10
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
11
|
+
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
12
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
13
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
14
|
+
watch('config/routes.rb') { "spec/routing" }
|
15
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
16
|
+
|
17
|
+
# Capybara features specs
|
18
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
19
|
+
|
20
|
+
# Turnip features and steps
|
21
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
22
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
23
|
+
end
|
24
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Jonathan Evans
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
# Grape::ActiveModelSerializers
|
2
|
+
|
3
|
+
Use [active_model_serializers](https://github.com/rails-api/active_model_serializers) with [Grape](https://github.com/intridea/grape)!
|
4
|
+
|
5
|
+
[![Build Status](https://api.travis-ci.org/jrhe/grape-active_model_serializers.png)](http://travis-ci.org/jrhe/grape-active_model_serializers) [![Dependency Status](https://gemnasium.com/jrhe/grape-active_model_serializers.png)](https://gemnasium.com/jrhe/grape-active_model_serializers) [![Code Climate](https://codeclimate.com/github/jrhe/grape-active_model_serializers.png)](https://codeclimate.com/github/jrhe/grape-active_model_serializers)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add the `grape` and `grape-active_model_serializers` gems to Gemfile.
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'grape'
|
13
|
+
gem 'grape-active_model_serializers'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
bundle
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
### Require grape-active_model_serializers
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
# config.ru
|
26
|
+
require 'grape/active_model_serializers'
|
27
|
+
```
|
28
|
+
|
29
|
+
|
30
|
+
### Tell your API to use Grape::Formatter::ActiveModelSerializers
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
class API < Grape::API
|
34
|
+
format :json
|
35
|
+
formatter :json, Grape::Formatter::ActiveModelSerializers
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
|
40
|
+
### Writing serializers
|
41
|
+
|
42
|
+
See [active_model_serializers](https://github.com/rails-api/active_model_serializers)
|
43
|
+
|
44
|
+
|
45
|
+
### Serializers are inferred by active_record model names
|
46
|
+
|
47
|
+
`grape-active_model_serializers` will search for serializers for the objects returned by your grape API.
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
namespace :users do
|
51
|
+
get ":id" do
|
52
|
+
@user = User.find(params[:id])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
```
|
56
|
+
In this case, as User objects are being returned, grape-active_model_serializers will look for a serializer named UserSerializer.
|
57
|
+
|
58
|
+
### Array roots
|
59
|
+
When serializing an array, the array root is set to the innermost namespace name if there is one, otherwise it is set to the route name (e.g. get 'name')
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
namespace :users do
|
63
|
+
get ":id" do
|
64
|
+
@user = User.find(params[:id])
|
65
|
+
end
|
66
|
+
end
|
67
|
+
# root = users
|
68
|
+
```
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
get "people" do
|
72
|
+
@user = User.all
|
73
|
+
end
|
74
|
+
# root = people
|
75
|
+
```
|
76
|
+
|
77
|
+
### Manually specifying serializer options
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
# Serializer options can be specified on routes or namespaces.
|
81
|
+
namespace 'foo', :serializer => :bar do
|
82
|
+
get "/" do
|
83
|
+
# will use "bar" serializer
|
84
|
+
end
|
85
|
+
|
86
|
+
# Options specified on a route or namespace override those of the containing namespace.
|
87
|
+
get "/home", :serializer => :home do
|
88
|
+
# will use "home" serializer
|
89
|
+
end
|
90
|
+
|
91
|
+
# All standard options for `ActiveModel::Serializers` are supported.
|
92
|
+
get "/fancy_homes", :root => 'world', :each_serializer => :fancy_homes
|
93
|
+
...
|
94
|
+
end
|
95
|
+
end
|
96
|
+
```
|
97
|
+
|
98
|
+
|
99
|
+
### Full Example
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
class User < ActiveRecord::Base
|
103
|
+
attr_accessor :first_name, :last_name, :password, :email
|
104
|
+
end
|
105
|
+
|
106
|
+
class UserSerializer < ActiveModel::Serializer
|
107
|
+
attributes :first_name, :last_name
|
108
|
+
end
|
109
|
+
|
110
|
+
class API < Grape::API
|
111
|
+
get("/home") do
|
112
|
+
User.new({first_name: 'JR', last_name: 'HE', email: 'contact@jrhe.co.uk'})
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
API.new.get "/home" # => '{:user=>{:first_name=>"JR", :last_name=>"HE"}}'
|
117
|
+
```
|
118
|
+
|
119
|
+
|
120
|
+
## RSpec
|
121
|
+
|
122
|
+
See "Writing Tests" in https://github.com/intridea/grape.
|
123
|
+
|
124
|
+
Enjoy :)
|
125
|
+
|
126
|
+
|
127
|
+
## Contributing
|
128
|
+
|
129
|
+
1. Fork it
|
130
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
131
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
132
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
133
|
+
5. Create new Pull Request
|
134
|
+
|
135
|
+
|
136
|
+
## Thanks to
|
137
|
+
The developers and maintainers of:
|
138
|
+
[active_model_serializers](https://github.com/rails-api/active_model_serializers)
|
139
|
+
[Grape](https://github.com/intridea/grape)!
|
140
|
+
|
141
|
+
Structured and based upon [grape-rabl](https://github.com/LTe/grape-rabl).
|
data/Rakefile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
|
4
|
+
require 'rspec/core'
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
7
|
+
spec.rspec_opts = ['-fd -c']
|
8
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
9
|
+
end
|
10
|
+
|
11
|
+
task :default => :spec
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/grape-active_model_serializers/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Jonathan Richard Henry Evans"]
|
6
|
+
gem.email = ["contact@jrhe.co.uk"]
|
7
|
+
gem.summary = %q{Use active_model_serializer in grape}
|
8
|
+
gem.description = %q{Provides a Formatter for the Grape API DSL for emitting objects serialized with active_model_serializer serializers.}
|
9
|
+
gem.homepage = "https://github.com/jrhe/grape-active_model_serializers"
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "grape-active_model_serializers"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Grape::ActiveModelSerializers::VERSION
|
17
|
+
gem.licenses = ['MIT']
|
18
|
+
|
19
|
+
gem.add_dependency "grape", "~> 0.3"
|
20
|
+
gem.add_dependency "active_model_serializers", ">= 0.8.1"
|
21
|
+
|
22
|
+
gem.add_development_dependency "rspec"
|
23
|
+
gem.add_development_dependency "rack-test"
|
24
|
+
gem.add_development_dependency "rake"
|
25
|
+
gem.add_development_dependency "jazz_hands"
|
26
|
+
gem.add_development_dependency 'guard-rspec'
|
27
|
+
end
|
data/lib/.travis.yml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#
|
2
|
+
# Make the Grape::Endpoint quack like a ActionController
|
3
|
+
#
|
4
|
+
# This allows us to rely on the ActiveModel::Serializer#build_json method
|
5
|
+
# to lookup the approriate serializer.
|
6
|
+
#
|
7
|
+
module Grape
|
8
|
+
module EndpointExtension
|
9
|
+
attr_accessor :controller_name
|
10
|
+
|
11
|
+
def namespace_options
|
12
|
+
settings[:namespace] ? settings[:namespace].options : {}
|
13
|
+
end
|
14
|
+
|
15
|
+
def route_options
|
16
|
+
options[:route_options]
|
17
|
+
end
|
18
|
+
|
19
|
+
def default_serializer_options; end
|
20
|
+
def serialization_scope; end
|
21
|
+
def _serialization_scope; end
|
22
|
+
def url_options; end
|
23
|
+
end
|
24
|
+
|
25
|
+
Endpoint.send(:include, EndpointExtension)
|
26
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Grape
|
2
|
+
module Formatter
|
3
|
+
module ActiveModelSerializers
|
4
|
+
class << self
|
5
|
+
def call(resource, env)
|
6
|
+
serializer = fetch_serializer(resource, env)
|
7
|
+
|
8
|
+
if serializer
|
9
|
+
serializer.to_json
|
10
|
+
else
|
11
|
+
Grape::Formatter::Json.call resource, env
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def fetch_serializer(resource, env)
|
16
|
+
endpoint = env['api.endpoint']
|
17
|
+
options = build_options_from_endpoint(endpoint)
|
18
|
+
|
19
|
+
if resource.respond_to?(:to_ary) && !resource.empty?
|
20
|
+
# ensure we have an root to fallback on
|
21
|
+
endpoint.controller_name = default_root(endpoint)
|
22
|
+
end
|
23
|
+
::ActiveModel::Serializer.build_json(endpoint, resource, options)
|
24
|
+
end
|
25
|
+
|
26
|
+
def build_options_from_endpoint(endpoint)
|
27
|
+
endpoint.namespace_options.merge(endpoint.route_options)
|
28
|
+
end
|
29
|
+
|
30
|
+
# array root is the innermost namespace name ('space') if there is one,
|
31
|
+
# otherwise the route name (e.g. get 'name')
|
32
|
+
def default_root(endpoint)
|
33
|
+
innermost_scope = endpoint.settings.peek
|
34
|
+
|
35
|
+
if innermost_scope[:namespace]
|
36
|
+
innermost_scope[:namespace].space
|
37
|
+
else
|
38
|
+
endpoint.options[:path][0].split('/')[-1]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'support/models/user'
|
3
|
+
require 'support/models/blog_post'
|
4
|
+
require 'support/serializers/user_serializer'
|
5
|
+
require 'support/serializers/blog_post_serializer'
|
6
|
+
require "grape-active_model_serializers"
|
7
|
+
|
8
|
+
describe Grape::ActiveModelSerializers do
|
9
|
+
let(:app) { Class.new(Grape::API) }
|
10
|
+
|
11
|
+
before do
|
12
|
+
app.format :json
|
13
|
+
app.formatter :json, Grape::Formatter::ActiveModelSerializers
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
it "should respond with proper content-type" do
|
18
|
+
app.get("/home/users", :serializer => UserSerializer) do
|
19
|
+
User.new
|
20
|
+
end
|
21
|
+
get("/home/users")
|
22
|
+
last_response.headers["Content-Type"].should == "application/json"
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'serializer is set to nil' do
|
26
|
+
before do
|
27
|
+
app.get("/home", serializer: nil) do
|
28
|
+
{user: {first_name: "JR", last_name: "HE"}}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
it 'uses the built in grape serializer' do
|
32
|
+
get("/home")
|
33
|
+
last_response.body.should == "{\"user\":{\"first_name\":\"JR\",\"last_name\":\"HE\"}}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context "serializer isn't set" do
|
38
|
+
before do
|
39
|
+
app.get("/home") do
|
40
|
+
User.new({first_name: 'JR', last_name: 'HE', email: 'contact@jrhe.co.uk'})
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'infers the serializer' do
|
45
|
+
get "/home"
|
46
|
+
last_response.body.should == "{\"user\":{\"first_name\":\"JR\",\"last_name\":\"HE\"}}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
it "serializes arrays of objects" do
|
51
|
+
app.get("/users") do
|
52
|
+
user = User.new({first_name: 'JR', last_name: 'HE', email: 'contact@jrhe.co.uk'})
|
53
|
+
[user, user]
|
54
|
+
end
|
55
|
+
|
56
|
+
get "/users"
|
57
|
+
last_response.body.should == "{\"users\":[{\"first_name\":\"JR\",\"last_name\":\"HE\"},{\"first_name\":\"JR\",\"last_name\":\"HE\"}]}"
|
58
|
+
end
|
59
|
+
|
60
|
+
context "models with compound names" do
|
61
|
+
it "generates the proper 'root' node for individual objects" do
|
62
|
+
app.get("/home") do
|
63
|
+
BlogPost.new({title: 'Grape AM::S Rocks!', body: 'Really, it does.'})
|
64
|
+
end
|
65
|
+
|
66
|
+
get "/home"
|
67
|
+
last_response.body.should == "{\"blog_post\":{\"title\":\"Grape AM::S Rocks!\",\"body\":\"Really, it does.\"}}"
|
68
|
+
end
|
69
|
+
|
70
|
+
it "generates the proper 'root' node for serialized arrays" do
|
71
|
+
app.get("/blog_posts") do
|
72
|
+
blog_post = BlogPost.new({title: 'Grape AM::S Rocks!', body: 'Really, it does.'})
|
73
|
+
[blog_post, blog_post]
|
74
|
+
end
|
75
|
+
|
76
|
+
get "/blog_posts"
|
77
|
+
last_response.body.should == "{\"blog_posts\":[{\"title\":\"Grape AM::S Rocks!\",\"body\":\"Really, it does.\"},{\"title\":\"Grape AM::S Rocks!\",\"body\":\"Really, it does.\"}]}"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
it "uses namespace options when provided" do
|
82
|
+
app.namespace :admin, :serializer => UserSerializer do
|
83
|
+
get('/jeff') do
|
84
|
+
User.new(first_name: 'Jeff')
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
get "/admin/jeff"
|
89
|
+
last_response.body.should == "{\"user\":{\"first_name\":\"Jeff\",\"last_name\":null}}"
|
90
|
+
end
|
91
|
+
|
92
|
+
context 'route is in a namespace' do
|
93
|
+
it 'uses the name of the closest namespace for the root' do
|
94
|
+
app.namespace :admin do
|
95
|
+
get('/jeff') do
|
96
|
+
user = User.new(first_name: 'Jeff')
|
97
|
+
[user, user]
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
get "/admin/jeff"
|
102
|
+
last_response.body.should == "{\"admin\":[{\"first_name\":\"Jeff\",\"last_name\":null},{\"first_name\":\"Jeff\",\"last_name\":null}]}"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
context 'route is not in a namespace' do
|
107
|
+
it 'uses the of the route for the root' do
|
108
|
+
app.get('/people') do
|
109
|
+
user = User.new(first_name: 'Jeff')
|
110
|
+
[user, user]
|
111
|
+
end
|
112
|
+
|
113
|
+
get "/people"
|
114
|
+
last_response.body.should == "{\"people\":[{\"first_name\":\"Jeff\",\"last_name\":null},{\"first_name\":\"Jeff\",\"last_name\":null}]}"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
|
4
|
+
require 'bundler'
|
5
|
+
Bundler.setup :default, :test
|
6
|
+
|
7
|
+
require "active_model_serializers"
|
8
|
+
require 'active_support/core_ext/hash/conversions'
|
9
|
+
require "active_support/json"
|
10
|
+
require 'rspec'
|
11
|
+
require 'rack/test'
|
12
|
+
|
13
|
+
require 'jazz_hands'
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
config.include Rack::Test::Methods
|
17
|
+
end
|
18
|
+
|
19
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
metadata
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: grape-active_model_serializers
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jonathan Richard Henry Evans
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: grape
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: active_model_serializers
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.8.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.8.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rack-test
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: jazz_hands
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Provides a Formatter for the Grape API DSL for emitting objects serialized
|
112
|
+
with active_model_serializer serializers.
|
113
|
+
email:
|
114
|
+
- contact@jrhe.co.uk
|
115
|
+
executables: []
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- .DS_Store
|
120
|
+
- .gitignore
|
121
|
+
- Gemfile
|
122
|
+
- Guardfile
|
123
|
+
- LICENSE.txt
|
124
|
+
- README.md
|
125
|
+
- Rakefile
|
126
|
+
- grape-active_model_serializers.gemspec
|
127
|
+
- lib/.rspec
|
128
|
+
- lib/.travis.yml
|
129
|
+
- lib/grape-active_model_serializers.rb
|
130
|
+
- lib/grape-active_model_serializers/endpoint_extension.rb
|
131
|
+
- lib/grape-active_model_serializers/formatter.rb
|
132
|
+
- lib/grape-active_model_serializers/version.rb
|
133
|
+
- spec/.DS_Store
|
134
|
+
- spec/grape-active_model_serializers/formatter_spec.rb
|
135
|
+
- spec/grape-active_model_serializers_spec.rb
|
136
|
+
- spec/old_grape_ams_spec.rb
|
137
|
+
- spec/spec_helper.rb
|
138
|
+
- spec/support/models/blog_post.rb
|
139
|
+
- spec/support/models/user.rb
|
140
|
+
- spec/support/serializers/blog_post_serializer.rb
|
141
|
+
- spec/support/serializers/user_serializer.rb
|
142
|
+
homepage: https://github.com/jrhe/grape-active_model_serializers
|
143
|
+
licenses:
|
144
|
+
- MIT
|
145
|
+
metadata: {}
|
146
|
+
post_install_message:
|
147
|
+
rdoc_options: []
|
148
|
+
require_paths:
|
149
|
+
- lib
|
150
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - '>='
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
requirements: []
|
161
|
+
rubyforge_project:
|
162
|
+
rubygems_version: 2.0.7
|
163
|
+
signing_key:
|
164
|
+
specification_version: 4
|
165
|
+
summary: Use active_model_serializer in grape
|
166
|
+
test_files:
|
167
|
+
- spec/grape-active_model_serializers/formatter_spec.rb
|
168
|
+
- spec/grape-active_model_serializers_spec.rb
|
169
|
+
- spec/old_grape_ams_spec.rb
|
170
|
+
- spec/spec_helper.rb
|
171
|
+
- spec/support/models/blog_post.rb
|
172
|
+
- spec/support/models/user.rb
|
173
|
+
- spec/support/serializers/blog_post_serializer.rb
|
174
|
+
- spec/support/serializers/user_serializer.rb
|
175
|
+
has_rdoc:
|