jsonapi-materializer 1.0.0.rc4 → 1.0.0.rc5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45e2b33985d2730ab66005e7e0189c6106cd390098f15bc896a972f6c1d6355a
|
4
|
+
data.tar.gz: e1cba7ed4b60dafe3979b6e7d6317311e5a65d0b0b202947d00c0b01bc0ccc13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee08a498093076a0125b46a08001ca82034f7deddd2654837885e896d74eddee6a6bd2a7a863dae16b5a589796c5c8b39d512d86cf2bdcb5c68f32a6496d91c6
|
7
|
+
data.tar.gz: 2250215080f11923be9f50bd67276b221a957437a0b8ac75b17360fd7be2935488167f11ab2ddecee7f505a3fb207587da55902cf537c40bc5f4de4ad64088b8
|
@@ -2,7 +2,7 @@ require("spec_helper")
|
|
2
2
|
|
3
3
|
RSpec.describe(JSONAPI::Materializer::Collection) do
|
4
4
|
let(:described_class) {ArticleMaterializer::Collection}
|
5
|
-
let(:policy) {Class.new { def read_attribute?(name); true end}}
|
5
|
+
let(:policy) {Class.new { def read_attribute?(type, name); true end}}
|
6
6
|
let(:collection) {described_class.new(:object => object, :includes => [["comments"], ["author"]], :context => {:policy => policy.new})}
|
7
7
|
|
8
8
|
describe("#as_json") do
|
@@ -26,8 +26,8 @@ module JSONAPI
|
|
26
26
|
|
27
27
|
def visible?(subject)
|
28
28
|
return visible if [true, false].include?(visible)
|
29
|
-
return subject.send(visible, self) if visible.is_a?(Symbol)
|
30
|
-
return visible.call(self) if visible.respond_to?(:call)
|
29
|
+
return subject.send(visible, :attribute, self) if visible.is_a?(Symbol)
|
30
|
+
return visible.call(:attribute, self) if visible.respond_to?(:call)
|
31
31
|
|
32
32
|
true
|
33
33
|
end
|
@@ -48,8 +48,8 @@ module JSONAPI
|
|
48
48
|
|
49
49
|
def visible?(subject)
|
50
50
|
return visible if [true, false].include?(visible)
|
51
|
-
return subject.send(visible, self) if visible.is_a?(Symbol)
|
52
|
-
return visible.call(self) if visible.respond_to?(:call)
|
51
|
+
return subject.send(visible, type, self) if visible.is_a?(Symbol)
|
52
|
+
return visible.call(type, self) if visible.respond_to?(:call)
|
53
53
|
|
54
54
|
true
|
55
55
|
end
|