jsonapi-resources 0.2.0 → 0.3.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/.travis.yml +5 -2
- data/Gemfile +3 -1
- data/README.md +52 -13
- data/jsonapi-resources.gemspec +1 -1
- data/lib/jsonapi-resources.rb +1 -0
- data/lib/jsonapi/association.rb +1 -9
- data/lib/jsonapi/error_codes.rb +1 -0
- data/lib/jsonapi/exceptions.rb +9 -5
- data/lib/jsonapi/formatter.rb +9 -18
- data/lib/jsonapi/paginator.rb +4 -15
- data/lib/jsonapi/request.rb +26 -42
- data/lib/jsonapi/resource.rb +35 -45
- data/lib/jsonapi/resource_controller.rb +6 -32
- data/lib/jsonapi/resource_serializer.rb +62 -33
- data/lib/jsonapi/resources/version.rb +1 -1
- data/lib/jsonapi/routing_ext.rb +4 -4
- data/test/config/database.yml +2 -1
- data/test/controllers/controller_test.rb +200 -160
- data/test/fixtures/active_record.rb +44 -201
- data/test/fixtures/book_comments.yml +11 -0
- data/test/fixtures/books.yml +6 -0
- data/test/fixtures/comments.yml +17 -0
- data/test/fixtures/comments_tags.yml +20 -0
- data/test/fixtures/expense_entries.yml +13 -0
- data/test/fixtures/facts.yml +11 -0
- data/test/fixtures/iso_currencies.yml +17 -0
- data/test/fixtures/people.yml +24 -0
- data/test/fixtures/posts.yml +96 -0
- data/test/fixtures/posts_tags.yml +59 -0
- data/test/fixtures/preferences.yml +18 -0
- data/test/fixtures/sections.yml +8 -0
- data/test/fixtures/tags.yml +39 -0
- data/test/helpers/hash_helpers.rb +0 -7
- data/test/integration/requests/request_test.rb +86 -28
- data/test/integration/routes/routes_test.rb +14 -25
- data/test/test_helper.rb +41 -17
- data/test/unit/jsonapi_request/jsonapi_request_test.rb +152 -0
- data/test/unit/operation/operations_processor_test.rb +13 -2
- data/test/unit/resource/resource_test.rb +68 -13
- data/test/unit/serializer/serializer_test.rb +328 -220
- metadata +33 -6
- data/lib/jsonapi/resource_for.rb +0 -29
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi-resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Gebhardt
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-03-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -142,13 +142,25 @@ files:
|
|
142
142
|
- lib/jsonapi/request.rb
|
143
143
|
- lib/jsonapi/resource.rb
|
144
144
|
- lib/jsonapi/resource_controller.rb
|
145
|
-
- lib/jsonapi/resource_for.rb
|
146
145
|
- lib/jsonapi/resource_serializer.rb
|
147
146
|
- lib/jsonapi/resources/version.rb
|
148
147
|
- lib/jsonapi/routing_ext.rb
|
149
148
|
- test/config/database.yml
|
150
149
|
- test/controllers/controller_test.rb
|
151
150
|
- test/fixtures/active_record.rb
|
151
|
+
- test/fixtures/book_comments.yml
|
152
|
+
- test/fixtures/books.yml
|
153
|
+
- test/fixtures/comments.yml
|
154
|
+
- test/fixtures/comments_tags.yml
|
155
|
+
- test/fixtures/expense_entries.yml
|
156
|
+
- test/fixtures/facts.yml
|
157
|
+
- test/fixtures/iso_currencies.yml
|
158
|
+
- test/fixtures/people.yml
|
159
|
+
- test/fixtures/posts.yml
|
160
|
+
- test/fixtures/posts_tags.yml
|
161
|
+
- test/fixtures/preferences.yml
|
162
|
+
- test/fixtures/sections.yml
|
163
|
+
- test/fixtures/tags.yml
|
152
164
|
- test/helpers/functional_helpers.rb
|
153
165
|
- test/helpers/hash_helpers.rb
|
154
166
|
- test/helpers/value_matchers.rb
|
@@ -156,6 +168,7 @@ files:
|
|
156
168
|
- test/integration/requests/request_test.rb
|
157
169
|
- test/integration/routes/routes_test.rb
|
158
170
|
- test/test_helper.rb
|
171
|
+
- test/unit/jsonapi_request/jsonapi_request_test.rb
|
159
172
|
- test/unit/operation/operations_processor_test.rb
|
160
173
|
- test/unit/resource/resource_test.rb
|
161
174
|
- test/unit/serializer/serializer_test.rb
|
@@ -171,12 +184,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
171
184
|
requirements:
|
172
185
|
- - ">="
|
173
186
|
- !ruby/object:Gem::Version
|
174
|
-
version:
|
187
|
+
version: '2.0'
|
175
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
189
|
requirements:
|
177
|
-
- - "
|
190
|
+
- - ">"
|
178
191
|
- !ruby/object:Gem::Version
|
179
|
-
version:
|
192
|
+
version: 1.3.1
|
180
193
|
requirements: []
|
181
194
|
rubyforge_project:
|
182
195
|
rubygems_version: 2.4.5
|
@@ -187,6 +200,19 @@ test_files:
|
|
187
200
|
- test/config/database.yml
|
188
201
|
- test/controllers/controller_test.rb
|
189
202
|
- test/fixtures/active_record.rb
|
203
|
+
- test/fixtures/book_comments.yml
|
204
|
+
- test/fixtures/books.yml
|
205
|
+
- test/fixtures/comments.yml
|
206
|
+
- test/fixtures/comments_tags.yml
|
207
|
+
- test/fixtures/expense_entries.yml
|
208
|
+
- test/fixtures/facts.yml
|
209
|
+
- test/fixtures/iso_currencies.yml
|
210
|
+
- test/fixtures/people.yml
|
211
|
+
- test/fixtures/posts.yml
|
212
|
+
- test/fixtures/posts_tags.yml
|
213
|
+
- test/fixtures/preferences.yml
|
214
|
+
- test/fixtures/sections.yml
|
215
|
+
- test/fixtures/tags.yml
|
190
216
|
- test/helpers/functional_helpers.rb
|
191
217
|
- test/helpers/hash_helpers.rb
|
192
218
|
- test/helpers/value_matchers.rb
|
@@ -194,6 +220,7 @@ test_files:
|
|
194
220
|
- test/integration/requests/request_test.rb
|
195
221
|
- test/integration/routes/routes_test.rb
|
196
222
|
- test/test_helper.rb
|
223
|
+
- test/unit/jsonapi_request/jsonapi_request_test.rb
|
197
224
|
- test/unit/operation/operations_processor_test.rb
|
198
225
|
- test/unit/resource/resource_test.rb
|
199
226
|
- test/unit/serializer/serializer_test.rb
|
data/lib/jsonapi/resource_for.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
module JSONAPI
|
2
|
-
module ResourceFor
|
3
|
-
def self.included base
|
4
|
-
base.extend ClassMethods
|
5
|
-
end
|
6
|
-
|
7
|
-
module ClassMethods
|
8
|
-
# :nocov:
|
9
|
-
if RUBY_VERSION >= '2.0'
|
10
|
-
def resource_for(type)
|
11
|
-
resource_name = JSONAPI::Resource._resource_name_from_type(type)
|
12
|
-
Object.const_get(resource_name, false) if resource_name
|
13
|
-
rescue NameError
|
14
|
-
raise NameError, "JSONAPI: Could not find resource '#{type}'. (Class #{resource_name} not found)"
|
15
|
-
end
|
16
|
-
else
|
17
|
-
def resource_for(type)
|
18
|
-
resource_name = JSONAPI::Resource._resource_name_from_type(type)
|
19
|
-
resource = resource_name.safe_constantize if resource_name
|
20
|
-
if resource.nil?
|
21
|
-
raise NameError, "JSONAPI: Could not find resource '#{type}'. (Class #{resource_name} not found)"
|
22
|
-
end
|
23
|
-
resource
|
24
|
-
end
|
25
|
-
end
|
26
|
-
# :nocov:
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|