redbooth-ruby 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +0 -1
- data/README.md +187 -115
- data/lib/redbooth-ruby/client.rb +6 -39
- data/lib/redbooth-ruby/client_operations/perform.rb +93 -0
- data/lib/redbooth-ruby/file.rb +8 -0
- data/lib/redbooth-ruby/helpers.rb +32 -0
- data/lib/redbooth-ruby/operations/base.rb +3 -2
- data/lib/redbooth-ruby/request/collection.rb +3 -2
- data/lib/redbooth-ruby/request/connection.rb +66 -30
- data/lib/redbooth-ruby/request/helpers.rb +2 -2
- data/lib/redbooth-ruby/request/info.rb +1 -1
- data/lib/redbooth-ruby/request/validator.rb +2 -2
- data/lib/redbooth-ruby/session.rb +34 -11
- data/lib/redbooth-ruby/task_list.rb +28 -0
- data/lib/redbooth-ruby/version.rb +2 -2
- data/lib/redbooth-ruby.rb +6 -3
- data/spec/cassettes/RedboothRuby_File/_download/downloads_a_file.yml +354 -0
- data/spec/cassettes/RedboothRuby_Organization/_delete/makes_a_new_DELETE_request_using_the_correct_API_endpoint_to_delete_a_specific_organization.yml +4 -4
- data/spec/cassettes/RedboothRuby_Project/_delete/makes_a_new_DELETE_request_using_the_correct_API_endpoint_to_delete_a_specific_project.yml +110 -110
- data/spec/cassettes/RedboothRuby_Session/_refresh_access_token_/.yml +55 -0
- data/spec/cassettes/RedboothRuby_Session/_refresh_access_token_/call_on_token_refresh_with_the_old_and_new_token.yml +55 -0
- data/spec/cassettes/RedboothRuby_Session/_refresh_access_token_/refreshes_the_access_token.yml +55 -0
- data/spec/redbooth-ruby/base_spec.rb +5 -5
- data/spec/redbooth-ruby/client_operations/metadata_spec.rb +4 -4
- data/spec/redbooth-ruby/client_operations/perform_spec.rb +135 -0
- data/spec/redbooth-ruby/client_operations/search_spec.rb +4 -4
- data/spec/redbooth-ruby/client_spec.rb +2 -43
- data/spec/redbooth-ruby/comment_spec.rb +17 -18
- data/spec/redbooth-ruby/conversation_spec.rb +16 -16
- data/spec/redbooth-ruby/file_spec.rb +29 -22
- data/spec/redbooth-ruby/me_spec.rb +2 -2
- data/spec/redbooth-ruby/membership_spec.rb +18 -18
- data/spec/redbooth-ruby/note_spec.rb +16 -16
- data/spec/redbooth-ruby/organization_spec.rb +16 -16
- data/spec/redbooth-ruby/person_spec.rb +18 -18
- data/spec/redbooth-ruby/project_spec.rb +18 -18
- data/spec/redbooth-ruby/request/base_spec.rb +5 -5
- data/spec/redbooth-ruby/request/collection_spec.rb +3 -3
- data/spec/redbooth-ruby/request/connection_spec.rb +8 -8
- data/spec/redbooth-ruby/request/info_spec.rb +13 -13
- data/spec/redbooth-ruby/request/response_spec.rb +4 -4
- data/spec/redbooth-ruby/request/validator_spec.rb +7 -7
- data/spec/redbooth-ruby/session_spec.rb +100 -0
- data/spec/redbooth-ruby/subtaks_spec.rb +16 -16
- data/spec/redbooth-ruby/task_spec.rb +22 -22
- data/spec/redbooth-ruby/user_spec.rb +4 -4
- data/spec/redbooth_spec.rb +13 -13
- data/spec/spec_helper.rb +2 -3
- data/temp/spec/files/test_download.txt +8 -0
- metadata +41 -24
data/README.md
CHANGED
@@ -16,23 +16,23 @@ Usage
|
|
16
16
|
First, you've to install the gem
|
17
17
|
|
18
18
|
```Ruby
|
19
|
-
|
19
|
+
gem install redbooth-ruby
|
20
20
|
```
|
21
21
|
|
22
22
|
and require it
|
23
23
|
|
24
24
|
```Ruby
|
25
|
-
|
25
|
+
require 'redbooth-ruby'
|
26
26
|
```
|
27
27
|
|
28
28
|
and set up your app credentials
|
29
29
|
|
30
30
|
|
31
31
|
```Ruby
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
RedboothRuby.config do |configuration|
|
33
|
+
configuration[:consumer_key] = '_your_consumer_key_'
|
34
|
+
configuration[:consumer_secret] = '_your_consumer_secret_'
|
35
|
+
end
|
36
36
|
```
|
37
37
|
|
38
38
|
in fact this last step is optional (yes! we support multiple applications) but if as most fo the humans you use only one redbooth app, this is the easyest way to go.
|
@@ -41,7 +41,7 @@ in fact this last step is optional (yes! we support multiple applications) but i
|
|
41
41
|
Oauth
|
42
42
|
=====
|
43
43
|
|
44
|
-
*[Redbooth oauth2 API documentation](https://
|
44
|
+
*[Redbooth oauth2 API documentation](https://redbooth.com/api/authentication/)*
|
45
45
|
|
46
46
|
using omniauth? :+1: good choice, just try this gem
|
47
47
|
|
@@ -58,29 +58,59 @@ Client
|
|
58
58
|
Everything starts with the client, once you have the user credentials you should create a session and a client to start interaction with the API
|
59
59
|
|
60
60
|
```Ruby
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
61
|
+
session = RedboothRuby::Session.new(
|
62
|
+
token: '_your_user_token_'
|
63
|
+
)
|
64
|
+
client = RedboothRuby::Client.new(session)
|
65
65
|
```
|
66
66
|
|
67
67
|
Now you can perform any user api call inside the clien wrapper
|
68
68
|
|
69
69
|
```Ruby
|
70
|
-
|
70
|
+
client.me(:show)
|
71
71
|
```
|
72
72
|
|
73
73
|
If you have multiple applications or you just want to ve explicit use the application credentials inside the session creation
|
74
74
|
|
75
75
|
```Ruby
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
76
|
+
session = RedboothRuby::Session.new(
|
77
|
+
token: '_your_user_token_',
|
78
|
+
consumer_key: '_your_app_key_',
|
79
|
+
consumer_secret: '_your_app_secret'
|
80
|
+
)
|
81
|
+
client = RedboothRuby::Client.new(session)
|
82
82
|
```
|
83
83
|
|
84
|
+
Refresh Token
|
85
|
+
------
|
86
|
+
|
87
|
+
By default, your access token will expires in 7200 seconds (2 hours). If you want to automatically get a new one, just need to provide the ```refresh_token``` param
|
88
|
+
|
89
|
+
```Ruby
|
90
|
+
session = RedboothRuby::Session.new(
|
91
|
+
token: '_your_user_token_',
|
92
|
+
refresh_token: '_your_user_refresh_token_',
|
93
|
+
auto_refresh_token: true
|
94
|
+
)
|
95
|
+
```
|
96
|
+
|
97
|
+
You can also provide a callback to get the new access token:
|
98
|
+
|
99
|
+
```Ruby
|
100
|
+
session = RedboothRuby::Session.new(
|
101
|
+
token: '_your_user_token_',
|
102
|
+
refresh_token: '_your_user_refresh_token_',
|
103
|
+
auto_refresh_token: true,
|
104
|
+
on_token_refresh: Proc.new do |old_access_token, new_access_token|
|
105
|
+
auth = Authentication.where(access_token: old_access_token.token).first
|
106
|
+
auth.access_token = new_access_token.token
|
107
|
+
auth.refresh_token = new_access_token.refresh_token
|
108
|
+
auth.save
|
109
|
+
end
|
110
|
+
)
|
111
|
+
```
|
112
|
+
|
113
|
+
|
84
114
|
Async Endpoints
|
85
115
|
======
|
86
116
|
|
@@ -156,14 +186,50 @@ Users
|
|
156
186
|
List users in your network
|
157
187
|
|
158
188
|
```Ruby
|
159
|
-
|
160
|
-
|
189
|
+
users_collection = client.user(:index)
|
190
|
+
users = users_collection.all
|
161
191
|
```
|
162
192
|
|
163
193
|
Fetch a specific user
|
164
194
|
|
165
195
|
```Ruby
|
166
|
-
|
196
|
+
user = client.user(:show, id: 123)
|
197
|
+
```
|
198
|
+
|
199
|
+
TaskLists
|
200
|
+
=====
|
201
|
+
|
202
|
+
Lists task lists in your visibility scope
|
203
|
+
|
204
|
+
```Ruby
|
205
|
+
tasklists_collection = client.task_list(:index)
|
206
|
+
tasklists = tasklists_collection.all
|
207
|
+
```
|
208
|
+
|
209
|
+
You can also filter by multiple params (see docs [here](https://redbooth.com/api/api-docs/#page:tasklists,header:tasklists-tasklist-list) )
|
210
|
+
|
211
|
+
```Ruby
|
212
|
+
filtered_tasklists = client.task_list(:index, order: 'id-DESC',
|
213
|
+
per_page: 50,
|
214
|
+
project_id: 123)
|
215
|
+
```
|
216
|
+
|
217
|
+
Fetch a specific tasklist
|
218
|
+
|
219
|
+
```Ruby
|
220
|
+
tasklist = client.task_list(:show, id: 123)
|
221
|
+
```
|
222
|
+
|
223
|
+
Update a specific tasklist
|
224
|
+
|
225
|
+
```Ruby
|
226
|
+
tasklist = client.task_list(:update, id: 123, name: 'new name')
|
227
|
+
```
|
228
|
+
|
229
|
+
Delete a specific tasklist
|
230
|
+
|
231
|
+
```Ruby
|
232
|
+
client.task_list(:delete, id: 123)
|
167
233
|
```
|
168
234
|
|
169
235
|
Tasks
|
@@ -172,34 +238,34 @@ Tasks
|
|
172
238
|
Lists tasks in your visibility scope
|
173
239
|
|
174
240
|
```Ruby
|
175
|
-
|
176
|
-
|
241
|
+
tasks_collection = client.task(:index)
|
242
|
+
tasks = tasks_collection.all
|
177
243
|
```
|
178
244
|
|
179
245
|
You can also filter by multiple params (see docs [here](https://redbooth.com/api/api-docs/#page:tasks,header:tasks-task-list) )
|
180
246
|
|
181
247
|
```Ruby
|
182
|
-
|
183
|
-
|
184
|
-
|
248
|
+
filtered_tasks = client.task(:index, order: 'id-DESC',
|
249
|
+
per_page: 50,
|
250
|
+
project_id: 123)
|
185
251
|
```
|
186
252
|
|
187
253
|
Fetch a specific task
|
188
254
|
|
189
255
|
```Ruby
|
190
|
-
|
256
|
+
task = client.task(:show, id: 123)
|
191
257
|
```
|
192
258
|
|
193
259
|
Update a specific task
|
194
260
|
|
195
261
|
```Ruby
|
196
|
-
|
262
|
+
task = client.task(:update, id: 123, name: 'new name')
|
197
263
|
```
|
198
264
|
|
199
265
|
Delete a specific task
|
200
266
|
|
201
267
|
```Ruby
|
202
|
-
|
268
|
+
client.task(:delete, id: 123)
|
203
269
|
```
|
204
270
|
|
205
271
|
Organizations
|
@@ -208,39 +274,39 @@ Organizations
|
|
208
274
|
Lists organizations in your visibility scope
|
209
275
|
|
210
276
|
```Ruby
|
211
|
-
|
212
|
-
|
277
|
+
organization_collection = client.organization(:index)
|
278
|
+
organizations = organization_collection.all
|
213
279
|
```
|
214
280
|
|
215
281
|
You can also filter by multiple params (see docs [here](https://redbooth.com/api/api-docs/#page:organizations,header:organizations-organization-list) )
|
216
282
|
|
217
283
|
```Ruby
|
218
|
-
|
219
|
-
|
284
|
+
filtered_organizations = client.organization(:index, order: 'id-DESC',
|
285
|
+
per_page: 50)
|
220
286
|
```
|
221
287
|
|
222
288
|
Fetch a specific organization
|
223
289
|
|
224
290
|
```Ruby
|
225
|
-
|
291
|
+
organization = client.organization(:show, id: 123)
|
226
292
|
```
|
227
293
|
|
228
294
|
Create a organization
|
229
295
|
|
230
296
|
```Ruby
|
231
|
-
|
297
|
+
organization = client.organization(:create, name: 'New Organization')
|
232
298
|
```
|
233
299
|
|
234
300
|
Update a specific organization
|
235
301
|
|
236
302
|
```Ruby
|
237
|
-
|
303
|
+
organization = client.organization(:update, id: 123, name: 'new name')
|
238
304
|
```
|
239
305
|
|
240
306
|
Delete a specific organization
|
241
307
|
|
242
308
|
```Ruby
|
243
|
-
|
309
|
+
client.organization(:delete, id: 123)
|
244
310
|
```
|
245
311
|
|
246
312
|
Projects
|
@@ -249,39 +315,38 @@ Projects
|
|
249
315
|
Lists projects in your visibility scope
|
250
316
|
|
251
317
|
```Ruby
|
252
|
-
|
253
|
-
|
318
|
+
project_collection = client.project(:index)
|
319
|
+
projects = project_collection.all
|
254
320
|
```
|
255
321
|
|
256
322
|
You can also filter by multiple params (see docs [here](https://redbooth.com/api/api-docs/#page:projects,header:projects-project-list) )
|
257
323
|
|
258
324
|
```Ruby
|
259
|
-
|
260
|
-
per_page: 50)
|
325
|
+
filtered_projects = client.project(:index, order: 'id-DESC', per_page: 50)
|
261
326
|
```
|
262
327
|
|
263
328
|
Fetch a specific project
|
264
329
|
|
265
330
|
```Ruby
|
266
|
-
|
331
|
+
project = client.project(:show, id: 123)
|
267
332
|
```
|
268
333
|
|
269
334
|
Create a project
|
270
335
|
|
271
336
|
```Ruby
|
272
|
-
|
337
|
+
project = client.project(:create, name: 'New Project')
|
273
338
|
```
|
274
339
|
|
275
340
|
Update a specific project
|
276
341
|
|
277
342
|
```Ruby
|
278
|
-
|
343
|
+
project = client.project(:update, id: 123, name: 'new name')
|
279
344
|
```
|
280
345
|
|
281
346
|
Delete a specific project
|
282
347
|
|
283
348
|
```Ruby
|
284
|
-
|
349
|
+
client.project(:delete, id: 123)
|
285
350
|
```
|
286
351
|
|
287
352
|
People
|
@@ -301,39 +366,38 @@ information
|
|
301
366
|
Lists People in your visibility scope
|
302
367
|
|
303
368
|
```Ruby
|
304
|
-
|
305
|
-
|
369
|
+
people_collection = client.person(:index)
|
370
|
+
people = people_collection.all
|
306
371
|
```
|
307
372
|
|
308
373
|
You can also filter by multiple params (see docs [here](https://redbooth.com/api/api-docs/#page:people,header:people-people-list) )
|
309
374
|
|
310
375
|
```Ruby
|
311
|
-
|
312
|
-
per_page: 50)
|
376
|
+
filtered_people = client.person(:index, order: 'id-DESC', per_page: 50)
|
313
377
|
```
|
314
378
|
|
315
379
|
Fetch a specific person
|
316
380
|
|
317
381
|
```Ruby
|
318
|
-
|
382
|
+
people = client.person(:show, id: 123)
|
319
383
|
```
|
320
384
|
|
321
385
|
Create a person
|
322
386
|
|
323
387
|
```Ruby
|
324
|
-
|
388
|
+
person = client.person(:create, project_id: 123, user_id: 123, role: 'participant')
|
325
389
|
```
|
326
390
|
|
327
391
|
Update a specific person
|
328
392
|
|
329
393
|
```Ruby
|
330
|
-
|
394
|
+
person = client.person(:update, id: 123, role: 'admin')
|
331
395
|
```
|
332
396
|
|
333
397
|
Delete a specific person
|
334
398
|
|
335
399
|
```Ruby
|
336
|
-
|
400
|
+
client.person(:delete, id: 123)
|
337
401
|
```
|
338
402
|
|
339
403
|
Memberships
|
@@ -352,39 +416,39 @@ Memberships is the redbooth relation between organization and users containing t
|
|
352
416
|
Lists Memberships in your visibility scope
|
353
417
|
|
354
418
|
```Ruby
|
355
|
-
|
356
|
-
|
419
|
+
membership_collection = client.membership(:index)
|
420
|
+
memberships = membership_collection.all
|
357
421
|
```
|
358
422
|
|
359
423
|
You can also filter by multiple params (see docs [here](https://redbooth.com/api/api-docs/#page:memberships,header:memberships-memberships-list) )
|
360
424
|
|
361
425
|
```Ruby
|
362
|
-
|
363
|
-
per_page: 50)
|
426
|
+
filtered_memberships = client.membership(:index, order: 'id-DESC', per_page: 50)
|
364
427
|
```
|
365
428
|
|
366
429
|
Fetch a specific membership
|
367
430
|
|
368
431
|
```Ruby
|
369
|
-
|
432
|
+
memberships = client.membership(:show, id: 123)
|
370
433
|
```
|
371
434
|
|
372
435
|
Create a membership
|
373
436
|
|
374
437
|
```Ruby
|
375
|
-
|
438
|
+
membership = client.membership(:create, organization_id: 123, user_id: 123,
|
439
|
+
role: 'participant')
|
376
440
|
```
|
377
441
|
|
378
442
|
Update a specific membership
|
379
443
|
|
380
444
|
```Ruby
|
381
|
-
|
445
|
+
membership = client.membership(:update, id: 123, role: 'admin')
|
382
446
|
```
|
383
447
|
|
384
448
|
Delete a specific membership
|
385
449
|
|
386
450
|
```Ruby
|
387
|
-
|
451
|
+
client.membership(:delete, id: 123)
|
388
452
|
```
|
389
453
|
|
390
454
|
Conversations
|
@@ -393,34 +457,34 @@ Conversations
|
|
393
457
|
Lists conversations in your visibility scope
|
394
458
|
|
395
459
|
```Ruby
|
396
|
-
|
397
|
-
|
460
|
+
conversation_collection = client.conversation(:index)
|
461
|
+
conversations = conversation_collection.all
|
398
462
|
```
|
399
463
|
|
400
464
|
You can also filter by multiple params (see docs [here](https://redbooth.com/api/api-docs/#page:conversations,header:conversations-conversations-list) )
|
401
465
|
|
402
466
|
```Ruby
|
403
|
-
|
404
|
-
|
405
|
-
|
467
|
+
filtered_conversations = client.conversation(:index, order: 'id-DESC',
|
468
|
+
per_page: 50,
|
469
|
+
project_id: 123)
|
406
470
|
```
|
407
471
|
|
408
472
|
Fetch a specific conversation
|
409
473
|
|
410
474
|
```Ruby
|
411
|
-
|
475
|
+
conversation = client.conversation(:show, id: 123)
|
412
476
|
```
|
413
477
|
|
414
478
|
Update a specific conversation
|
415
479
|
|
416
480
|
```Ruby
|
417
|
-
|
481
|
+
conversation = client.conversation(:update, id: 123, name: 'new name')
|
418
482
|
```
|
419
483
|
|
420
484
|
Delete a specific conversation
|
421
485
|
|
422
486
|
```Ruby
|
423
|
-
|
487
|
+
client.conversation(:delete, id: 123)
|
424
488
|
```
|
425
489
|
|
426
490
|
Comments
|
@@ -434,36 +498,36 @@ To consume the comments endpoint you allways need to provide a `target_type` and
|
|
434
498
|
Lists comments in your visibility scope
|
435
499
|
|
436
500
|
```Ruby
|
437
|
-
|
438
|
-
|
501
|
+
comment_collection = client.comment(:index, target_type: 'task', target_id: 123)
|
502
|
+
comments = comment_collection.all
|
439
503
|
```
|
440
504
|
|
441
505
|
You can also filter by multiple params (see docs [here](https://redbooth.com/api/api-docs/#page:comments,header:comments-commnets-list) )
|
442
506
|
|
443
507
|
```Ruby
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
508
|
+
filtered_comments = client.comment(:index, order: 'id-DESC',
|
509
|
+
per_page: 50,
|
510
|
+
project_id: 123,
|
511
|
+
target_type: 'task',
|
512
|
+
target_id: 123)
|
449
513
|
```
|
450
514
|
|
451
515
|
Fetch a specific comment
|
452
516
|
|
453
517
|
```Ruby
|
454
|
-
|
518
|
+
comment = client.comment(:show, id: 123)
|
455
519
|
```
|
456
520
|
|
457
521
|
Update a specific comment
|
458
522
|
|
459
523
|
```Ruby
|
460
|
-
|
524
|
+
comment = client.comment(:update, id: 123, body: 'new body content')
|
461
525
|
```
|
462
526
|
|
463
527
|
Delete a specific comment
|
464
528
|
|
465
529
|
```Ruby
|
466
|
-
|
530
|
+
client.comment(:delete, id: 123)
|
467
531
|
```
|
468
532
|
|
469
533
|
Notes
|
@@ -472,34 +536,34 @@ Notes
|
|
472
536
|
Lists notes in your visibility scope
|
473
537
|
|
474
538
|
```Ruby
|
475
|
-
|
476
|
-
|
539
|
+
notes_collection = client.note(:index)
|
540
|
+
notes = notes_collection.all
|
477
541
|
```
|
478
542
|
|
479
543
|
You can also filter by multiple params (see docs [here](https://redbooth.com/api/api-docs/#page:notes,header:notes-notes-list) )
|
480
544
|
|
481
545
|
```Ruby
|
482
|
-
|
483
|
-
|
484
|
-
|
546
|
+
filtered_notes = client.note(:index, order: 'id-DESC',
|
547
|
+
per_page: 50,
|
548
|
+
project_id: 123)
|
485
549
|
```
|
486
550
|
|
487
551
|
Fetch a specific note
|
488
552
|
|
489
553
|
```Ruby
|
490
|
-
|
554
|
+
note = client.note(:show, id: 123)
|
491
555
|
```
|
492
556
|
|
493
557
|
Update a specific note
|
494
558
|
|
495
559
|
```Ruby
|
496
|
-
|
560
|
+
note = client.note(:update, id: 123, name: 'new name')
|
497
561
|
```
|
498
562
|
|
499
563
|
Delete a specific note
|
500
564
|
|
501
565
|
```Ruby
|
502
|
-
|
566
|
+
client.note(:delete, id: 123)
|
503
567
|
```
|
504
568
|
|
505
569
|
Subtasks
|
@@ -510,40 +574,40 @@ Subtasks are little sentences under a task that could de resolved or not.
|
|
510
574
|
Lists subtasks in your visibility scope. Needs a task_id
|
511
575
|
|
512
576
|
```Ruby
|
513
|
-
|
514
|
-
|
577
|
+
subtask_collection = client.subtask(:index, task_id: 123)
|
578
|
+
subtasks = subtask_collection.all
|
515
579
|
```
|
516
580
|
|
517
581
|
You can also filter by multiple params (see docs [here](https://redbooth.com/api/api-docs/#page:subtasks,header:subtasks-subtasks-list) )
|
518
582
|
|
519
583
|
```Ruby
|
520
|
-
|
521
|
-
|
522
|
-
|
584
|
+
filtered_subtasks = client.subtask(:index, task_id: 123,
|
585
|
+
order: 'id-DESC',
|
586
|
+
per_page: 50)
|
523
587
|
```
|
524
588
|
|
525
589
|
Fetch a specific subtask
|
526
590
|
|
527
591
|
```Ruby
|
528
|
-
|
592
|
+
subtask = client.subtask(:show, id: 123)
|
529
593
|
```
|
530
594
|
|
531
595
|
Create a new subtask
|
532
596
|
|
533
597
|
```Ruby
|
534
|
-
|
598
|
+
subtask = client.subtask(:create, task_id: 123, name: 'new name')
|
535
599
|
```
|
536
600
|
|
537
601
|
Update a specific subtask
|
538
602
|
|
539
603
|
```Ruby
|
540
|
-
|
604
|
+
subtask = client.subtask(:update, id: 123, name: 'new name')
|
541
605
|
```
|
542
606
|
|
543
607
|
Delete a specific subtask
|
544
608
|
|
545
609
|
```Ruby
|
546
|
-
|
610
|
+
client.subtask(:delete, id: 123)
|
547
611
|
```
|
548
612
|
|
549
613
|
Files
|
@@ -554,40 +618,48 @@ Files in redbooth could be uploaded or choosen form other service providers (Cop
|
|
554
618
|
Lists files in your visibility scope.
|
555
619
|
|
556
620
|
```Ruby
|
557
|
-
|
558
|
-
|
621
|
+
files_colilection = client.file(:index)
|
622
|
+
files = files_collection.all
|
559
623
|
```
|
560
624
|
|
561
625
|
You can also filter by multiple params (see docs [here](https://redbooth.com/api/api-docs/#page:subtasks,header:subtasks-subtasks-list) )
|
562
626
|
|
563
627
|
```Ruby
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
628
|
+
filtered_files_collection = client.file(:index, backend: 'redbooth',
|
629
|
+
project_id: 123,
|
630
|
+
order: 'id-DESC',
|
631
|
+
per_page: 25)
|
568
632
|
```
|
569
633
|
|
570
634
|
Update a specific file
|
571
635
|
|
572
636
|
```Ruby
|
573
|
-
|
637
|
+
file = client.file(:update, id: 123, name: 'new_name.doc')
|
574
638
|
```
|
575
639
|
|
576
640
|
Create a new file
|
577
641
|
|
578
642
|
```Ruby
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
643
|
+
file = File.open('path/to/the/file')
|
644
|
+
new_file = client.file(:create, project_id: 123,
|
645
|
+
parent_id: nil,
|
646
|
+
backend: 'redbooth',
|
647
|
+
is_dir: false,
|
648
|
+
asset: file )
|
585
649
|
```
|
586
650
|
|
587
651
|
Delete a specific subtask
|
588
652
|
|
589
653
|
```Ruby
|
590
|
-
|
654
|
+
client.file(:delete, id: 123)
|
655
|
+
```
|
656
|
+
|
657
|
+
Download a file
|
658
|
+
|
659
|
+
```Ruby
|
660
|
+
file # RedBoothRuby::File
|
661
|
+
|
662
|
+
open('/path/to/your_new_file.txt', 'w') { |f| f.puts file.download }
|
591
663
|
```
|
592
664
|
|
593
665
|
Search
|
@@ -605,7 +677,7 @@ You can search throught any redbooth entity by using the search method. There is
|
|
605
677
|
Search for redbooth objects in your visibility scope
|
606
678
|
|
607
679
|
```Ruby
|
608
|
-
|
680
|
+
entities = client.search(query: 'task+nothing*')
|
609
681
|
```
|
610
682
|
|
611
683
|
Metadata
|
@@ -619,25 +691,25 @@ This is really helpful when doing API syncs or tiny implementations in top of th
|
|
619
691
|
Fetch object metadata
|
620
692
|
|
621
693
|
```Ruby
|
622
|
-
|
694
|
+
task.metadata
|
623
695
|
```
|
624
696
|
|
625
697
|
Update object metadata by adding new keys or overwriding the exisiting ones but not touching the others if there is any one.
|
626
698
|
|
627
699
|
```Ruby
|
628
|
-
|
700
|
+
task.metadata_merge("new_key" => "new value")
|
629
701
|
```
|
630
702
|
|
631
703
|
Restore user metadata by overwiritng the existing ones.
|
632
704
|
|
633
705
|
```Ruby
|
634
|
-
|
706
|
+
task.metadata = {"key" => "value"}
|
635
707
|
```
|
636
708
|
|
637
709
|
Search for a certain metadata key value
|
638
710
|
|
639
711
|
```Ruby
|
640
|
-
|
712
|
+
metadata_collection = client.metadata(key: 'key', value: 'value', target_type: 'Task')
|
641
713
|
```
|
642
714
|
|
643
715
|
License
|