query_string_interface 0.6.2 → 0.6.3

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: b64e1159126382c94d4807220de37a8955d91a67
4
- data.tar.gz: 4b31661e75bf0d529f20309bc9891dbb81ae56e9
3
+ metadata.gz: 495587c8e1031bc3d990a6805a15ae017557cebe
4
+ data.tar.gz: 527a145f1ef759b3cd749db88def744ed4a258b3
5
5
  SHA512:
6
- metadata.gz: 208fdf3418d15633d1edf83ba43ba7abf84ce24702436619979274417086c39fda1c8fdc08b7608e59db818f8fba05bc4d146ba6c16bb69eca3d787edb848a4c
7
- data.tar.gz: a11fecde00b9addab369cc7cb33f7df37095b6a884cbafaa0a485202284d3c01a52533f05b3063b47f4caa1bb1012638fad28bd7691739b8d8906900a74cee12
6
+ metadata.gz: 2fe4d51f6ac48b8b5a55b2bdc2d6dade987cb9e9d48e385c0871ec4be181463e834a42b4f47ce65ef95c2c99a64dd464748d94e8d1173c28ea576e9e938b2c33
7
+ data.tar.gz: 6624b1761fd0e101440c49c7477bc51a0c0c2deecc6680a81037f69ecd8b40e602684ff1dc8183ebbc899d804c5049adda524f9600406dc79cae3719aca68b98
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- query_string_interface (0.6.2)
4
+ query_string_interface (0.6.3)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,4 +1,7 @@
1
1
  module QueryStringInterface
2
2
  class DateTimeParseError < ArgumentError
3
3
  end
4
- end
4
+
5
+ class MixedArgumentError < ArgumentError
6
+ end
7
+ end
@@ -38,6 +38,10 @@ module QueryStringInterface
38
38
  raw_attribute == 'or'
39
39
  end
40
40
 
41
+ def or_value
42
+ @or_value ||= JSON.parse(raw_value) if or_attribute?
43
+ end
44
+
41
45
  def include?(other_filter)
42
46
  if or_attribute?
43
47
  json_value.any? do |filters|
@@ -63,8 +67,10 @@ module QueryStringInterface
63
67
  result[filter_operation] = filter_value
64
68
  result
65
69
  end
66
- else
70
+ elsif !operator.nil? && !other_filter.operator.nil?
67
71
  @value = value.merge(other_filter.value)
72
+ else
73
+ raise MixedArgumentError, "arguments `#{raw_attribute}` and `#{other_filter.raw_attribute}` could not be mixed"
68
74
  end
69
75
  end
70
76
 
@@ -53,7 +53,7 @@ module QueryStringInterface
53
53
  def optimized_filter_parsers
54
54
  if or_filter_parser
55
55
  if or_filter_parser.value.is_a?(Array) && or_filter_parser.value.count == 1
56
- or_inner_filters = or_filter_parser.value.first.with_indifferent_access.map do |raw_attribute, raw_value|
56
+ or_inner_filters = or_filter_parser.or_value.first.with_indifferent_access.map do |raw_attribute, raw_value|
57
57
  Filter.new(raw_attribute, raw_value, @attributes_to_replace, @raw_filters)
58
58
  end
59
59
  filter_parsers.delete(or_filter_parser)
@@ -1,3 +1,3 @@
1
1
  module QueryStringInterface
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: query_string_interface
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vicente Mundim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-06 00:00:00.000000000 Z
11
+ date: 2015-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport