jsonapi_compliable 0.11.23 → 0.11.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48d259ac76e47a2e25542f5131358558e150d4a9
4
- data.tar.gz: a23b4c69617f2751d8a6715cd94864564683ea27
3
+ metadata.gz: 9dbdcd8a1a1ed4b1c962ef23eef55b938fdbfe8d
4
+ data.tar.gz: f888b15956a57405e91abee53596f9b094c17ee5
5
5
  SHA512:
6
- metadata.gz: 5a6776c91e370adabf118580498abeaaae607c0dd7ad07c4205fa895da978d2ffac0b85a154cb3e58f0f5d72316c3d27ef1042e8c96754494f67d229e527f3eb
7
- data.tar.gz: 373820d5666c3afec279519198b3e58fdffdfe3d87363e6172339cdf57d1cb2041c29acb7389ab1b148f3785f3b381e9f7975f18bc21658b1381d80a62e3de1a
6
+ metadata.gz: ba51405f7f5a15cc36e5846de9ece7ed255450b628290bde7d853be4f176a48bc0f0a21188c333ca6e4a217d69da83860e3d62ec3fdb34514dc68f5a3f0ae54f
7
+ data.tar.gz: d1cbe36fb42231efdf58657781917312ca66d7a02598546f1fdcec2f090dd0bc2b40ccb5e489b237860a5e310175b7dc9ba4e3f0e4455217bb4f139960bf638f
@@ -52,12 +52,31 @@ module JsonapiCompliable
52
52
  filter_param.each_pair do |param_name, param_value|
53
53
  filter = find_filter!(param_name.to_sym)
54
54
  value = param_value
55
- value = value.split(',') if value.is_a?(String) && value.include?(',')
55
+ value = parse_string_arrays(value)
56
56
  value = normalize_string_values(value)
57
57
  yield filter, value
58
58
  end
59
59
  end
60
60
 
61
+ # foo,bar,baz becomes ["foo", "bar", "baz"]
62
+ # {{foo,bar}},baz becomes ["foo,bar", "baz"]
63
+ def parse_string_arrays(value)
64
+ if value.is_a?(String) && value.include?(',')
65
+ # Fine the quoted strings
66
+ quotes = value.scan(/{{.*?}}/)
67
+ # remove them from the rest
68
+ quotes.each { |q| value.gsub!(q, '') }
69
+ # remove the quote characters from the quoted strings
70
+ quotes.each { |q| q.gsub!('{{', '').gsub!('}}', '') }
71
+ # merge everything back together into an array
72
+ value = value.split(',') + quotes
73
+ # remove any blanks that are left
74
+ value.reject! { |v| v.length.zero? }
75
+ value = value[0] if value.length == 1
76
+ end
77
+ value
78
+ end
79
+
61
80
  # Convert a string of "true" to true, etc
62
81
  #
63
82
  # NB - avoid Array(value) here since we might want to
@@ -1,3 +1,3 @@
1
1
  module JsonapiCompliable
2
- VERSION = "0.11.23"
2
+ VERSION = "0.11.24"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi_compliable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.23
4
+ version: 0.11.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-06-14 00:00:00.000000000 Z
12
+ date: 2018-06-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jsonapi-serializable