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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2739a153d71dc4e1c98b527f4f0daddede47e76a
4
- data.tar.gz: 6cfdad699578ad75c3de819063069b187b7b0a5c
3
+ metadata.gz: b4ff13da582bf6e68e92f1b694d9fe17e4674e49
4
+ data.tar.gz: ff7d0c4a107bfaa7680edcc821572df7a3a38c1a
5
5
  SHA512:
6
- metadata.gz: e5c8039936b98b458c37004dc5c9ccdbc9d8de147baac4f43ea0bc657caf8fcca58661a1b9572b49632bb40ea64f297570b7f8004ce0d18155cf1701f1307d65
7
- data.tar.gz: fbcceabcb306a16f189c9ea82fc91d4960fbac7310ce8d3d04617582d97bc45345c8005abdab22c27303c87729f39b482069a44649c2a8ba9932099ab9f23e15
6
+ metadata.gz: 32f81168be3c5b9207c0a8d5143f2efbaff904aade2161dea0cbf4af9f19b723a43f725283dce5116ae3cd30a3a46ff678d55f7cedea0f134b29a7faacfa41e1
7
+ data.tar.gz: 9cb0bb2e85f0d98555ad5f2092a4800758e84377221e4ef47666f70c2966414f76376e8068dbb2871ea5c18d2ca89c21c5c50415ff311768ac0eeb57f35da486
@@ -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
- type, attr = s.split('.')
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
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module Graphiti
2
- VERSION = "1.0.beta.13"
2
+ VERSION = "1.0.beta.14"
3
3
  end
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.13
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-04 00:00:00.000000000 Z
11
+ date: 2018-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-serializable