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.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -0
- data/.rubocop_todo.yml +0 -7
- data/.travis.yml +0 -1
- data/CHANGELOG.md +25 -17
- data/README.md +8 -1
- data/UPGRADING.md +142 -6
- data/grape-active_model_serializers.gemspec +3 -3
- data/lib/grape-active_model_serializers.rb +2 -0
- data/lib/grape-active_model_serializers/endpoint_extension.rb +5 -3
- data/lib/grape-active_model_serializers/formatter.rb +14 -46
- data/lib/grape-active_model_serializers/options_builder.rb +68 -0
- data/lib/grape-active_model_serializers/serializer_resolver.rb +99 -0
- data/lib/grape-active_model_serializers/version.rb +1 -1
- data/spec/features/grape-active_model_serializers/render_spec.rb +1 -0
- data/spec/grape-active_model_serializers/endpoint_extension_spec.rb +22 -4
- data/spec/grape-active_model_serializers/formatter_spec.rb +15 -7
- data/spec/grape-active_model_serializers/versioned_api_formatter_spec.rb +22 -9
- data/spec/grape/active_model_serializers/serializer_resolver_spec.rb +146 -0
- data/spec/old_grape_ams_spec.rb +53 -11
- data/spec/support/api/users_api.rb +13 -0
- data/spec/support/api/v4/users_api.rb +15 -0
- data/spec/support/models/blog_post.rb +6 -1
- data/spec/support/models/user.rb +6 -1
- data/spec/support/serializers/v2/user_serializer.rb +5 -0
- data/spec/support/serializers/v3/user_serializer.rb +5 -0
- data/spec/support/serializers/v4/user_serializer.rb +5 -0
- data/spec/support/serializers/v5/user_serializer.rb +5 -0
- metadata +24 -8
@@ -1,7 +1,12 @@
|
|
1
1
|
class BlogPost
|
2
|
-
include ActiveModel::
|
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?
|
data/spec/support/models/user.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
class User
|
2
|
-
include ActiveModel::
|
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?
|
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
|
+
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-
|
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:
|
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:
|
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.
|
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.
|
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.
|
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.
|
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:
|