baseapi 0.1.10 → 0.1.11
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 +24 -0
- data/lib/baseapi/active_record/base_extension.rb +10 -1
- data/lib/baseapi/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 936fbd26520a71667904014ba7483ad45e8147bf
|
4
|
+
data.tar.gz: 715371435bdfdc327b13eeecd1fd6749c15318fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f369bec23293e8f0714047795914389a42e70179d51030f6e19d6c24a8f6467cf165da8c618a228ef002919ca783a7c9ca65a2fa316e5c6c3610f40511823b46
|
7
|
+
data.tar.gz: 602e8694c2d6a6a2cc0bff313e5d643dffe87bc79b6c662381900fb31a413a50e049fcd1371e25635f7100d127317f99253d1fbc7a561e843d65f9f96e88b529
|
data/README.md
CHANGED
@@ -157,6 +157,30 @@ Specify the User belong to a development part company
|
|
157
157
|
|
158
158
|
GET /users.json?company[units][name]=development
|
159
159
|
|
160
|
+
Specify it more 20~ (v0.1.11~)
|
161
|
+
|
162
|
+
GET /users.json?age=>=20
|
163
|
+
|
164
|
+
Specify it less ~20 (v0.1.11~)
|
165
|
+
|
166
|
+
GET /users.json?age=<=20
|
167
|
+
|
168
|
+
Specify between 2015/09/01 ~ 2015/09/31 (v0.1.11~)
|
169
|
+
|
170
|
+
GET /users.json?created_at[]=>=20150901&created_at[]=<=20150931
|
171
|
+
|
172
|
+
Multiple conditions is "OR Search" by default
|
173
|
+
|
174
|
+
Multiple conditions is "AND Search" and must
|
175
|
+
|
176
|
+
provide a method such as the following to the model in advance
|
177
|
+
|
178
|
+
class User < ActiveRecord::Base
|
179
|
+
def self._where_created_at(models, column, values)
|
180
|
+
column_match(models, column, values, operator:'and')
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
160
184
|
#### action show
|
161
185
|
|
162
186
|
Get id 1
|
@@ -119,7 +119,14 @@ module ActiveRecordBaseExtension extend ActiveSupport::Concern
|
|
119
119
|
# @param String value
|
120
120
|
# @return String operator
|
121
121
|
def getOperator(value, default = '=')
|
122
|
-
|
122
|
+
operator = default
|
123
|
+
value = value.sub('!', '')
|
124
|
+
if ['NULL', 'EMPTY'].include?(value.upcase)
|
125
|
+
operator = 'IS'
|
126
|
+
elsif value.length >= 2 and ['<=', '>='].include?(value[0..1])
|
127
|
+
operator = value[0..1]
|
128
|
+
end
|
129
|
+
operator
|
123
130
|
end
|
124
131
|
|
125
132
|
# slice '!' value
|
@@ -136,6 +143,8 @@ module ActiveRecordBaseExtension extend ActiveSupport::Concern
|
|
136
143
|
prefix = getPrefix(original)
|
137
144
|
operator = prefix == 'NOT' ? 'AND' : 'OR'
|
138
145
|
value = "NULL #{operator} #{prefix} #{column} = ''"
|
146
|
+
elsif value.length >= 2 and ['<=', '>='].include?(value[0..1])
|
147
|
+
value = value.sub('<=', '').sub('>=', '')
|
139
148
|
else
|
140
149
|
value = getNaturalValue(value)
|
141
150
|
wraps.each do |wrap|
|
data/lib/baseapi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: baseapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moriyuki Arakawa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|