graphiti 1.0.beta.10 → 1.0.beta.11

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: dbd128c5919c9f050e616b3a047e30f6f3ee4476
4
- data.tar.gz: dc018a848a9e19413596752f3e223a9a91f246ef
3
+ metadata.gz: 3817c5eb61324763c5381d8c08028a084582990d
4
+ data.tar.gz: 1159861050a883d131a3900b4b214ef0ed52eb27
5
5
  SHA512:
6
- metadata.gz: 71dd980185d8e7587f64560479fb10e2c231ca6cff0a948a3222442a7ac6c00f506ea033e522c019e47336f4577759eaa43465bd0b3146c832df321b83cc0836
7
- data.tar.gz: 978ecb768a70cfbc6623e9a821ab6e26ada74d2b512beb6501d628f531564f7c47a18fc59152cbd79e92aa372d318422754d18c299dceae0220923d104081ff5
6
+ metadata.gz: 3ff6ca0dd9db8aac5b84ca500264131a28845b8b01daa3789c6fd0574ff47d26412784173ba553fa3d5d506e2e7082999a4c61a0c99bd3130cecccbf00a0f392
7
+ data.tar.gz: a93ea8aff07090144b646fbdd173521fbaff553d894374a0e2a14cebb9cdd833a4a288223a7271559c37833ff3bc5df31734b94dcbfbd344d840b6e3a1354ed7
@@ -59,12 +59,11 @@ module Graphiti
59
59
  sideload = payload[:sideload]
60
60
  results = results(payload[:results])
61
61
  add_chunk(payload[:resource], payload[:parent]) do |logs, json|
62
- #logs << [" \\_ #{sideload.parent_resource_class} > \"#{sideload.name}\":", :yellow, true]
63
62
  logs << [" \\_ #{sideload.name}", :yellow, true]
64
63
  json[:name] = sideload.name
65
64
  query = "#{payload[:resource].class.name}.all(#{params.inspect})"
66
- unless params
67
- query = "#{payload[:resource].class.name}: Manual sideload via .scope"
65
+ unless payload[:resource]
66
+ query = "#{sideload.resource.class.name}: Manual sideload via .scope"
68
67
  end
69
68
  logs << [" #{query}", :cyan, true]
70
69
  json[:query] = query
@@ -149,6 +149,8 @@ module Graphiti
149
149
  value.each_pair do |k,v|
150
150
  hash[k.to_sym] = v.to_i
151
151
  end
152
+ elsif nested?(name)
153
+ hash.merge!(value)
152
154
  elsif top_level? && [:number, :size].include?(name.to_sym)
153
155
  hash[name.to_sym] = value.to_i
154
156
  end
@@ -53,26 +53,28 @@ class Graphiti::Util::ValidationResponse
53
53
  end
54
54
 
55
55
  def all_valid?(model, deserialized_params)
56
- valid = true
57
- return false unless valid_object?(model)
56
+ checks = []
57
+ checks << valid_object?(model)
58
58
  deserialized_params.each_pair do |name, payload|
59
59
  if payload.is_a?(Array)
60
60
  related_objects = model.send(name)
61
- related_objects.each do |r|
61
+ related_objects.each_with_index do |r, index|
62
62
  valid = valid_object?(r)
63
+ checks << valid
63
64
 
64
65
  if valid
65
- valid = all_valid?(r, deserialized_params[:relationships] || {})
66
+ checks << all_valid?(r, payload[index][:relationships] || {})
66
67
  end
67
68
  end
68
69
  else
69
70
  related_object = model.send(name)
70
71
  valid = valid_object?(related_object)
72
+ checks << valid
71
73
  if valid
72
- valid = all_valid?(related_object, deserialized_params[:relationships] || {})
74
+ checks << all_valid?(related_object, payload[:relationships] || {})
73
75
  end
74
76
  end
75
77
  end
76
- valid
78
+ checks.all? { |c| c == true }
77
79
  end
78
80
  end
@@ -1,3 +1,3 @@
1
1
  module Graphiti
2
- VERSION = "1.0.beta.10"
2
+ VERSION = "1.0.beta.11"
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.10
4
+ version: 1.0.beta.11
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-28 00:00:00.000000000 Z
11
+ date: 2018-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-serializable