ribose 0.2.0 → 0.3.0
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 +124 -78
- data/lib/ribose/calendar.rb +19 -0
- data/lib/ribose/join_space_request.rb +1 -0
- data/lib/ribose/member.rb +11 -0
- data/lib/ribose/member_role.rb +61 -0
- data/lib/ribose/space_file.rb +40 -0
- data/lib/ribose/version.rb +1 -1
- data/lib/ribose.rb +6 -0
- data/ribose.gemspec +3 -2
- data/spec/fixtures/calendar_events.json +36 -0
- data/spec/fixtures/join_space_request.json +32 -0
- data/spec/fixtures/member_role.json +19 -0
- data/spec/fixtures/space_file.json +27 -52
- data/spec/fixtures/space_files.json +58 -0
- data/spec/ribose/calendar_spec.rb +7 -7
- data/spec/ribose/join_space_request_spec.rb +13 -0
- data/spec/ribose/member_role_spec.rb +30 -0
- data/spec/ribose/member_spec.rb +10 -0
- data/spec/ribose/space_file_spec.rb +40 -0
- data/spec/support/fake_ribose_api.rb +64 -0
- metadata +29 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e0b15b878e195c9733369b05fd950d9bf77f079
|
4
|
+
data.tar.gz: 7255d85171187ea37f9ff8bd1ffdf900daaf1808
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60ca909d98a6b7ff1d640a95deaabf730f375dcea7fec4a8e8d7f71fba9e00918c7be49f118ef039ebaf50eb7fab3bc4a2535e5c5c1cf187826429e9b7a91303
|
7
|
+
data.tar.gz: 231660d478721f30381564b376478de330ff47c116ea5932f99a6429cf6dd907812ffa71b1fa441a646f228f6d5c72d9060ce9eff8e465350ef937a5d5523a13
|
data/README.md
CHANGED
@@ -31,24 +31,26 @@ $ gem install ribose
|
|
31
31
|
## Configure
|
32
32
|
|
33
33
|
We need to setup Ribose API configuration before we can perform any request
|
34
|
-
throughout this client
|
35
|
-
|
36
|
-
|
34
|
+
throughout this client
|
35
|
+
|
36
|
+
First, obtain an API token [as per this Github wiki](https://github.com/riboseinc/ribose-api/wiki/Obtaining-the-API-Token).
|
37
|
+
Using the token, configure the client by adding an initializer with the
|
38
|
+
following code:
|
37
39
|
|
38
40
|
```ruby
|
39
41
|
Ribose.configure do |config|
|
40
42
|
config.api_token = "SECRET_API_TOKEN"
|
41
43
|
config.user_email = "your-email@example.com"
|
42
44
|
|
43
|
-
# There are also some default configurations
|
44
|
-
# change those unless you have some very specific use
|
45
|
+
# There are also some default configurations. Normally you do not need to
|
46
|
+
# change those unless you have some very specific use cases.
|
45
47
|
#
|
46
48
|
# config.debug_mode = false
|
47
49
|
# config.api_host = "www.ribose.com"
|
48
50
|
end
|
49
51
|
```
|
50
52
|
|
51
|
-
Or
|
53
|
+
Or:
|
52
54
|
|
53
55
|
```ruby
|
54
56
|
Ribose.configuration.api_token = "SECRET_API_TOKEN"
|
@@ -59,8 +61,9 @@ Ribose.configuration.user_email = "your-email@example.com"
|
|
59
61
|
|
60
62
|
### App Data
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
+
#### List app data
|
65
|
+
|
66
|
+
App data can be retrieved using the `AppData.all` interface.
|
64
67
|
|
65
68
|
```ruby
|
66
69
|
Ribose::AppData.all
|
@@ -70,7 +73,8 @@ Ribose::AppData.all
|
|
70
73
|
|
71
74
|
#### List app relations
|
72
75
|
|
73
|
-
To retrieve the list of app relations we can use the `AppRelation.all`
|
76
|
+
To retrieve the list of app relations, we can use the `AppRelation.all`
|
77
|
+
interface.
|
74
78
|
|
75
79
|
```ruby
|
76
80
|
Ribose::AppRelation.all
|
@@ -79,7 +83,7 @@ Ribose::AppRelation.all
|
|
79
83
|
#### Fetch an app relation
|
80
84
|
|
81
85
|
To retrieve the details for a specific app relation, we can use the following
|
82
|
-
interface
|
86
|
+
interface.
|
83
87
|
|
84
88
|
```ruby
|
85
89
|
Ribose::AppRelation.fetch(app_relation_id)
|
@@ -119,7 +123,8 @@ Ribose::Setting.all
|
|
119
123
|
#### Fetch a setting
|
120
124
|
|
121
125
|
To fetch the details for any specific settings we can use the `Setting.fetch`
|
122
|
-
interface and it will return the details for that
|
126
|
+
interface with the specific Setting ID, and it will return the details for that
|
127
|
+
setting.
|
123
128
|
|
124
129
|
```ruby
|
125
130
|
Ribose::Setting.fetch(setting_id)
|
@@ -133,45 +138,45 @@ Ribose::Setting.update(setting_id, **new_updated_attributes_hash)
|
|
133
138
|
|
134
139
|
### Spaces
|
135
140
|
|
136
|
-
#### List user's
|
141
|
+
#### List user's Spaces
|
137
142
|
|
138
|
-
To list user's
|
139
|
-
all of the
|
143
|
+
To list a user's Spaces we can use the `Space.all` interface, and it will
|
144
|
+
retrieve all of the Spaces for the currently configured user.
|
140
145
|
|
141
146
|
```ruby
|
142
147
|
Ribose::Space.all
|
143
148
|
```
|
144
149
|
|
145
|
-
#### Fetch a user
|
150
|
+
#### Fetch a user Space
|
146
151
|
|
147
|
-
To retrieve the details for a
|
152
|
+
To retrieve the details for a Space we can use the `Space.fetch(space_id)`.
|
148
153
|
|
149
154
|
```ruby
|
150
155
|
Ribose::Space.fetch(space_id)
|
151
156
|
```
|
152
157
|
|
153
|
-
#### Create a user
|
158
|
+
#### Create a user Space
|
154
159
|
|
155
|
-
To create a new user
|
160
|
+
To create a new user Space,
|
156
161
|
|
157
162
|
```ruby
|
158
163
|
Ribose::Space.create(
|
159
|
-
access:
|
164
|
+
access: "private",
|
160
165
|
space_category_id: 12,
|
161
|
-
name:
|
162
|
-
description:
|
166
|
+
name: "The amazing Ribose Space",
|
167
|
+
description: "Description about your Space"
|
163
168
|
)
|
164
169
|
```
|
165
170
|
|
166
|
-
#### Update a user
|
171
|
+
#### Update a user Space
|
167
172
|
|
168
173
|
```ruby
|
169
174
|
Ribose::Space.update("space_uuid", name: "New updated name", **other_attributes)
|
170
175
|
```
|
171
176
|
|
172
|
-
#### Remove a user
|
177
|
+
#### Remove a user Space
|
173
178
|
|
174
|
-
To remove an existing
|
179
|
+
To remove an existing Space,
|
175
180
|
|
176
181
|
```ruby
|
177
182
|
Ribose::Space.remove(space_uuid, confirmation: true)
|
@@ -179,33 +184,71 @@ Ribose::Space.remove(space_uuid, confirmation: true)
|
|
179
184
|
|
180
185
|
### Members
|
181
186
|
|
182
|
-
The members endpoint are
|
183
|
-
any specific space we can use this interface.
|
187
|
+
The members endpoint are Space-specific.
|
184
188
|
|
185
|
-
|
189
|
+
To retrieve the member details under any specific Space, we can use this
|
190
|
+
interface.
|
186
191
|
|
187
|
-
|
192
|
+
#### List space members
|
193
|
+
|
194
|
+
To retrieve the list of members,
|
188
195
|
|
189
196
|
```ruby
|
190
197
|
Ribose::Member.all(space_id, options)
|
191
198
|
```
|
192
199
|
|
200
|
+
#### Delete a space member
|
201
|
+
|
202
|
+
```ruby
|
203
|
+
Ribose::Member.delete(space_id, member_id, options)
|
204
|
+
```
|
205
|
+
|
206
|
+
#### Fetch Member Role
|
207
|
+
|
208
|
+
```ruby
|
209
|
+
Ribose::MemberRole.fetch(space_id, member_id, options)
|
210
|
+
```
|
211
|
+
|
212
|
+
#### Assign a role to member
|
213
|
+
|
214
|
+
```ruby
|
215
|
+
Ribose::MemberRole.assign(space_id, member_id, role_id)
|
216
|
+
```
|
217
|
+
|
193
218
|
### Files
|
194
219
|
|
195
220
|
#### List of Files
|
196
221
|
|
197
|
-
To
|
222
|
+
To retrieve the list of files for any specific Space,
|
198
223
|
|
199
224
|
```ruby
|
200
225
|
Ribose::SpaceFile.all(space_id, options)
|
201
226
|
```
|
202
227
|
|
203
|
-
|
228
|
+
#### Fetch a file details
|
229
|
+
|
230
|
+
```ruby
|
231
|
+
Ribose::SpaceFile.fetch(space_id, file_id, options = {})
|
232
|
+
```
|
233
|
+
|
234
|
+
#### Create a file upload
|
204
235
|
|
205
236
|
```ruby
|
206
237
|
Ribose::SpaceFile.create(space_id, file: "The complete file path", **attributes)
|
207
238
|
```
|
208
239
|
|
240
|
+
#### Update a space file
|
241
|
+
|
242
|
+
```ruby
|
243
|
+
Ribose::SpaceFile.update(space_id, file_id, new_file_attributes = {})
|
244
|
+
```
|
245
|
+
|
246
|
+
#### Remove a space file
|
247
|
+
|
248
|
+
```ruby
|
249
|
+
Ribose::SpaceFile.delete(space_id, file_id)
|
250
|
+
```
|
251
|
+
|
209
252
|
### Conversations
|
210
253
|
|
211
254
|
#### Listing Space Conversations
|
@@ -252,9 +295,9 @@ Ribose::Message.all(space_id: space_uuid, conversation_id: conversation_uuid)
|
|
252
295
|
|
253
296
|
```ruby
|
254
297
|
Ribose::Message.create(
|
255
|
-
space_id:
|
298
|
+
space_id: space_uuid,
|
256
299
|
conversation_id: conversation_uuid,
|
257
|
-
contents:
|
300
|
+
contents: "Provide your message body here",
|
258
301
|
)
|
259
302
|
```
|
260
303
|
|
@@ -262,10 +305,10 @@ Ribose::Message.create(
|
|
262
305
|
|
263
306
|
```ruby
|
264
307
|
Ribose::Message.update(
|
265
|
-
space_id:
|
266
|
-
message_id:
|
308
|
+
space_id: space_uuid,
|
309
|
+
message_id: message_uuid,
|
267
310
|
conversation_id: conversation_uuid,
|
268
|
-
contents:
|
311
|
+
contents: "The new content for message",
|
269
312
|
)
|
270
313
|
```
|
271
314
|
|
@@ -273,8 +316,8 @@ Ribose::Message.update(
|
|
273
316
|
|
274
317
|
```ruby
|
275
318
|
Ribose::Message.remove(
|
276
|
-
space_id:
|
277
|
-
message_id:
|
319
|
+
space_id: space_uuid,
|
320
|
+
message_id: message_uuid,
|
278
321
|
conversation_id: conversation_uuid,
|
279
322
|
)
|
280
323
|
```
|
@@ -283,7 +326,7 @@ Ribose::Message.remove(
|
|
283
326
|
|
284
327
|
#### List user feeds
|
285
328
|
|
286
|
-
To retrieve the list of user feeds,
|
329
|
+
To retrieve the list of user feeds,
|
287
330
|
|
288
331
|
```ruby
|
289
332
|
Ribose::Feed.all
|
@@ -293,7 +336,7 @@ Ribose::Feed.all
|
|
293
336
|
|
294
337
|
#### List widgets
|
295
338
|
|
296
|
-
To retrieve the list of widgets
|
339
|
+
To retrieve the list of widgets,
|
297
340
|
|
298
341
|
```ruby
|
299
342
|
Ribose::Widget.all
|
@@ -303,7 +346,7 @@ Ribose::Widget.all
|
|
303
346
|
|
304
347
|
#### List of stream notifications
|
305
348
|
|
306
|
-
To retrieve the list of notifications
|
349
|
+
To retrieve the list of notifications,
|
307
350
|
|
308
351
|
```ruby
|
309
352
|
Ribose::Stream.all
|
@@ -313,8 +356,7 @@ Ribose::Stream.all
|
|
313
356
|
|
314
357
|
#### Retrieve the current leadership board
|
315
358
|
|
316
|
-
To retrieve the current leadership board,
|
317
|
-
interface and it will return the details.
|
359
|
+
To retrieve the current leadership board,
|
318
360
|
|
319
361
|
```ruby
|
320
362
|
Ribose::Leaderboard.all
|
@@ -322,7 +364,7 @@ Ribose::Leaderboard.all
|
|
322
364
|
|
323
365
|
### Connections
|
324
366
|
|
325
|
-
|
367
|
+
#### List of connections
|
326
368
|
|
327
369
|
To retrieve the list of connections, we can use the `Connection.all` interface
|
328
370
|
and it will return the connection as `Sawyer::Resource`.
|
@@ -333,8 +375,7 @@ Ribose::Connection.all
|
|
333
375
|
|
334
376
|
#### Connection suggestions
|
335
377
|
|
336
|
-
To retrieve the list of connection suggestions
|
337
|
-
interface and it will retrieve the suggested users.
|
378
|
+
To retrieve the list of user connection suggestions,
|
338
379
|
|
339
380
|
```ruby
|
340
381
|
Ribose::Connection.suggestions
|
@@ -348,7 +389,7 @@ Ribose::Connection.suggestions
|
|
348
389
|
Ribose::ConnectionInvitation.all
|
349
390
|
```
|
350
391
|
|
351
|
-
#### List
|
392
|
+
#### List Space invitations
|
352
393
|
|
353
394
|
```ruby
|
354
395
|
Ribose::SpaceInvitation.all
|
@@ -387,54 +428,54 @@ Ribose::ConnectionInvitation.reject(invitation_id)
|
|
387
428
|
Ribose::ConnectionInvitation.cancel(invitation_id)
|
388
429
|
```
|
389
430
|
|
390
|
-
#### Invite user to a
|
431
|
+
#### Invite user to a Space
|
391
432
|
|
392
433
|
```ruby
|
393
434
|
Ribose::SpaceInvitation.create(
|
394
|
-
state:
|
395
|
-
space_id:
|
435
|
+
state: "0",
|
436
|
+
space_id: "123_456_789",
|
396
437
|
invitee_id: "456_789_012",
|
397
|
-
type:
|
398
|
-
body:
|
438
|
+
type: "Invitation::ToSpace",
|
439
|
+
body: "Please join to this amazing Space",
|
399
440
|
)
|
400
441
|
```
|
401
442
|
|
402
|
-
#### Create
|
443
|
+
#### Create Space invitation - Mass
|
403
444
|
|
404
445
|
```ruby
|
405
446
|
Ribose::SpaceInvitation.mass_create(
|
406
447
|
space_id,
|
407
|
-
emails:
|
448
|
+
emails: ["email-one@example.com"],
|
408
449
|
role_ids: ["role-for-email-address-in-sequance"],
|
409
|
-
body:
|
450
|
+
body: "The complete message body for the invitation",
|
410
451
|
)
|
411
452
|
```
|
412
453
|
|
413
|
-
#### Update a
|
454
|
+
#### Update a Space invitation
|
414
455
|
|
415
456
|
```ruby
|
416
457
|
Ribose::SpaceInvitation.update(invitation_id, new_attributes_hash)
|
417
458
|
```
|
418
459
|
|
419
|
-
#### Accept a
|
460
|
+
#### Accept a Space invitation
|
420
461
|
|
421
462
|
```ruby
|
422
463
|
Ribose::SpaceInvitation.accept(invitation_id)
|
423
464
|
```
|
424
465
|
|
425
|
-
#### Resend a
|
466
|
+
#### Resend a Space invitation
|
426
467
|
|
427
468
|
```ruby
|
428
469
|
Ribose::SpaceInvitation.resend(invitation_id)
|
429
470
|
```
|
430
471
|
|
431
|
-
#### Reject a
|
472
|
+
#### Reject a Space invitation
|
432
473
|
|
433
474
|
```ruby
|
434
475
|
Ribose::SpaceInvitation.reject(invitation_id)
|
435
476
|
```
|
436
477
|
|
437
|
-
#### Cancel a
|
478
|
+
#### Cancel a Space invitation
|
438
479
|
|
439
480
|
```ruby
|
440
481
|
Ribose::SpaceInvitation.cancel(invitation_id)
|
@@ -442,36 +483,42 @@ Ribose::SpaceInvitation.cancel(invitation_id)
|
|
442
483
|
|
443
484
|
### Join Space Request
|
444
485
|
|
445
|
-
#### List
|
486
|
+
#### List Join Space Requests
|
446
487
|
|
447
488
|
```ruby
|
448
489
|
Ribose::JoinSpaceRequest.all
|
449
490
|
```
|
450
491
|
|
451
|
-
####
|
492
|
+
#### Fetch a join space request
|
493
|
+
|
494
|
+
```ruby
|
495
|
+
Ribose::JoinSpaceRequest.fetch(request_id)
|
496
|
+
```
|
497
|
+
|
498
|
+
#### Create a Join Space Request
|
452
499
|
|
453
500
|
```ruby
|
454
501
|
Ribose::JoinSpaceRequest.create(
|
455
|
-
state:
|
456
|
-
|
457
|
-
type:
|
458
|
-
body:
|
502
|
+
state: 0,
|
503
|
+
Space_id: 123_456_789,
|
504
|
+
type: "Invitation::JoinSpaceRequest",
|
505
|
+
body: "Hi, I would like to join to your Space",
|
459
506
|
)
|
460
507
|
```
|
461
508
|
|
462
|
-
#### Accept a
|
509
|
+
#### Accept a Join Space Request
|
463
510
|
|
464
511
|
```ruby
|
465
512
|
Ribose::JoinSpaceRequest.accept(invitation_id)
|
466
513
|
```
|
467
514
|
|
468
|
-
#### Reject a
|
515
|
+
#### Reject a Join Space Requests
|
469
516
|
|
470
517
|
```ruby
|
471
518
|
Ribose::JoinSpaceRequest.reject(invitation_id)
|
472
519
|
```
|
473
520
|
|
474
|
-
#### Update an
|
521
|
+
#### Update an Join Space Requests
|
475
522
|
|
476
523
|
```ruby
|
477
524
|
Ribose::JoinSpaceRequest.update(invitation_id, new_attributes_hash)
|
@@ -481,17 +528,16 @@ Ribose::JoinSpaceRequest.update(invitation_id, new_attributes_hash)
|
|
481
528
|
|
482
529
|
#### List user calendars
|
483
530
|
|
484
|
-
To retrieve the list of
|
485
|
-
fetch the calendar details for the currently configured user.
|
531
|
+
To retrieve the list of calendars accessible to the current user,
|
486
532
|
|
487
533
|
```ruby
|
488
534
|
Ribose::Calendar.all
|
489
535
|
```
|
490
536
|
|
491
|
-
#### Fetch a calendar
|
537
|
+
#### Fetch a calendar events
|
492
538
|
|
493
539
|
```ruby
|
494
|
-
Ribose::Calendar.fetch(
|
540
|
+
Ribose::Calendar.fetch(calendar_ids, start: Data.today, length: 7)
|
495
541
|
```
|
496
542
|
|
497
543
|
#### Create a calendar
|
@@ -499,8 +545,8 @@ Ribose::Calendar.fetch(calendar_id)
|
|
499
545
|
```ruby
|
500
546
|
Ribose::Calendar.create(
|
501
547
|
owner_type: "User",
|
502
|
-
owner_id:
|
503
|
-
name:
|
548
|
+
owner_id: "The Owner UUID",
|
549
|
+
name: "The name for the calendar",
|
504
550
|
)
|
505
551
|
```
|
506
552
|
|
@@ -522,9 +568,9 @@ Ribose::User.create(email: "user@example.com", **other_attributes)
|
|
522
568
|
|
523
569
|
```ruby
|
524
570
|
Ribose::User.activate(
|
525
|
-
email:
|
571
|
+
email: "user@example.com",
|
526
572
|
password: "ASecureUserPassword",
|
527
|
-
otp:
|
573
|
+
otp: "OTP Recived via the Email",
|
528
574
|
)
|
529
575
|
```
|
530
576
|
|
@@ -550,7 +596,7 @@ Ribose::Wiki.create(
|
|
550
596
|
)
|
551
597
|
```
|
552
598
|
|
553
|
-
|
599
|
+
#### Update a wiki page
|
554
600
|
|
555
601
|
```ruby
|
556
602
|
Ribose::Wiki.update(
|
@@ -558,7 +604,7 @@ Ribose::Wiki.update(
|
|
558
604
|
)
|
559
605
|
```
|
560
606
|
|
561
|
-
|
607
|
+
#### Remove a wiki page
|
562
608
|
|
563
609
|
```ruby
|
564
610
|
Ribose::Wiki.delete(space_id, wiki_id)
|
data/lib/ribose/calendar.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "date"
|
2
|
+
|
1
3
|
module Ribose
|
2
4
|
class Calendar < Ribose::Base
|
3
5
|
include Ribose::Actions::All
|
@@ -5,6 +7,23 @@ module Ribose
|
|
5
7
|
include Ribose::Actions::Create
|
6
8
|
include Ribose::Actions::Delete
|
7
9
|
|
10
|
+
# Fetch calendar events
|
11
|
+
#
|
12
|
+
# @params calendar_ids [Array] List of calendar Ids
|
13
|
+
# @params start [Date] The start date to fetch events
|
14
|
+
# @params length [Integer] How many days to fetch
|
15
|
+
# @return [Sawyer::Resource] The calendar events
|
16
|
+
#
|
17
|
+
def self.fetch(calendar_ids, start: Date.today, length: 7)
|
18
|
+
query = {
|
19
|
+
length: length,
|
20
|
+
cal_ids: Ribose.encode_ids(calendar_ids),
|
21
|
+
start: start.to_time.to_i / (60 * 60 * 24),
|
22
|
+
}
|
23
|
+
|
24
|
+
super(nil, query: query)
|
25
|
+
end
|
26
|
+
|
8
27
|
private
|
9
28
|
|
10
29
|
def resource
|
data/lib/ribose/member.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Ribose
|
2
2
|
class Member < Ribose::Base
|
3
3
|
include Ribose::Actions::All
|
4
|
+
include Ribose::Actions::Delete
|
4
5
|
|
5
6
|
# List A Space Members
|
6
7
|
#
|
@@ -15,6 +16,16 @@ module Ribose
|
|
15
16
|
new(space_id: space_id, **options).all
|
16
17
|
end
|
17
18
|
|
19
|
+
# Delete a space member
|
20
|
+
#
|
21
|
+
# @param space_id [String] The Space UUID
|
22
|
+
# @param member_id [String] The Member UUID
|
23
|
+
# @param options [Hash] Query parameters as Hash
|
24
|
+
#
|
25
|
+
def self.delete(space_id, member_id, options = {})
|
26
|
+
new(space_id: space_id, resource_id: member_id, **options).delete
|
27
|
+
end
|
28
|
+
|
18
29
|
private
|
19
30
|
|
20
31
|
attr_reader :space_id
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Ribose
|
2
|
+
class MemberRole < Ribose::Base
|
3
|
+
include Ribose::Actions::Fetch
|
4
|
+
|
5
|
+
def assign
|
6
|
+
assign_member_role
|
7
|
+
end
|
8
|
+
|
9
|
+
# Fetch Member Role
|
10
|
+
#
|
11
|
+
# @param space_id [String] The Space UUID
|
12
|
+
# @param user_id [String] The Member UUID
|
13
|
+
# @param options [Hash] Query parameters as Hash
|
14
|
+
# @return [Sawyer::Resoruce] Mmeber role in space
|
15
|
+
#
|
16
|
+
def self.fetch(space_id, user_id, options = {})
|
17
|
+
new(resource_id: user_id, space_id: space_id, **options).fetch
|
18
|
+
end
|
19
|
+
|
20
|
+
# Assign Role to a Member
|
21
|
+
#
|
22
|
+
# @param space_id [String] The Space UUID
|
23
|
+
# @param user_id [String] The Member UUID
|
24
|
+
# @param role_id [String] The role id in space
|
25
|
+
#
|
26
|
+
def self.assign(space_id, user_id, role_id)
|
27
|
+
new(space_id: space_id, resource_id: user_id, role_id: role_id).assign
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
attr_reader :role_id
|
33
|
+
|
34
|
+
def resource
|
35
|
+
nil
|
36
|
+
end
|
37
|
+
|
38
|
+
def assign_path
|
39
|
+
[resources_path, "change_assignment"].join("/")
|
40
|
+
end
|
41
|
+
|
42
|
+
def resource_path
|
43
|
+
[resources_path, "get_roles"].join("/")
|
44
|
+
end
|
45
|
+
|
46
|
+
def resources_path
|
47
|
+
["people", "users", resource_id, "roles"].join("/")
|
48
|
+
end
|
49
|
+
|
50
|
+
def extract_local_attributes
|
51
|
+
@role_id = attributes.delete(:role_id)
|
52
|
+
@query = { in_space: attributes.delete(:space_id) }
|
53
|
+
end
|
54
|
+
|
55
|
+
def assign_member_role
|
56
|
+
Ribose::Request.put(
|
57
|
+
assign_path, custom_option.merge(checked_role: role_id)
|
58
|
+
)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/ribose/space_file.rb
CHANGED
@@ -3,6 +3,9 @@ require "ribose/file_uploader"
|
|
3
3
|
module Ribose
|
4
4
|
class SpaceFile < Ribose::Base
|
5
5
|
include Ribose::Actions::All
|
6
|
+
include Ribose::Actions::Fetch
|
7
|
+
include Ribose::Actions::Update
|
8
|
+
include Ribose::Actions::Delete
|
6
9
|
|
7
10
|
# List Files for Space
|
8
11
|
#
|
@@ -18,6 +21,19 @@ module Ribose
|
|
18
21
|
new(space_id: space_id, **options).all
|
19
22
|
end
|
20
23
|
|
24
|
+
# Fetch a space file
|
25
|
+
#
|
26
|
+
# This interface retrieve the details for a single file in any
|
27
|
+
# given user space. The response is a `Sawyer::Resource`.
|
28
|
+
#
|
29
|
+
# @param space_id [String] The space UUID
|
30
|
+
# @param file_id [String] The space file ID
|
31
|
+
# @return [Sawyer::Resource]
|
32
|
+
#
|
33
|
+
def self.fetch(space_id, file_id, options = {})
|
34
|
+
new(space_id: space_id, resource_id: file_id, **options).fetch
|
35
|
+
end
|
36
|
+
|
21
37
|
# Create a new file upload
|
22
38
|
#
|
23
39
|
# @param space_id [String] The Space UUID
|
@@ -30,6 +46,26 @@ module Ribose
|
|
30
46
|
upload[:attachment]
|
31
47
|
end
|
32
48
|
|
49
|
+
# Update a space file
|
50
|
+
#
|
51
|
+
# @param space_id [String] The Space UUID
|
52
|
+
# @param file_id [String] The space file ID
|
53
|
+
# @param attributes [Hash] The file attributes
|
54
|
+
# @return [Sawyer::Resource]
|
55
|
+
#
|
56
|
+
def self.update(space_id, file_id, attributes)
|
57
|
+
new(space_id: space_id, resource_id: file_id, **attributes).update
|
58
|
+
end
|
59
|
+
|
60
|
+
# Delete a space file
|
61
|
+
#
|
62
|
+
# @param space_id [String] The Space UUID
|
63
|
+
# @param file_id [String] The space file ID
|
64
|
+
#
|
65
|
+
def self.delete(space_id, file_id, options = {})
|
66
|
+
new(space_id: space_id, resource_id: file_id, **options).delete
|
67
|
+
end
|
68
|
+
|
33
69
|
private
|
34
70
|
|
35
71
|
attr_reader :space_id
|
@@ -38,6 +74,10 @@ module Ribose
|
|
38
74
|
"file"
|
39
75
|
end
|
40
76
|
|
77
|
+
def resource_key
|
78
|
+
"file_info"
|
79
|
+
end
|
80
|
+
|
41
81
|
def resources_path
|
42
82
|
["spaces", space_id, "file", "files"].join("/")
|
43
83
|
end
|
data/lib/ribose/version.rb
CHANGED
data/lib/ribose.rb
CHANGED
@@ -27,9 +27,15 @@ require "ribose/user"
|
|
27
27
|
require "ribose/session"
|
28
28
|
require "ribose/profile"
|
29
29
|
require "ribose/wiki"
|
30
|
+
require "ribose/member_role"
|
30
31
|
|
31
32
|
module Ribose
|
32
33
|
def self.root
|
33
34
|
File.dirname(__dir__)
|
34
35
|
end
|
36
|
+
|
37
|
+
def self.encode_ids(resource_ids)
|
38
|
+
require "id_pack"
|
39
|
+
IdPack::IdPacker.new.encode([resource_ids].flatten)
|
40
|
+
end
|
35
41
|
end
|
data/ribose.gemspec
CHANGED
@@ -20,9 +20,10 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
21
21
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.1.9")
|
22
22
|
|
23
|
-
spec.add_dependency "
|
24
|
-
spec.add_dependency "mime-types", "~> 3.1"
|
23
|
+
spec.add_dependency "id_pack", "~> 1.0.1"
|
25
24
|
spec.add_dependency "mechanize", "~> 2.7.5"
|
25
|
+
spec.add_dependency "mime-types", "~> 3.1"
|
26
|
+
spec.add_dependency "sawyer", "~> 0.8.1"
|
26
27
|
|
27
28
|
spec.add_development_dependency "bundler", "~> 1.14"
|
28
29
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -0,0 +1,36 @@
|
|
1
|
+
{
|
2
|
+
"head_events": [],
|
3
|
+
"indices": {
|
4
|
+
"17599": [],
|
5
|
+
"17600": [],
|
6
|
+
"17601": [],
|
7
|
+
"17602": [],
|
8
|
+
"17603": [
|
9
|
+
129258
|
10
|
+
],
|
11
|
+
"17604": [],
|
12
|
+
"17605": []
|
13
|
+
},
|
14
|
+
"events": [
|
15
|
+
{
|
16
|
+
"id": 129258,
|
17
|
+
"name": "Sample event",
|
18
|
+
"description": "",
|
19
|
+
"where": "",
|
20
|
+
"all_day": true,
|
21
|
+
"recurring_type": "not_repeat",
|
22
|
+
"my_note": null,
|
23
|
+
"old_head_id": null,
|
24
|
+
"calendar_id": 123,
|
25
|
+
"created_by": "2970d105-5ccc-4a8c-b0c4",
|
26
|
+
"utc_start": "2018-03-13T12:00:00.000Z",
|
27
|
+
"utc_finish": "2018-03-13T13:00:00.000Z",
|
28
|
+
"utc_old_start": null,
|
29
|
+
"utc_old_finish": null,
|
30
|
+
"can_save": true,
|
31
|
+
"can_delete": true,
|
32
|
+
"timestamp": 1520690119
|
33
|
+
}
|
34
|
+
],
|
35
|
+
"requested_at": 1520691155924
|
36
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
{
|
2
|
+
"join_space_request": {
|
3
|
+
"id": 123456789,
|
4
|
+
"email": "",
|
5
|
+
"body": null,
|
6
|
+
"created_at": "",
|
7
|
+
"state": 0,
|
8
|
+
"type": "Invitation::ToSpace",
|
9
|
+
"updated_at": "",
|
10
|
+
"invitee": {
|
11
|
+
"id": "109EF27E",
|
12
|
+
"connected": true,
|
13
|
+
"name": "Joe Public",
|
14
|
+
"mutual_spaces": [
|
15
|
+
""
|
16
|
+
]
|
17
|
+
},
|
18
|
+
"inviter": {
|
19
|
+
"id": "109EF27E",
|
20
|
+
"connected": true,
|
21
|
+
"name": "John Doe",
|
22
|
+
"mutual_spaces": [
|
23
|
+
""
|
24
|
+
]
|
25
|
+
},
|
26
|
+
"space": {
|
27
|
+
"id": "948AD10F",
|
28
|
+
"name": "My first space",
|
29
|
+
"members_count": 10
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
{
|
2
|
+
"roles":[
|
3
|
+
{
|
4
|
+
"id":91877,
|
5
|
+
"name":"Member",
|
6
|
+
"space_id":"77b9d5102fb0-457e8438-1c6f"
|
7
|
+
},
|
8
|
+
{
|
9
|
+
"id":91878,
|
10
|
+
"name":"Administrator",
|
11
|
+
"space_id":"77b9d5102fb0-457e8438-1c6f"
|
12
|
+
}
|
13
|
+
],
|
14
|
+
"user_role":{
|
15
|
+
"id":91878,
|
16
|
+
"name":"Administrator",
|
17
|
+
"space_id":"77b9d5102fb0-457e8438-1c6f"
|
18
|
+
}
|
19
|
+
}
|
@@ -1,58 +1,33 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
"allow_update": true,
|
15
|
-
"allow_create": true,
|
16
|
-
"allow_edit": true,
|
17
|
-
"allow_delete": true,
|
18
|
-
"allow_download": true,
|
19
|
-
"current_version_id": 11559,
|
20
|
-
"versions": [
|
21
|
-
{
|
22
|
-
"version": 1,
|
23
|
-
"name": "sample-file.png",
|
24
|
-
"updated_at": "2017-08-14T08:57:50.000+00:00",
|
25
|
-
"position": 1,
|
26
|
-
"current_version_id": 11559,
|
27
|
-
"icon_path": "https://assets-2-us-d1bd645.ribose.com/assets/files/placeholder-thumb-59ea90c30f07829d1dc87ce0dfffaeaf.png",
|
28
|
-
"content_size": 58784,
|
29
|
-
"author": "John Doe"
|
30
|
-
}
|
31
|
-
]
|
32
|
-
}
|
33
|
-
],
|
34
|
-
"recent_activity": [
|
35
|
-
{
|
36
|
-
"date": "Monday, August 14, 2017",
|
37
|
-
"links": [
|
38
|
-
{
|
39
|
-
"id": 9896,
|
40
|
-
"name": "sample-file.png",
|
41
|
-
"path": "/#spaces/0e8d5c16-1a31-4df9-83d9-eeaa374d5adc/file/files/9896/versions/11559"
|
42
|
-
}
|
43
|
-
]
|
44
|
-
}
|
45
|
-
],
|
46
|
-
"tags": {
|
47
|
-
"selected_tags": [],
|
48
|
-
"related_tags": [],
|
49
|
-
"all_tags": []
|
50
|
-
},
|
51
|
-
"permissions": {
|
2
|
+
"file": {
|
3
|
+
"id": 9896,
|
4
|
+
"created_at": "2017-08-14T08:57:49.000+00:00",
|
5
|
+
"updated_at": "2017-08-14T08:57:50.000+00:00",
|
6
|
+
"name": "sample-file.png",
|
7
|
+
"description": "",
|
8
|
+
"version": 1,
|
9
|
+
"tag_list": [],
|
10
|
+
"content_size": 58784,
|
11
|
+
"content_type": "image/png",
|
12
|
+
"author": "Abu Nashir",
|
13
|
+
"allow_update": true,
|
52
14
|
"allow_create": true,
|
53
|
-
"allow_download": true,
|
54
15
|
"allow_edit": true,
|
55
16
|
"allow_delete": true,
|
56
|
-
"
|
17
|
+
"allow_download": true,
|
18
|
+
"current_version_id": 11559,
|
19
|
+
"versions": [
|
20
|
+
{
|
21
|
+
"version": 1,
|
22
|
+
"name": "sample-file.png",
|
23
|
+
"updated_at": "2017-08-14T08:57:50.000+00:00",
|
24
|
+
"position": 1,
|
25
|
+
"current_version_id": 11559,
|
26
|
+
"icon_path": "https://assets-2-us-d1bd645.ribose.com/assets/files/placeholder-thumb-59ea90c30f07829d1dc87ce0dfffaeaf.png",
|
27
|
+
"content_size": 58784,
|
28
|
+
"author": "John Doe"
|
29
|
+
}
|
30
|
+
]
|
57
31
|
}
|
32
|
+
|
58
33
|
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
{
|
2
|
+
"files": [
|
3
|
+
{
|
4
|
+
"id": 9896,
|
5
|
+
"created_at": "2017-08-14T08:57:49.000+00:00",
|
6
|
+
"updated_at": "2017-08-14T08:57:50.000+00:00",
|
7
|
+
"name": "sample-file.png",
|
8
|
+
"description": "",
|
9
|
+
"version": 1,
|
10
|
+
"tag_list": [],
|
11
|
+
"content_size": 58784,
|
12
|
+
"content_type": "image/png",
|
13
|
+
"author": "Abu Nashir",
|
14
|
+
"allow_update": true,
|
15
|
+
"allow_create": true,
|
16
|
+
"allow_edit": true,
|
17
|
+
"allow_delete": true,
|
18
|
+
"allow_download": true,
|
19
|
+
"current_version_id": 11559,
|
20
|
+
"versions": [
|
21
|
+
{
|
22
|
+
"version": 1,
|
23
|
+
"name": "sample-file.png",
|
24
|
+
"updated_at": "2017-08-14T08:57:50.000+00:00",
|
25
|
+
"position": 1,
|
26
|
+
"current_version_id": 11559,
|
27
|
+
"icon_path": "https://assets-2-us-d1bd645.ribose.com/assets/files/placeholder-thumb-59ea90c30f07829d1dc87ce0dfffaeaf.png",
|
28
|
+
"content_size": 58784,
|
29
|
+
"author": "John Doe"
|
30
|
+
}
|
31
|
+
]
|
32
|
+
}
|
33
|
+
],
|
34
|
+
"recent_activity": [
|
35
|
+
{
|
36
|
+
"date": "Monday, August 14, 2017",
|
37
|
+
"links": [
|
38
|
+
{
|
39
|
+
"id": 9896,
|
40
|
+
"name": "sample-file.png",
|
41
|
+
"path": "/#spaces/0e8d5c16-1a31-4df9-83d9-eeaa374d5adc/file/files/9896/versions/11559"
|
42
|
+
}
|
43
|
+
]
|
44
|
+
}
|
45
|
+
],
|
46
|
+
"tags": {
|
47
|
+
"selected_tags": [],
|
48
|
+
"related_tags": [],
|
49
|
+
"all_tags": []
|
50
|
+
},
|
51
|
+
"permissions": {
|
52
|
+
"allow_create": true,
|
53
|
+
"allow_download": true,
|
54
|
+
"allow_edit": true,
|
55
|
+
"allow_delete": true,
|
56
|
+
"allow_mass_actions": true
|
57
|
+
}
|
58
|
+
}
|
@@ -13,15 +13,15 @@ RSpec.describe Ribose::Calendar do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe ".fetch" do
|
16
|
-
it "retrieves the
|
17
|
-
|
16
|
+
it "retrieves the events for calendars" do
|
17
|
+
calendar_ids = [123, 456]
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
stub_ribose_calendar_events_api(calendar_ids)
|
20
|
+
events = Ribose::Calendar.fetch(calendar_ids).events
|
21
21
|
|
22
|
-
expect(
|
23
|
-
expect(
|
24
|
-
expect(
|
22
|
+
expect(events.first.id).not_to be_nil
|
23
|
+
expect(events.first.calendar_id).to eq(123)
|
24
|
+
expect(events.first.name).to eq("Sample event")
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -11,6 +11,19 @@ RSpec.describe Ribose::JoinSpaceRequest do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
describe ".fetch" do
|
15
|
+
it "retrieves the details for a join space request" do
|
16
|
+
invitation_id = 123_456_789
|
17
|
+
|
18
|
+
stub_ribose_join_space_request_fetch_api(invitation_id)
|
19
|
+
invitation = Ribose::JoinSpaceRequest.fetch(invitation_id)
|
20
|
+
|
21
|
+
expect(invitation.id).not_to be_nil
|
22
|
+
expect(invitation.inviter.name).to eq("John Doe")
|
23
|
+
expect(invitation.type).to eq("Invitation::ToSpace")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
14
27
|
describe ".create" do
|
15
28
|
it "creates a new join space request" do
|
16
29
|
attributes = {
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Ribose::MemberRole do
|
4
|
+
describe ".fetch" do
|
5
|
+
it "retrieves the role for a member in a space" do
|
6
|
+
space_id = 123_456_789
|
7
|
+
member_id = 456_789_012
|
8
|
+
|
9
|
+
stub_ribose_member_role_fetch_api(space_id, member_id)
|
10
|
+
member_role = Ribose::MemberRole.fetch(space_id, member_id)
|
11
|
+
|
12
|
+
expect(member_role.roles.first.name).to eq("Member")
|
13
|
+
expect(member_role.roles.last.name).to eq("Administrator")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe ".assign" do
|
18
|
+
it "assigns a role to a member in a space" do
|
19
|
+
role_id = 789_123_456
|
20
|
+
space_id = 123_456_789
|
21
|
+
member_id = 456_789_012
|
22
|
+
|
23
|
+
stub_ribose_member_role_assign(space_id, member_id, role_id)
|
24
|
+
|
25
|
+
expect do
|
26
|
+
Ribose::MemberRole.assign(space_id, member_id, role_id)
|
27
|
+
end.not_to raise_error
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/spec/ribose/member_spec.rb
CHANGED
@@ -13,4 +13,14 @@ RSpec.describe Ribose::Member do
|
|
13
13
|
expect(members.first.role_name_in_space).to eq("Administrator")
|
14
14
|
end
|
15
15
|
end
|
16
|
+
|
17
|
+
describe ".delete" do
|
18
|
+
it "deletes a member from a space" do
|
19
|
+
space_id = 123_456_789
|
20
|
+
member_id = 456_789_012
|
21
|
+
|
22
|
+
stub_ribose_space_member_delete_api(space_id, member_id)
|
23
|
+
expect { Ribose::Member.delete(space_id, member_id) }.not_to raise_error
|
24
|
+
end
|
25
|
+
end
|
16
26
|
end
|
@@ -14,6 +14,20 @@ RSpec.describe Ribose::SpaceFile do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
describe ".fetch" do
|
18
|
+
it "retrieves the details for a file" do
|
19
|
+
file_id = 456_789_012
|
20
|
+
space_id = 123_456_789
|
21
|
+
|
22
|
+
stub_ribose_space_file_fetch_api(space_id, file_id)
|
23
|
+
file = Ribose::SpaceFile.fetch(space_id, file_id)
|
24
|
+
|
25
|
+
expect(file.id).not_to be_nil
|
26
|
+
expect(file.name).to eq("sample-file.png")
|
27
|
+
expect(file.content_type).to eq("image/png")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
17
31
|
describe ".create" do
|
18
32
|
it "creates a new file with provided details" do
|
19
33
|
space_id = 123_456_789
|
@@ -27,6 +41,32 @@ RSpec.describe Ribose::SpaceFile do
|
|
27
41
|
end
|
28
42
|
end
|
29
43
|
|
44
|
+
describe ".update" do
|
45
|
+
it "updates the details for a space file" do
|
46
|
+
file_id = 456_789_012
|
47
|
+
space_id = 123_456_789
|
48
|
+
|
49
|
+
attributes = { name: "sample-file.png", description: "description" }
|
50
|
+
stub_ribose_space_file_update_api(space_id, file_id, attributes)
|
51
|
+
|
52
|
+
file = Ribose::SpaceFile.update(space_id, file_id, attributes)
|
53
|
+
|
54
|
+
expect(file.id).not_to be_nil
|
55
|
+
expect(file.name).to eq("sample-file.png")
|
56
|
+
expect(file.content_type).to eq("image/png")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe ".delete" do
|
61
|
+
it "removes a specified space file" do
|
62
|
+
file_id = 456_789_012
|
63
|
+
space_id = 123_456_789
|
64
|
+
|
65
|
+
stub_ribose_space_file_delete_api(space_id, file_id)
|
66
|
+
expect { Ribose::SpaceFile.delete(space_id, file_id) }.not_to raise_error
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
30
70
|
def file_attributes
|
31
71
|
{
|
32
72
|
file: sample_fixture_file,
|
@@ -38,6 +38,29 @@ module Ribose
|
|
38
38
|
stub_api_response(:get, "spaces/#{space_id}/members", filename: "members")
|
39
39
|
end
|
40
40
|
|
41
|
+
def stub_ribose_space_member_delete_api(space_id, member_id)
|
42
|
+
stub_api_response(
|
43
|
+
:delete, "spaces/#{space_id}/members/#{member_id}", filename: "empty"
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
def stub_ribose_member_role_fetch_api(space_id, user_id)
|
48
|
+
stub_api_response(
|
49
|
+
:get,
|
50
|
+
"people/users/#{user_id}/roles/get_roles?in_space=#{space_id}",
|
51
|
+
filename: "member_role",
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
def stub_ribose_member_role_assign(space_id, user_id, role_id)
|
56
|
+
stub_api_response(
|
57
|
+
:put,
|
58
|
+
"people/users/#{user_id}/roles/change_assignment?in_space=#{space_id}",
|
59
|
+
data: { checked_role: role_id },
|
60
|
+
filename: "empty",
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
41
64
|
def stub_ribose_setting_list_api
|
42
65
|
stub_api_response(:get, "settings", filename: "settings")
|
43
66
|
end
|
@@ -75,6 +98,20 @@ module Ribose
|
|
75
98
|
)
|
76
99
|
end
|
77
100
|
|
101
|
+
def stub_ribose_calendar_events_api(calendar_ids, length: 7)
|
102
|
+
data = OpenStruct.new(
|
103
|
+
length: length,
|
104
|
+
cals: Ribose.encode_ids(calendar_ids),
|
105
|
+
start: Date.today.to_time.to_i / (60 * 60 * 24),
|
106
|
+
)
|
107
|
+
|
108
|
+
params = "cal_ids=#{data.cals}&length=#{data.length}&start=#{data.start}"
|
109
|
+
|
110
|
+
stub_api_response(
|
111
|
+
:get, "calendar/calendar/?#{params}", filename: "calendar_events"
|
112
|
+
)
|
113
|
+
end
|
114
|
+
|
78
115
|
def stub_ribose_calendar_create_api(attributes)
|
79
116
|
stub_api_response(
|
80
117
|
:post,
|
@@ -114,9 +151,28 @@ module Ribose
|
|
114
151
|
|
115
152
|
def stub_ribose_space_file_list(space_id)
|
116
153
|
file_endppoint = ["spaces", space_id, "file", "files"].join("/")
|
154
|
+
stub_api_response(:get, file_endppoint, filename: "space_files")
|
155
|
+
end
|
156
|
+
|
157
|
+
def stub_ribose_space_file_fetch_api(space_id, file_id)
|
158
|
+
file_endppoint = ["spaces", space_id, "file", "files", file_id].join("/")
|
117
159
|
stub_api_response(:get, file_endppoint, filename: "space_file")
|
118
160
|
end
|
119
161
|
|
162
|
+
def stub_ribose_space_file_update_api(space_id, file_id, attributes)
|
163
|
+
stub_api_response(
|
164
|
+
:put,
|
165
|
+
["spaces", space_id, "file", "files", file_id].join("/"),
|
166
|
+
data: { file_info: attributes },
|
167
|
+
filename: "space_file",
|
168
|
+
)
|
169
|
+
end
|
170
|
+
|
171
|
+
def stub_ribose_space_file_delete_api(space_id, file_id)
|
172
|
+
file_endppoint = ["spaces", space_id, "file", "files", file_id].join("/")
|
173
|
+
stub_api_response(:delete, file_endppoint, filename: "empty")
|
174
|
+
end
|
175
|
+
|
120
176
|
def stub_ribose_space_conversation_list(space_id)
|
121
177
|
stub_api_response(
|
122
178
|
:get, conversations_path(space_id), filename: "conversations"
|
@@ -296,6 +352,14 @@ module Ribose
|
|
296
352
|
)
|
297
353
|
end
|
298
354
|
|
355
|
+
def stub_ribose_join_space_request_fetch_api(invitation_id)
|
356
|
+
stub_api_response(
|
357
|
+
:get,
|
358
|
+
["invitations", "join_space_request", invitation_id].join("/"),
|
359
|
+
filename: "join_space_request",
|
360
|
+
)
|
361
|
+
end
|
362
|
+
|
299
363
|
def stub_ribose_join_space_request_create_api(attributes)
|
300
364
|
stub_api_response(
|
301
365
|
:post,
|
metadata
CHANGED
@@ -1,29 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ribose
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: id_pack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 1.0.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 1.0.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mechanize
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.7.5
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.7.5
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: mime-types
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,19 +53,19 @@ dependencies:
|
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '3.1'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: sawyer
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
61
|
+
version: 0.8.1
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
68
|
+
version: 0.8.1
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: bundler
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -167,6 +181,7 @@ files:
|
|
167
181
|
- lib/ribose/join_space_request.rb
|
168
182
|
- lib/ribose/leaderboard.rb
|
169
183
|
- lib/ribose/member.rb
|
184
|
+
- lib/ribose/member_role.rb
|
170
185
|
- lib/ribose/message.rb
|
171
186
|
- lib/ribose/profile.rb
|
172
187
|
- lib/ribose/request.rb
|
@@ -188,6 +203,7 @@ files:
|
|
188
203
|
- spec/fixtures/app_relation.json
|
189
204
|
- spec/fixtures/app_relations.json
|
190
205
|
- spec/fixtures/calendar.json
|
206
|
+
- spec/fixtures/calendar_events.json
|
191
207
|
- spec/fixtures/calendars.json
|
192
208
|
- spec/fixtures/connection_invitation.json
|
193
209
|
- spec/fixtures/connection_invitation_accepted.json
|
@@ -203,11 +219,13 @@ files:
|
|
203
219
|
- spec/fixtures/file_upload_prepared.json
|
204
220
|
- spec/fixtures/file_uploaded.json
|
205
221
|
- spec/fixtures/general_information.json
|
222
|
+
- spec/fixtures/join_space_request.json
|
206
223
|
- spec/fixtures/join_space_request_created.json
|
207
224
|
- spec/fixtures/join_space_request_updated.json
|
208
225
|
- spec/fixtures/join_space_requests.json
|
209
226
|
- spec/fixtures/leaderboard.json
|
210
227
|
- spec/fixtures/login.html
|
228
|
+
- spec/fixtures/member_role.json
|
211
229
|
- spec/fixtures/members.json
|
212
230
|
- spec/fixtures/message.json
|
213
231
|
- spec/fixtures/messages.json
|
@@ -219,6 +237,7 @@ files:
|
|
219
237
|
- spec/fixtures/space.json
|
220
238
|
- spec/fixtures/space_created.json
|
221
239
|
- spec/fixtures/space_file.json
|
240
|
+
- spec/fixtures/space_files.json
|
222
241
|
- spec/fixtures/space_invitation.json
|
223
242
|
- spec/fixtures/space_invitation_updated.json
|
224
243
|
- spec/fixtures/space_invitations.json
|
@@ -246,6 +265,7 @@ files:
|
|
246
265
|
- spec/ribose/file_uploader_spec.rb
|
247
266
|
- spec/ribose/join_space_request_spec.rb
|
248
267
|
- spec/ribose/leaderboard_spec.rb
|
268
|
+
- spec/ribose/member_role_spec.rb
|
249
269
|
- spec/ribose/member_spec.rb
|
250
270
|
- spec/ribose/message_spec.rb
|
251
271
|
- spec/ribose/profile_spec.rb
|
@@ -283,7 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
283
303
|
version: '0'
|
284
304
|
requirements: []
|
285
305
|
rubyforge_project:
|
286
|
-
rubygems_version: 2.
|
306
|
+
rubygems_version: 2.6.14
|
287
307
|
signing_key:
|
288
308
|
specification_version: 4
|
289
309
|
summary: The Ruby interface for Ribose API
|