graphiti 1.2.9 → 1.2.10

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
  SHA256:
3
- metadata.gz: eb47455dd399241e2671b63e9087220c7319767a62df3a5ba4742a3f74a26725
4
- data.tar.gz: 23900f4fd2949c8b3d3faa848dfa64c36690749906e4c8c8f99945cf48f72aa8
3
+ metadata.gz: baac052d897009c65c320247e4ff008050b898d700ccab49e08e0e9276fc75ce
4
+ data.tar.gz: 5d9687d68e3bed0a700f2b534dceedc5989e01b2b9863e4173f5f9bdf277f424
5
5
  SHA512:
6
- metadata.gz: 91883afe7f0a0cf03c7daf35098d5298673f69f52b69c0aa45c79cc24e20594890c8077a28e4448403616db2693f44893f346377cc31faa2e8644a99cc9dcc18
7
- data.tar.gz: f5a371c0b6413c30a9c33080bec055d06eb5464a4b971557059b8db5e69b2c86c2c2a51d580cfe134a85eca483ce8fea61fcb4d924457b2cd2dd35388597f39e
6
+ metadata.gz: 004d5f12a5dc29edeae1f6a332644580efd30530144d9a850a83cf904b43be16ff30a699bb24fa81e7e6eabca952972ca4cbcce1c3a46d6c1ad5d95d5cc58ddd
7
+ data.tar.gz: 5927f6e81eb5ec26964549ace950d4667390cd78649c1aebbc10d97810de80e33af83e7dad541e552f09a61419b1682eba2091f4264ad6cc8d92da5f60cf81fb
@@ -22,6 +22,7 @@ module Graphiti
22
22
  end
23
23
 
24
24
  def type=(val)
25
+ val = val && val.to_sym
25
26
  if (val = super)
26
27
  serializer.type(val)
27
28
  end
@@ -93,7 +93,7 @@ module Graphiti
93
93
 
94
94
  run_callbacks :persistence, :update, update_params, meta do
95
95
  run_callbacks :attributes, :update, update_params, meta do |params|
96
- model_instance = self.class._find(params.merge(id: id)).data
96
+ model_instance = self.class._find(id: id).data
97
97
  call_with_meta(:assign_attributes, model_instance, params, meta)
98
98
  model_instance
99
99
  end
@@ -79,12 +79,18 @@ module Graphiti
79
79
  end
80
80
 
81
81
  def normalize_param(filter, param_value)
82
- unless param_value.is_a?(Hash) && param_value.present?
83
- param_value = {eq: param_value}
82
+ type = Types[filter.values[0][:type]][:canonical_name]
83
+ if param_value.is_a?(Hash) && type == :hash
84
+ operators_keys = filter.values[0][:operators].keys
85
+ unless param_value.keys.all? {|k| operators_keys.include?(k)}
86
+ param_value = { eq: param_value }
87
+ end
88
+ elsif !param_value.is_a?(Hash) || param_value.empty?
89
+ param_value = { eq: param_value }
84
90
  end
85
91
 
86
92
  param_value.map do |operator, value|
87
- if Types[filter.values[0][:type]][:canonical_name] == :hash
93
+ if type == :hash
88
94
  value, operator = \
89
95
  parse_hash_value(filter, param_value, value, operator)
90
96
  end
@@ -136,7 +142,7 @@ module Graphiti
136
142
  end
137
143
 
138
144
  if value.is_a?(String)
139
- value = value.gsub("{{{", "{").gsub("}}}", "}")
145
+ value = value.gsub("{{{", "{").gsub("}}}", "}") unless filter.values[0][:single]
140
146
 
141
147
  if value.include?("},{") && !filter.values[0][:single]
142
148
  value = Util::Hash.split_json(value)
@@ -1,3 +1,3 @@
1
1
  module Graphiti
2
- VERSION = "1.2.9"
2
+ VERSION = "1.2.10"
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.2.9
4
+ version: 1.2.10
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-10-30 00:00:00.000000000 Z
11
+ date: 2019-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-serializable