graphiti 1.0.rc.27 → 1.0.rc.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphiti/resource/configuration.rb +6 -0
- data/lib/graphiti/resource/remote.rb +6 -2
- data/lib/graphiti/schema.rb +2 -0
- data/lib/graphiti/sideload.rb +0 -1
- data/lib/graphiti/sideload/belongs_to.rb +11 -2
- data/lib/graphiti/util/serializer_relationships.rb +2 -0
- data/lib/graphiti/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf2a57f7befee66912eaf308320135cee89bd971d241eada385a4934a68f0420
|
4
|
+
data.tar.gz: 149550d9f6db9dfed354cb5b2caaf5bf558e129e6cde7857555073942ec9b5f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3676f54da17e51e333307e063e4a174e94c4d6fc0d9ea9de7579fb600f009633d61506e3f5c1cafdff001d8f60c1086427109548e73782e471cdbc05fccdac64
|
7
|
+
data.tar.gz: b15028c261c408f958a6a6725a8eb221e0d6836898afbcf9fa36a694ae2a199d96819b8e2889317962004f18118230f6c0daf22134e63604ad6b5c73fc701e58
|
@@ -18,8 +18,12 @@ module Graphiti
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
def save(
|
22
|
-
|
21
|
+
def save(model, meta)
|
22
|
+
if meta[:attributes] == {} && meta[:method] == :update
|
23
|
+
model
|
24
|
+
else
|
25
|
+
raise Errors::RemoteWrite.new(self.class)
|
26
|
+
end
|
23
27
|
end
|
24
28
|
|
25
29
|
def destroy(*args)
|
data/lib/graphiti/schema.rb
CHANGED
data/lib/graphiti/sideload.rb
CHANGED
@@ -23,8 +23,17 @@ class Graphiti::Sideload::BelongsTo < Graphiti::Sideload
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def infer_foreign_key
|
26
|
-
if polymorphic_child?
|
27
|
-
|
26
|
+
return parent.foreign_key if polymorphic_child?
|
27
|
+
|
28
|
+
if resource.remote?
|
29
|
+
namespace = namespace_for(resource.class)
|
30
|
+
resource_name = resource.class.name
|
31
|
+
.gsub("#{namespace}::", "")
|
32
|
+
.gsub("Resource", "")
|
33
|
+
if resource_name.include?(".remote")
|
34
|
+
resource_name = resource_name.split(".remote")[0].split(".")[1]
|
35
|
+
end
|
36
|
+
:"#{resource_name.singularize.underscore}_id"
|
28
37
|
else
|
29
38
|
model = resource.model
|
30
39
|
namespace = namespace_for(model)
|
@@ -109,6 +109,8 @@ module Graphiti
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def validate_link_for_sideload!(sideload)
|
112
|
+
return if sideload.resource.remote?
|
113
|
+
|
112
114
|
action = sideload.type == :belongs_to ? :show : :index
|
113
115
|
cache_key = :"#{@sideload.object_id}-#{action}"
|
114
116
|
return if self.class.validated_link_cache.include?(cache_key)
|
data/lib/graphiti/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphiti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.rc.
|
4
|
+
version: 1.0.rc.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Richmond
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsonapi-serializable
|
@@ -334,7 +334,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
334
334
|
version: 1.3.1
|
335
335
|
requirements: []
|
336
336
|
rubyforge_project:
|
337
|
-
rubygems_version: 2.7.
|
337
|
+
rubygems_version: 2.7.6
|
338
338
|
signing_key:
|
339
339
|
specification_version: 4
|
340
340
|
summary: Easily build jsonapi.org-compatible APIs
|