jsonapi-materializer 2.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c717389aff888cf557007b45e6a9d0b9384b62c442f521cfb9ab85fe15562e47
|
4
|
+
data.tar.gz: 43c5e7e2d145117253094402cd561dfe6fa298815320e5dddd3be3eeae17855a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf5e65b10d88b6f9216be68505a7fa98b68ff0fefb45d49e60004bf15ff2e76501e57c02c0858b990f68d9f770405e07aae8ddaeb4ac562606660d40123060d0
|
7
|
+
data.tar.gz: 7c9e684d9d3f1ae3322990580b684b47101f1f4c7585a74f9fb7b06715ec4f6fb979d7ed051c00f623f70ee395fd94ec73cd955d04c702aa2dcef9c05ac6d9dd
|
@@ -59,8 +59,8 @@ module JSONAPI
|
|
59
59
|
end
|
60
60
|
|
61
61
|
private def fetch_relation(subject)
|
62
|
-
@
|
63
|
-
@
|
62
|
+
@fetch_relationships ||= {}
|
63
|
+
@fetch_relationships[checksum(subject)] ||= subject.object.public_send(from)
|
64
64
|
end
|
65
65
|
|
66
66
|
private def materializer_class
|
@@ -44,27 +44,31 @@ module JSONAPI
|
|
44
44
|
|
45
45
|
def as_data
|
46
46
|
{
|
47
|
-
id:,
|
48
|
-
type:,
|
49
47
|
attributes: exposed(attributes.except(:id))
|
50
48
|
.transform_values { |attribute| object.public_send(attribute.from) },
|
51
|
-
relationships:
|
52
|
-
.transform_values { |relation| relation.using(self).as_json }
|
49
|
+
relationships: relations
|
50
|
+
.transform_values { |relation| relation.using(self).as_json }
|
51
|
+
}.transform_values(&:presence).compact.merge(
|
52
|
+
id:,
|
53
|
+
type:,
|
53
54
|
links: {
|
54
55
|
self: links_self
|
56
|
+
# TODO: Add more links
|
55
57
|
}
|
56
|
-
|
58
|
+
)
|
57
59
|
end
|
58
60
|
# rubocop:enable Metrics/AbcSize
|
59
61
|
|
60
62
|
def as_json(*)
|
61
63
|
{
|
64
|
+
included:
|
65
|
+
}.transform_values(&:presence).compact.merge(
|
66
|
+
data: as_data,
|
62
67
|
links: {
|
63
68
|
self: links_self
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
}.transform_values(&:presence).compact
|
69
|
+
# TODO: Add more links
|
70
|
+
}
|
71
|
+
)
|
68
72
|
end
|
69
73
|
|
70
74
|
def type
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi-materializer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kurtis Rainbolt-Greene
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|