fetcheable_on_api 0.2.7 → 0.2.8
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 +4 -4
- data/lib/fetcheable_on_api/filterable.rb +13 -1
- data/lib/fetcheable_on_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1923808982223818b6cbc0b02c0554c0f407dfe76a905966dae854132ca1a58f
|
4
|
+
data.tar.gz: eb139030c20e03404258c6ff448904b12c75b0057d56a230b96c3a584416745c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40992e933bb5a7b4915abc4b7508b7dceae4eeabc58b351544a3493247cbe1deb7b72c66efe532366e314766ae837222655b781a27b04674ced4b9fa990b0bca
|
7
|
+
data.tar.gz: 77d99b96773894349afb1da8e873f45a7ad0f3a24a009e9f77e3d4d5cd1d7da8844daf2eb8105ea49f2cca4468f9ee6f48d8efc60c3a8488f22663ab98086d06
|
@@ -81,6 +81,12 @@ module FetcheableOnApi
|
|
81
81
|
keys.each_with_index do |key, index|
|
82
82
|
predicate = filters_configuration[key.to_sym].fetch(:with, :ilike)
|
83
83
|
|
84
|
+
if(%i[between not_between].include?(predicate))
|
85
|
+
format = filters_configuration[key.to_sym].fetch(:format) { nil }
|
86
|
+
keys[index] = {key => []} if format == :array
|
87
|
+
next
|
88
|
+
end
|
89
|
+
|
84
90
|
next if predicate.respond_to?(:call) ||
|
85
91
|
PREDICATES_WITH_ARRAY.exclude?(predicate.to_sym)
|
86
92
|
|
@@ -106,7 +112,13 @@ module FetcheableOnApi
|
|
106
112
|
predicate = filters_configuration[column.to_sym].fetch(:with, :ilike)
|
107
113
|
|
108
114
|
if %i[between not_between].include?(predicate)
|
109
|
-
|
115
|
+
if values.is_a?(String)
|
116
|
+
predicates(predicate, collection, klass, column_name, values.split(","))
|
117
|
+
else
|
118
|
+
values.map do |value|
|
119
|
+
predicates(predicate, collection, klass, column_name, value.split(","))
|
120
|
+
end.inject(:or)
|
121
|
+
end
|
110
122
|
elsif values.is_a?(String)
|
111
123
|
values.split(",").map do |value|
|
112
124
|
predicates(predicate, collection, klass, column_name, value)
|