baseapi 0.1.13 → 0.1.14
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/README.md +8 -0
- data/lib/baseapi/active_record/base_extension.rb +6 -2
- data/lib/baseapi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1ac2404b4884ee42c68800050820c341feafe49
|
4
|
+
data.tar.gz: b8930c62ce6d395b5ac38bdd9548494cce2f4fc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a852691317a1f3ce4f9aad6a18b99d4de5197ce168d39dd0546a9ce2e60b1da354db4f583a0c5b5c7380aaa84934bba5f7161dc443db81b34b0b1f41287a82b
|
7
|
+
data.tar.gz: e739f489132ae7893998034657b0b902e2f30a84bc80849d2ea1a73fba141c69d09b90d28e2cabd02ff89a2724abf1588af4f1bcd60f92c43ea657bf25cbc2cc
|
data/README.md
CHANGED
@@ -161,10 +161,18 @@ Specify it more 20~ (v0.1.12~)
|
|
161
161
|
|
162
162
|
GET /users.json?age=>=20
|
163
163
|
|
164
|
+
Specify the excess (v0.1.14~)
|
165
|
+
|
166
|
+
GET /users.json?age=>20
|
167
|
+
|
164
168
|
Specify it less ~20 (v0.1.12~)
|
165
169
|
|
166
170
|
GET /users.json?age=<=20
|
167
171
|
|
172
|
+
Specify the less than (v0.1.14~)
|
173
|
+
|
174
|
+
GET /users.json?age=<20
|
175
|
+
|
168
176
|
Specify between 2015/09/01 ~ 2015/09/31 (v0.1.12~)
|
169
177
|
|
170
178
|
GET /users.json?created_at[]=>=20150901&created_at[]=<=20150931
|
@@ -128,11 +128,13 @@ module ActiveRecordBaseExtension extend ActiveSupport::Concern
|
|
128
128
|
# @return String operator
|
129
129
|
def getOperator(value, default = '=')
|
130
130
|
operator = default
|
131
|
-
value
|
131
|
+
value.slice!(0) if value[0] == '!'
|
132
132
|
if ['NULL', 'EMPTY'].include?(value.upcase)
|
133
133
|
operator = 'IS'
|
134
134
|
elsif value.length >= 2 and ['<=', '>='].include?(value[0..1])
|
135
135
|
operator = value[0..1]
|
136
|
+
elsif ['<', '>'].include?(value[0])
|
137
|
+
operator = value[0]
|
136
138
|
end
|
137
139
|
operator
|
138
140
|
end
|
@@ -152,7 +154,9 @@ module ActiveRecordBaseExtension extend ActiveSupport::Concern
|
|
152
154
|
operator = prefix == 'NOT' ? 'AND' : 'OR'
|
153
155
|
value = "NULL #{operator} #{prefix} #{column} = ''"
|
154
156
|
elsif value.length >= 2 and ['<=', '>='].include?(value[0..1])
|
155
|
-
value = value.sub(
|
157
|
+
value = value.sub(value[0..1], '')
|
158
|
+
elsif ['<', '>'].include?(value[0])
|
159
|
+
value = value.sub(value[0], '')
|
156
160
|
else
|
157
161
|
value = getNaturalValue(value)
|
158
162
|
wraps.each do |wrap|
|
data/lib/baseapi/version.rb
CHANGED