graphiti 1.0.alpha.23 → 1.0.alpha.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/graphiti.gemspec +1 -0
- data/lib/graphiti.rb +12 -0
- data/lib/graphiti/resource/sideloading.rb +1 -1
- data/lib/graphiti/sideload.rb +10 -0
- data/lib/graphiti/util/serializer_relationships.rb +3 -1
- data/lib/graphiti/version.rb +1 -1
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67b89c099870abde2d636eb3808e813b96610f82
|
4
|
+
data.tar.gz: f8324c6a127cb1fe844b3913ec08ebe8f84da57d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15474cfc1554159f641a0dff3eded7760cf9c4b0c56f869b2bab9f85006c2e24208206e056614991f0a047779e8ecd772e98d4182ecc4c808e41d1ef4b3e2e68
|
7
|
+
data.tar.gz: d26dcca3b5eca5158e74b6def93463420ba607552d31e48bfcc546e38dab92880abf13fe04abb6740128a4c918622e801cee5f0562262ece84815678ea36b5fb
|
data/graphiti.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_dependency 'dry-types', '~> 0.13'
|
23
23
|
spec.add_dependency 'graphiti_errors', '~> 1.0.alpha.2'
|
24
24
|
spec.add_dependency 'concurrent-ruby', '~> 1.0'
|
25
|
+
spec.add_dependency 'activesupport', ['>= 4.1', '< 6']
|
25
26
|
|
26
27
|
spec.add_development_dependency "activerecord", ['>= 4.1', '< 6']
|
27
28
|
spec.add_development_dependency "kaminari", '~> 0.17'
|
data/lib/graphiti.rb
CHANGED
@@ -126,6 +126,18 @@ module Graphiti
|
|
126
126
|
def self.resources
|
127
127
|
@resources ||= []
|
128
128
|
end
|
129
|
+
|
130
|
+
# When we add a sideload, we need to do configuration, such as
|
131
|
+
# adding the relationship to the Resource's serializer.
|
132
|
+
# However, the sideload's Resource class may not be loaded yet.
|
133
|
+
# This is not a problem with Rails autoloading, but is a problem
|
134
|
+
# outside Rails.
|
135
|
+
# In these cases, load every Resource class then call Graphiti.setup!
|
136
|
+
def self.setup!
|
137
|
+
resources.each do |r|
|
138
|
+
r.apply_sideloads_to_serializer
|
139
|
+
end
|
140
|
+
end
|
129
141
|
end
|
130
142
|
|
131
143
|
require "graphiti/runner"
|
data/lib/graphiti/sideload.rb
CHANGED
@@ -261,6 +261,16 @@ module Graphiti
|
|
261
261
|
!self.class.assign_each_proc
|
262
262
|
end
|
263
263
|
|
264
|
+
# @api private
|
265
|
+
def resource_class_loaded?
|
266
|
+
begin
|
267
|
+
resource_class
|
268
|
+
true
|
269
|
+
rescue Graphiti::Errors::ResourceNotFound
|
270
|
+
false
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
264
274
|
private
|
265
275
|
|
266
276
|
def apply_belongs_to_many_filter
|
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.alpha.
|
4
|
+
version: 1.0.alpha.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Richmond
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsonapi-serializable
|
@@ -66,6 +66,26 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activesupport
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.1'
|
76
|
+
- - "<"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '6'
|
79
|
+
type: :runtime
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '4.1'
|
86
|
+
- - "<"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '6'
|
69
89
|
- !ruby/object:Gem::Dependency
|
70
90
|
name: activerecord
|
71
91
|
requirement: !ruby/object:Gem::Requirement
|