grape-active_model_serializers 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,13 @@
1
+ class UsersApi < Grape::API
2
+ resource :users do
3
+ desc 'all users'
4
+ get do
5
+ [User.new]
6
+ end
7
+
8
+ desc 'specified user'
9
+ get '/:id' do
10
+ User.new
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module V4
2
+ class UsersApi < Grape::API
3
+ resource :users do
4
+ desc 'all users'
5
+ get do
6
+ [User.new]
7
+ end
8
+
9
+ desc 'specified user'
10
+ get '/:id' do
11
+ User.new
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,7 +1,12 @@
1
1
  class BlogPost
2
- include ActiveModel::SerializerSupport
2
+ include ActiveModel::Serialization
3
+
3
4
  attr_accessor :title, :body
4
5
 
6
+ def self.model_name
7
+ to_s
8
+ end
9
+
5
10
  def initialize(params = {})
6
11
  params.each do |k, v|
7
12
  instance_variable_set("@#{k}", v) unless v.nil?
@@ -1,7 +1,12 @@
1
1
  class User
2
- include ActiveModel::SerializerSupport
2
+ include ActiveModel::Serialization
3
+
3
4
  attr_accessor :first_name, :last_name, :password, :email
4
5
 
6
+ def self.model_name
7
+ to_s
8
+ end
9
+
5
10
  def initialize(params = {})
6
11
  params.each do |k, v|
7
12
  instance_variable_set("@#{k}", v) unless v.nil?
@@ -0,0 +1,5 @@
1
+ module V2
2
+ class UserSerializer < ActiveModel::Serializer
3
+ attributes :first_name, :last_name, :email
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module V3
2
+ class UserSerializer < ActiveModel::Serializer
3
+ attributes :first_name, :last_name, :email
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module V4
2
+ class UserSerializer < ActiveModel::Serializer
3
+ attributes :first_name, :last_name, :email
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module V5
2
+ class UserSerializer < ActiveModel::Serializer
3
+ attributes :first_name, :last_name, :email
4
+ end
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-active_model_serializers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Richard Henry Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-15 00:00:00.000000000 Z
11
+ date: 2016-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.8.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.8.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: active_model_serializers
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.9.0
33
+ version: 0.10.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.9.0
40
+ version: 0.10.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: listen
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 0.28.0
117
+ version: 0.41.2
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 0.28.0
124
+ version: 0.41.2
125
125
  description: Provides a Formatter for the Grape API DSL to emit objects serialized
126
126
  with active_model_serializers.
127
127
  email:
@@ -148,19 +148,28 @@ files:
148
148
  - lib/grape-active_model_serializers.rb
149
149
  - lib/grape-active_model_serializers/endpoint_extension.rb
150
150
  - lib/grape-active_model_serializers/formatter.rb
151
+ - lib/grape-active_model_serializers/options_builder.rb
152
+ - lib/grape-active_model_serializers/serializer_resolver.rb
151
153
  - lib/grape-active_model_serializers/version.rb
152
154
  - spec/features/grape-active_model_serializers/render_spec.rb
153
155
  - spec/grape-active_model_serializers/endpoint_extension_spec.rb
154
156
  - spec/grape-active_model_serializers/formatter_spec.rb
155
157
  - spec/grape-active_model_serializers/versioned_api_formatter_spec.rb
156
158
  - spec/grape-active_model_serializers_spec.rb
159
+ - spec/grape/active_model_serializers/serializer_resolver_spec.rb
157
160
  - spec/old_grape_ams_spec.rb
158
161
  - spec/spec_helper.rb
162
+ - spec/support/api/users_api.rb
163
+ - spec/support/api/v4/users_api.rb
159
164
  - spec/support/models/blog_post.rb
160
165
  - spec/support/models/user.rb
161
166
  - spec/support/serializers/blog_post_serializer.rb
162
167
  - spec/support/serializers/user_serializer.rb
163
168
  - spec/support/serializers/v1/user_serializer.rb
169
+ - spec/support/serializers/v2/user_serializer.rb
170
+ - spec/support/serializers/v3/user_serializer.rb
171
+ - spec/support/serializers/v4/user_serializer.rb
172
+ - spec/support/serializers/v5/user_serializer.rb
164
173
  homepage: https://github.com/ruby-grape/grape-active_model_serializers
165
174
  licenses:
166
175
  - MIT
@@ -191,11 +200,18 @@ test_files:
191
200
  - spec/grape-active_model_serializers/formatter_spec.rb
192
201
  - spec/grape-active_model_serializers/versioned_api_formatter_spec.rb
193
202
  - spec/grape-active_model_serializers_spec.rb
203
+ - spec/grape/active_model_serializers/serializer_resolver_spec.rb
194
204
  - spec/old_grape_ams_spec.rb
195
205
  - spec/spec_helper.rb
206
+ - spec/support/api/users_api.rb
207
+ - spec/support/api/v4/users_api.rb
196
208
  - spec/support/models/blog_post.rb
197
209
  - spec/support/models/user.rb
198
210
  - spec/support/serializers/blog_post_serializer.rb
199
211
  - spec/support/serializers/user_serializer.rb
200
212
  - spec/support/serializers/v1/user_serializer.rb
213
+ - spec/support/serializers/v2/user_serializer.rb
214
+ - spec/support/serializers/v3/user_serializer.rb
215
+ - spec/support/serializers/v4/user_serializer.rb
216
+ - spec/support/serializers/v5/user_serializer.rb
201
217
  has_rdoc: