fun_with_json_api 0.0.10.2 → 0.0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/locales/fun_with_json_api.en.yml +1 -0
- data/lib/fun_with_json_api/exceptions/unauthorized_attribute.rb +17 -0
- data/lib/fun_with_json_api/exceptions/unauthorized_relationship.rb +1 -1
- data/lib/fun_with_json_api/schema_validator.rb +1 -1
- data/lib/fun_with_json_api/schema_validators/{check_attributes.rb → check_attribute_names.rb} +22 -11
- data/lib/fun_with_json_api/version.rb +1 -1
- data/spec/dummy/log/test.log +8345 -0
- data/spec/fun_with_json_api/schema_validator_spec.rb +1 -1
- data/spec/fun_with_json_api/schema_validators/{check_attributes_spec.rb → check_attribute_names_spec.rb} +5 -5
- metadata +6 -5
@@ -19,7 +19,7 @@ describe FunWithJsonApi::SchemaValidator do
|
|
19
19
|
|
20
20
|
converted_document = { 'data' => { 'id' => '42', 'type' => 'examples' } }
|
21
21
|
[
|
22
|
-
FunWithJsonApi::SchemaValidators::
|
22
|
+
FunWithJsonApi::SchemaValidators::CheckAttributeNames,
|
23
23
|
FunWithJsonApi::SchemaValidators::CheckRelationships
|
24
24
|
].each do |property_check|
|
25
25
|
expect(property_check).to receive(:call).with(converted_document, deserializer)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe FunWithJsonApi::SchemaValidators::
|
3
|
+
describe FunWithJsonApi::SchemaValidators::CheckAttributeNames do
|
4
4
|
describe '.call' do
|
5
5
|
let(:document) do
|
6
6
|
{
|
@@ -35,18 +35,18 @@ describe FunWithJsonApi::SchemaValidators::CheckAttributes do
|
|
35
35
|
allow(deserializer).to receive(:attributes).and_return([])
|
36
36
|
end
|
37
37
|
|
38
|
-
it 'raises a
|
38
|
+
it 'raises a UnauthorizedAttribute error' do
|
39
39
|
expect do
|
40
40
|
subject
|
41
|
-
end.to raise_error(FunWithJsonApi::Exceptions::
|
41
|
+
end.to raise_error(FunWithJsonApi::Exceptions::UnauthorizedAttribute) do |e|
|
42
42
|
expect(e.http_status).to eq 403
|
43
43
|
expect(e.payload.size).to eq 1
|
44
44
|
|
45
45
|
payload = e.payload.first
|
46
|
-
expect(payload.code).to eq '
|
46
|
+
expect(payload.code).to eq 'unauthorized_attribute'
|
47
47
|
expect(payload.pointer).to eq '/data/attributes/foobar'
|
48
48
|
expect(payload.title).to eq(
|
49
|
-
'Request json_api attribute
|
49
|
+
'Request json_api attribute can not be updated by the current endpoint'
|
50
50
|
)
|
51
51
|
expect(payload.detail).to eq(
|
52
52
|
"The provided attribute 'foobar' can not be assigned to a 'examples' resource"\
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fun_with_json_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.10.
|
4
|
+
version: 0.0.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Morrall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -181,6 +181,7 @@ files:
|
|
181
181
|
- lib/fun_with_json_api/exceptions/missing_relationship.rb
|
182
182
|
- lib/fun_with_json_api/exceptions/missing_resource.rb
|
183
183
|
- lib/fun_with_json_api/exceptions/relationship_method_not_supported.rb
|
184
|
+
- lib/fun_with_json_api/exceptions/unauthorized_attribute.rb
|
184
185
|
- lib/fun_with_json_api/exceptions/unauthorized_relationship.rb
|
185
186
|
- lib/fun_with_json_api/exceptions/unauthorized_resource.rb
|
186
187
|
- lib/fun_with_json_api/exceptions/unknown_attribute.rb
|
@@ -190,7 +191,7 @@ files:
|
|
190
191
|
- lib/fun_with_json_api/pre_deserializer.rb
|
191
192
|
- lib/fun_with_json_api/railtie.rb
|
192
193
|
- lib/fun_with_json_api/schema_validator.rb
|
193
|
-
- lib/fun_with_json_api/schema_validators/
|
194
|
+
- lib/fun_with_json_api/schema_validators/check_attribute_names.rb
|
194
195
|
- lib/fun_with_json_api/schema_validators/check_collection_has_all_members.rb
|
195
196
|
- lib/fun_with_json_api/schema_validators/check_collection_is_authorized.rb
|
196
197
|
- lib/fun_with_json_api/schema_validators/check_document_id_matches_resource.rb
|
@@ -246,7 +247,7 @@ files:
|
|
246
247
|
- spec/fun_with_json_api/pre_deserializer_spec.rb
|
247
248
|
- spec/fun_with_json_api/railtie_spec.rb
|
248
249
|
- spec/fun_with_json_api/schema_validator_spec.rb
|
249
|
-
- spec/fun_with_json_api/schema_validators/
|
250
|
+
- spec/fun_with_json_api/schema_validators/check_attribute_names_spec.rb
|
250
251
|
- spec/fun_with_json_api/schema_validators/check_document_id_matches_resource_spec.rb
|
251
252
|
- spec/fun_with_json_api/schema_validators/check_document_type_matches_resource_spec.rb
|
252
253
|
- spec/fun_with_json_api/schema_validators/check_relationships_spec.rb
|
@@ -323,7 +324,7 @@ test_files:
|
|
323
324
|
- spec/fun_with_json_api/pre_deserializer_spec.rb
|
324
325
|
- spec/fun_with_json_api/railtie_spec.rb
|
325
326
|
- spec/fun_with_json_api/schema_validator_spec.rb
|
326
|
-
- spec/fun_with_json_api/schema_validators/
|
327
|
+
- spec/fun_with_json_api/schema_validators/check_attribute_names_spec.rb
|
327
328
|
- spec/fun_with_json_api/schema_validators/check_document_id_matches_resource_spec.rb
|
328
329
|
- spec/fun_with_json_api/schema_validators/check_document_type_matches_resource_spec.rb
|
329
330
|
- spec/fun_with_json_api/schema_validators/check_relationships_spec.rb
|