graphiti 1.0.beta.13 → 1.0.beta.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphiti/query.rb +10 -1
- data/lib/graphiti/schema.rb +3 -2
- data/lib/graphiti/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4ff13da582bf6e68e92f1b694d9fe17e4674e49
|
4
|
+
data.tar.gz: ff7d0c4a107bfaa7680edcc821572df7a3a38c1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32f81168be3c5b9207c0a8d5143f2efbaff904aade2161dea0cbf4af9f19b723a43f725283dce5116ae3cd30a3a46ff678d55f7cedea0f134b29a7faacfa41e1
|
7
|
+
data.tar.gz: 9cb0bb2e85f0d98555ad5f2092a4800758e84377221e4ef47666f70c2966414f76376e8068dbb2871ea5c18d2ca89c21c5c50415ff311768ac0eeb57f35da486
|
data/lib/graphiti/query.rb
CHANGED
@@ -135,6 +135,8 @@ module Graphiti
|
|
135
135
|
arr << { key => value }
|
136
136
|
elsif !type && top_level? && validate!(key, :sortable)
|
137
137
|
arr << { key => value }
|
138
|
+
elsif nested?("#{type}.#{key}")
|
139
|
+
arr << { key => value }
|
138
140
|
end
|
139
141
|
end
|
140
142
|
end
|
@@ -215,6 +217,7 @@ module Graphiti
|
|
215
217
|
|
216
218
|
def nested?(name)
|
217
219
|
return false unless association?
|
220
|
+
|
218
221
|
split = name.to_s.split('.')
|
219
222
|
query_names = split[0..split.length-2].map(&:to_sym)
|
220
223
|
my_names = parents.map(&:association_name).compact + [association_name].compact
|
@@ -257,7 +260,13 @@ module Graphiti
|
|
257
260
|
def sort_hashes
|
258
261
|
sorts = @params[:sort].split(',')
|
259
262
|
sorts.each do |s|
|
260
|
-
|
263
|
+
attr = nil
|
264
|
+
type = s
|
265
|
+
if s.include?('.')
|
266
|
+
split = s.split('.')
|
267
|
+
attr = split.pop
|
268
|
+
type = split.join('.')
|
269
|
+
end
|
261
270
|
|
262
271
|
if attr.nil? # top-level
|
263
272
|
next if @association_name
|
data/lib/graphiti/schema.rb
CHANGED
@@ -21,14 +21,15 @@ module Graphiti
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def initialize(resources)
|
24
|
-
@resources = resources
|
24
|
+
@resources = resources.sort_by(&:name)
|
25
25
|
end
|
26
26
|
|
27
27
|
def generate
|
28
28
|
{
|
29
29
|
resources: generate_resources,
|
30
30
|
endpoints: generate_endpoints,
|
31
|
-
types: generate_types
|
31
|
+
types: generate_types,
|
32
|
+
base_url: resources.map(&:base_url)[0]
|
32
33
|
}
|
33
34
|
end
|
34
35
|
|
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.beta.
|
4
|
+
version: 1.0.beta.14
|
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-10-
|
11
|
+
date: 2018-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsonapi-serializable
|