kintone 0.1.1 → 0.1.2
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/.gitignore +1 -0
- data/.travis.yml +8 -0
- data/Guardfile +2 -2
- data/README.md +42 -8
- data/lib/kintone/api.rb +28 -71
- data/lib/kintone/api/guest.rb +28 -51
- data/lib/kintone/command/accessor.rb +99 -0
- data/lib/kintone/command/bulk_request.rb +12 -0
- data/lib/kintone/command/record.rb +4 -2
- data/lib/kintone/command/records.rb +2 -1
- data/lib/kintone/query.rb +2 -0
- data/lib/kintone/version.rb +1 -1
- data/spec/kintone/api/guest_spec.rb +12 -0
- data/spec/kintone/api_spec.rb +12 -0
- data/spec/kintone/command/bulk_request_spec.rb +71 -0
- data/spec/kintone/command/record_spec.rb +64 -39
- data/spec/kintone/command/records_spec.rb +138 -65
- data/spec/kintone/query_spec.rb +199 -10
- metadata +7 -3
data/spec/kintone/query_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe Kintone::Query do
|
|
5
5
|
describe '#to_s' do
|
6
6
|
subject { target.to_s }
|
7
7
|
|
8
|
-
context '==' do
|
8
|
+
context '==', 'with field' do
|
9
9
|
where(:target, :result) do
|
10
10
|
[
|
11
11
|
[Kintone::Query.new { field(:text) == '"Hello, world."' }, 'text = "Hello, world."'],
|
@@ -24,7 +24,26 @@ describe Kintone::Query do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
context '
|
27
|
+
context '==', 'with f' do
|
28
|
+
where(:target, :result) do
|
29
|
+
[
|
30
|
+
[Kintone::Query.new { f(:text) == '"Hello, world."' }, 'text = "Hello, world."'],
|
31
|
+
[Kintone::Query.new { f(:text) == 'Hello, world.' }, 'text = "Hello, world."'],
|
32
|
+
[Kintone::Query.new { f('作成日時') == now }, '作成日時 = NOW()'],
|
33
|
+
[Kintone::Query.new { f('作成日時') == today }, '作成日時 = TODAY()'],
|
34
|
+
[Kintone::Query.new { f('作成日時') == this_month }, '作成日時 = THIS_MONTH()'],
|
35
|
+
[Kintone::Query.new { f('作成日時') == last_month }, '作成日時 = LAST_MONTH()'],
|
36
|
+
[Kintone::Query.new { f('作成日時') == this_year }, '作成日時 = THIS_YEAR()'],
|
37
|
+
[Kintone::Query.new { f(:number) == 100 }, 'number = 100']
|
38
|
+
]
|
39
|
+
end
|
40
|
+
|
41
|
+
with_them do
|
42
|
+
it { expect(subject).to eq result }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context '!=', 'with field' do
|
28
47
|
where(:target, :result) do
|
29
48
|
[
|
30
49
|
[Kintone::Query.new { field(:text) != '"Hello, world."' }, 'text != "Hello, world."'],
|
@@ -43,7 +62,26 @@ describe Kintone::Query do
|
|
43
62
|
end
|
44
63
|
end
|
45
64
|
|
46
|
-
context '
|
65
|
+
context '!=', 'with f' do
|
66
|
+
where(:target, :result) do
|
67
|
+
[
|
68
|
+
[Kintone::Query.new { f(:text) != '"Hello, world."' }, 'text != "Hello, world."'],
|
69
|
+
[Kintone::Query.new { f(:text) != 'Hello, world.' }, 'text != "Hello, world."'],
|
70
|
+
[Kintone::Query.new { f('作成日時') != now }, '作成日時 != NOW()'],
|
71
|
+
[Kintone::Query.new { f('作成日時') != today }, '作成日時 != TODAY()'],
|
72
|
+
[Kintone::Query.new { f('作成日時') != this_month }, '作成日時 != THIS_MONTH()'],
|
73
|
+
[Kintone::Query.new { f('作成日時') != last_month }, '作成日時 != LAST_MONTH()'],
|
74
|
+
[Kintone::Query.new { f('作成日時') != this_year }, '作成日時 != THIS_YEAR()'],
|
75
|
+
[Kintone::Query.new { f(:number) != 100 }, 'number != 100']
|
76
|
+
]
|
77
|
+
end
|
78
|
+
|
79
|
+
with_them do
|
80
|
+
it { expect(subject).to eq result }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
context '>', 'with field' do
|
47
85
|
where(:target, :result) do
|
48
86
|
[
|
49
87
|
[Kintone::Query.new { field(:text) > '"Hello, world."' }, 'text > "Hello, world."'],
|
@@ -62,7 +100,26 @@ describe Kintone::Query do
|
|
62
100
|
end
|
63
101
|
end
|
64
102
|
|
65
|
-
context '
|
103
|
+
context '>', 'with f' do
|
104
|
+
where(:target, :result) do
|
105
|
+
[
|
106
|
+
[Kintone::Query.new { f(:text) > '"Hello, world."' }, 'text > "Hello, world."'],
|
107
|
+
[Kintone::Query.new { f(:text) > 'Hello, world.' }, 'text > "Hello, world."'],
|
108
|
+
[Kintone::Query.new { f('作成日時') > now }, '作成日時 > NOW()'],
|
109
|
+
[Kintone::Query.new { f('作成日時') > today }, '作成日時 > TODAY()'],
|
110
|
+
[Kintone::Query.new { f('作成日時') > this_month }, '作成日時 > THIS_MONTH()'],
|
111
|
+
[Kintone::Query.new { f('作成日時') > last_month }, '作成日時 > LAST_MONTH()'],
|
112
|
+
[Kintone::Query.new { f('作成日時') > this_year }, '作成日時 > THIS_YEAR()'],
|
113
|
+
[Kintone::Query.new { f(:number) > 100 }, 'number > 100']
|
114
|
+
]
|
115
|
+
end
|
116
|
+
|
117
|
+
with_them do
|
118
|
+
it { expect(subject).to eq result }
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
context '<', 'with field' do
|
66
123
|
where(:target, :result) do
|
67
124
|
[
|
68
125
|
[Kintone::Query.new { field(:text) < '"Hello, world."' }, 'text < "Hello, world."'],
|
@@ -81,7 +138,26 @@ describe Kintone::Query do
|
|
81
138
|
end
|
82
139
|
end
|
83
140
|
|
84
|
-
context '
|
141
|
+
context '<', 'with f' do
|
142
|
+
where(:target, :result) do
|
143
|
+
[
|
144
|
+
[Kintone::Query.new { f(:text) < '"Hello, world."' }, 'text < "Hello, world."'],
|
145
|
+
[Kintone::Query.new { f(:text) < 'Hello, world.' }, 'text < "Hello, world."'],
|
146
|
+
[Kintone::Query.new { f('作成日時') < now }, '作成日時 < NOW()'],
|
147
|
+
[Kintone::Query.new { f('作成日時') < today }, '作成日時 < TODAY()'],
|
148
|
+
[Kintone::Query.new { f('作成日時') < this_month }, '作成日時 < THIS_MONTH()'],
|
149
|
+
[Kintone::Query.new { f('作成日時') < last_month }, '作成日時 < LAST_MONTH()'],
|
150
|
+
[Kintone::Query.new { f('作成日時') < this_year }, '作成日時 < THIS_YEAR()'],
|
151
|
+
[Kintone::Query.new { f(:number) < 100 }, 'number < 100']
|
152
|
+
]
|
153
|
+
end
|
154
|
+
|
155
|
+
with_them do
|
156
|
+
it { expect(subject).to eq result }
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
context '>=', 'with field' do
|
85
161
|
where(:target, :result) do
|
86
162
|
[
|
87
163
|
[Kintone::Query.new { field(:text) >= '"Hello, world."' }, 'text >= "Hello, world."'],
|
@@ -100,7 +176,26 @@ describe Kintone::Query do
|
|
100
176
|
end
|
101
177
|
end
|
102
178
|
|
103
|
-
context '
|
179
|
+
context '>=', 'with f' do
|
180
|
+
where(:target, :result) do
|
181
|
+
[
|
182
|
+
[Kintone::Query.new { f(:text) >= '"Hello, world."' }, 'text >= "Hello, world."'],
|
183
|
+
[Kintone::Query.new { f(:text) >= 'Hello, world.' }, 'text >= "Hello, world."'],
|
184
|
+
[Kintone::Query.new { f('作成日時') >= now }, '作成日時 >= NOW()'],
|
185
|
+
[Kintone::Query.new { f('作成日時') >= today }, '作成日時 >= TODAY()'],
|
186
|
+
[Kintone::Query.new { f('作成日時') >= this_month }, '作成日時 >= THIS_MONTH()'],
|
187
|
+
[Kintone::Query.new { f('作成日時') >= last_month }, '作成日時 >= LAST_MONTH()'],
|
188
|
+
[Kintone::Query.new { f('作成日時') >= this_year }, '作成日時 >= THIS_YEAR()'],
|
189
|
+
[Kintone::Query.new { f(:number) >= 100 }, 'number >= 100']
|
190
|
+
]
|
191
|
+
end
|
192
|
+
|
193
|
+
with_them do
|
194
|
+
it { expect(subject).to eq result }
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
context '<=', 'with field' do
|
104
199
|
where(:target, :result) do
|
105
200
|
[
|
106
201
|
[Kintone::Query.new { field(:text) <= '"Hello, world."' }, 'text <= "Hello, world."'],
|
@@ -119,7 +214,26 @@ describe Kintone::Query do
|
|
119
214
|
end
|
120
215
|
end
|
121
216
|
|
122
|
-
context '
|
217
|
+
context '<=', 'with f' do
|
218
|
+
where(:target, :result) do
|
219
|
+
[
|
220
|
+
[Kintone::Query.new { f(:text) <= '"Hello, world."' }, 'text <= "Hello, world."'],
|
221
|
+
[Kintone::Query.new { f(:text) <= 'Hello, world.' }, 'text <= "Hello, world."'],
|
222
|
+
[Kintone::Query.new { f('作成日時') <= now }, '作成日時 <= NOW()'],
|
223
|
+
[Kintone::Query.new { f('作成日時') <= today }, '作成日時 <= TODAY()'],
|
224
|
+
[Kintone::Query.new { f('作成日時') <= this_month }, '作成日時 <= THIS_MONTH()'],
|
225
|
+
[Kintone::Query.new { f('作成日時') <= last_month }, '作成日時 <= LAST_MONTH()'],
|
226
|
+
[Kintone::Query.new { f('作成日時') <= this_year }, '作成日時 <= THIS_YEAR()'],
|
227
|
+
[Kintone::Query.new { f(:number) <= 100 }, 'number <= 100']
|
228
|
+
]
|
229
|
+
end
|
230
|
+
|
231
|
+
with_them do
|
232
|
+
it { expect(subject).to eq result }
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
context 'in', 'with field' do
|
123
237
|
where(:target, :result) do
|
124
238
|
[
|
125
239
|
[Kintone::Query.new { field(:dropdown).in(['"A"', '"B"']) }, 'dropdown in ("A", "B")'],
|
@@ -135,7 +249,23 @@ describe Kintone::Query do
|
|
135
249
|
end
|
136
250
|
end
|
137
251
|
|
138
|
-
context '
|
252
|
+
context 'in', 'with f' do
|
253
|
+
where(:target, :result) do
|
254
|
+
[
|
255
|
+
[Kintone::Query.new { f(:dropdown).in(['"A"', '"B"']) }, 'dropdown in ("A", "B")'],
|
256
|
+
[Kintone::Query.new { f(:dropdown).in(%w(A B)) }, 'dropdown in ("A", "B")'],
|
257
|
+
[Kintone::Query.new { f(:dropdown).in([:A, :B]) }, 'dropdown in ("A", "B")'],
|
258
|
+
[Kintone::Query.new { f(:dropdown).in([100, 200]) }, 'dropdown in (100, 200)'],
|
259
|
+
[Kintone::Query.new { f('作成者').in([login_user]) }, '作成者 in (LOGINUSER())']
|
260
|
+
]
|
261
|
+
end
|
262
|
+
|
263
|
+
with_them do
|
264
|
+
it { expect(subject).to eq result }
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
context 'not in', 'with field' do
|
139
269
|
where(:target, :result) do
|
140
270
|
[
|
141
271
|
[
|
@@ -166,7 +296,38 @@ describe Kintone::Query do
|
|
166
296
|
end
|
167
297
|
end
|
168
298
|
|
169
|
-
context '
|
299
|
+
context 'not in', 'with field' do
|
300
|
+
where(:target, :result) do
|
301
|
+
[
|
302
|
+
[
|
303
|
+
Kintone::Query.new { f(:dropdown).not_in(['"A"', '"B"']) },
|
304
|
+
'dropdown not in ("A", "B")'
|
305
|
+
],
|
306
|
+
[
|
307
|
+
Kintone::Query.new { f(:dropdown).not_in(%w(A B)) },
|
308
|
+
'dropdown not in ("A", "B")'
|
309
|
+
],
|
310
|
+
[
|
311
|
+
Kintone::Query.new { f(:dropdown).not_in([:A, :B]) },
|
312
|
+
'dropdown not in ("A", "B")'
|
313
|
+
],
|
314
|
+
[
|
315
|
+
Kintone::Query.new { f(:dropdown).not_in([100, 200]) },
|
316
|
+
'dropdown not in (100, 200)'
|
317
|
+
],
|
318
|
+
[
|
319
|
+
Kintone::Query.new { f('作成者').not_in([login_user]) },
|
320
|
+
'作成者 not in (LOGINUSER())'
|
321
|
+
]
|
322
|
+
]
|
323
|
+
end
|
324
|
+
|
325
|
+
with_them do
|
326
|
+
it { expect(subject).to eq result }
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
context 'like', 'with field' do
|
170
331
|
where(:target, :result) do
|
171
332
|
[
|
172
333
|
[Kintone::Query.new { field(:text).like('Hello') }, 'text like "Hello"'],
|
@@ -180,7 +341,21 @@ describe Kintone::Query do
|
|
180
341
|
end
|
181
342
|
end
|
182
343
|
|
183
|
-
context '
|
344
|
+
context 'like', 'with f' do
|
345
|
+
where(:target, :result) do
|
346
|
+
[
|
347
|
+
[Kintone::Query.new { f(:text).like('Hello') }, 'text like "Hello"'],
|
348
|
+
[Kintone::Query.new { f(:text).like('"Hello"') }, 'text like "Hello"'],
|
349
|
+
[Kintone::Query.new { f(:text).like(:Hello) }, 'text like "Hello"']
|
350
|
+
]
|
351
|
+
end
|
352
|
+
|
353
|
+
with_them do
|
354
|
+
it { expect(subject).to eq result }
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
context 'not like', 'with field' do
|
184
359
|
where(:target, :result) do
|
185
360
|
[
|
186
361
|
[Kintone::Query.new { field(:text).not_like('Hello') }, 'text not like "Hello"'],
|
@@ -194,6 +369,20 @@ describe Kintone::Query do
|
|
194
369
|
end
|
195
370
|
end
|
196
371
|
|
372
|
+
context 'not like', 'with f' do
|
373
|
+
where(:target, :result) do
|
374
|
+
[
|
375
|
+
[Kintone::Query.new { f(:text).not_like('Hello') }, 'text not like "Hello"'],
|
376
|
+
[Kintone::Query.new { f(:text).not_like('"Hello"') }, 'text not like "Hello"'],
|
377
|
+
[Kintone::Query.new { f(:text).not_like(:Hello) }, 'text not like "Hello"']
|
378
|
+
]
|
379
|
+
end
|
380
|
+
|
381
|
+
with_them do
|
382
|
+
it { expect(subject).to eq result }
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
197
386
|
context 'and!' do
|
198
387
|
let(:target) do
|
199
388
|
Kintone::Query.new do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kintone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rikiya Kawakami
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -171,10 +171,12 @@ files:
|
|
171
171
|
- lib/kintone/api.rb
|
172
172
|
- lib/kintone/api/guest.rb
|
173
173
|
- lib/kintone/command.rb
|
174
|
+
- lib/kintone/command/accessor.rb
|
174
175
|
- lib/kintone/command/apis.rb
|
175
176
|
- lib/kintone/command/app.rb
|
176
177
|
- lib/kintone/command/app_acl.rb
|
177
178
|
- lib/kintone/command/apps.rb
|
179
|
+
- lib/kintone/command/bulk_request.rb
|
178
180
|
- lib/kintone/command/field_acl.rb
|
179
181
|
- lib/kintone/command/form.rb
|
180
182
|
- lib/kintone/command/guests.rb
|
@@ -201,6 +203,7 @@ files:
|
|
201
203
|
- spec/kintone/command/app_acl_spec.rb
|
202
204
|
- spec/kintone/command/app_spec.rb
|
203
205
|
- spec/kintone/command/apps_spec.rb
|
206
|
+
- spec/kintone/command/bulk_request_spec.rb
|
204
207
|
- spec/kintone/command/field_acl_spec.rb
|
205
208
|
- spec/kintone/command/form_spec.rb
|
206
209
|
- spec/kintone/command/guests_spec.rb
|
@@ -236,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
236
239
|
version: '0'
|
237
240
|
requirements: []
|
238
241
|
rubyforge_project:
|
239
|
-
rubygems_version: 2.
|
242
|
+
rubygems_version: 2.4.5
|
240
243
|
signing_key:
|
241
244
|
specification_version: 4
|
242
245
|
summary: kintone API client for Ruby.
|
@@ -247,6 +250,7 @@ test_files:
|
|
247
250
|
- spec/kintone/command/app_acl_spec.rb
|
248
251
|
- spec/kintone/command/app_spec.rb
|
249
252
|
- spec/kintone/command/apps_spec.rb
|
253
|
+
- spec/kintone/command/bulk_request_spec.rb
|
250
254
|
- spec/kintone/command/field_acl_spec.rb
|
251
255
|
- spec/kintone/command/form_spec.rb
|
252
256
|
- spec/kintone/command/guests_spec.rb
|