ribose 0.3.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.adoc ADDED
@@ -0,0 +1,842 @@
1
+ = Ribose
2
+
3
+ image:https://travis-ci.org/riboseinc/ribose-ruby.svg?branch=master[Build Status,link=https://travis-ci.org/riboseinc/ribose-ruby] image:https://codeclimate.com/github/riboseinc/ribose-ruby/badges/gpa.svg[Code Climate,link=https://codeclimate.com/github/riboseinc/ribose-ruby] image:https://badge.fury.io/rb/ribose.svg[Gem Version,link=https://badge.fury.io/rb/ribose]
4
+
5
+ The Ruby Interface to the Ribose API.
6
+
7
+ == Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ [source,ruby]
12
+ ----
13
+ gem "ribose"
14
+ ----
15
+
16
+ And then execute:
17
+
18
+ [source,sh]
19
+ ----
20
+ $ bundle install
21
+ ----
22
+
23
+ Or install it yourself as:
24
+
25
+ [source,sh]
26
+ ----
27
+ $ gem install ribose
28
+ ----
29
+
30
+ == Configure
31
+
32
+ We need to setup Ribose API configuration before we can perform any request throughout this client
33
+
34
+ First, obtain an API token https://github.com/riboseinc/ribose-api/wiki/Obtaining-the-API-Token[as per this Github wiki].
35
+ Using the token, configure the client by adding an initializer with the following code:
36
+
37
+ [source,ruby]
38
+ ----
39
+ Ribose.configure do |config|
40
+ config.user_email = "your-email@example.com"
41
+ config.user_password = "your-password"
42
+
43
+ # INFRA_ID is a 7-digit id, which can be found from the network requests
44
+ # e.g. ed6af7b for current production environment
45
+ config.api_host = URI.parse('https://app-INFRA_ID.ribose.com')
46
+
47
+ # There are also some default configurations. Normally you do not need to
48
+ # change those unless you have some very specific use cases.
49
+ #
50
+ # config.debug_mode = false
51
+ # config.api_host = "www.ribose.com"
52
+
53
+ # Deprecated
54
+ # config.api_token = "SECRET_API_TOKEN"
55
+ # config.api_email = "your-email@example.com"
56
+ end
57
+ ----
58
+
59
+ Or:
60
+
61
+ [source,ruby]
62
+ ----
63
+ Ribose.configuration.api_host = "https://app-INFRA_ID.ribose.com"
64
+ Ribose.configuration.user_email = "your-email@example.com"
65
+ Ribose.configuration.user_password = "your-password"
66
+ ```
67
+ =======
68
+ ----
69
+
70
+ == Usage
71
+
72
+ === App Data
73
+
74
+ ==== List app data
75
+
76
+ App data can be retrieved using the `AppData.all` interface.
77
+
78
+ [source,ruby]
79
+ ----
80
+ Ribose::AppData.all
81
+ ----
82
+
83
+ === App Relation
84
+
85
+ ==== List app relations
86
+
87
+ To retrieve the list of app relations, we can use the `AppRelation.all` interface.
88
+
89
+ [source,ruby]
90
+ ----
91
+ Ribose::AppRelation.all
92
+ ----
93
+
94
+ ==== Fetch an app relation
95
+
96
+ To retrieve the details for a specific app relation, we can use the following interface.
97
+
98
+ [source,ruby]
99
+ ----
100
+ Ribose::AppRelation.fetch(app_relation_id)
101
+ ----
102
+
103
+ === Profile
104
+
105
+ ==== Fetch user profile
106
+
107
+ [source,ruby]
108
+ ----
109
+ Ribose::Profile.fetch
110
+ ----
111
+
112
+ ==== Update user profile
113
+
114
+ [source,ruby]
115
+ ----
116
+ Ribose::Profile.update(first_name: "John", last_name: "Doe")
117
+ ----
118
+
119
+ ==== Set user login
120
+
121
+ [source,ruby]
122
+ ----
123
+ Ribose::Profile.set_login(login_name)
124
+ ----
125
+
126
+ === Settings
127
+
128
+ ==== List user's settings
129
+
130
+ To list user's settings we can use the `Setting.all` interface, and it will return all of the user's settings.
131
+
132
+ [source,ruby]
133
+ ----
134
+ Ribose::Setting.all
135
+ ----
136
+
137
+ ==== Fetch a setting
138
+
139
+ To fetch the details for any specific settings we can use the `Setting.fetch` interface with the specific Setting ID, and it will return the details for that setting.
140
+
141
+ [source,ruby]
142
+ ----
143
+ Ribose::Setting.fetch(setting_id)
144
+ ----
145
+
146
+ ==== Update a setting
147
+
148
+ [source,ruby]
149
+ ----
150
+ Ribose::Setting.update(setting_id, **new_updated_attributes_hash)
151
+ ----
152
+
153
+ === Spaces
154
+
155
+ ==== List user's Spaces
156
+
157
+ To list a user's Spaces we can use the `Space.all` interface, and it will retrieve all of the Spaces for the currently configured user.
158
+
159
+ [source,ruby]
160
+ ----
161
+ Ribose::Space.all
162
+ ----
163
+
164
+ ==== Fetch a user Space
165
+
166
+ To retrieve the details for a Space we can use the `Space.fetch(space_id)`.
167
+
168
+ [source,ruby]
169
+ ----
170
+ Ribose::Space.fetch(space_id)
171
+ ----
172
+
173
+ ==== Create a user Space
174
+
175
+ To create a new user Space,
176
+
177
+ [source,ruby]
178
+ ----
179
+ Ribose::Space.create(
180
+ access: "private",
181
+ space_category_id: 12,
182
+ name: "The amazing Ribose Space",
183
+ description: "Description about your Space"
184
+ )
185
+ ----
186
+
187
+ ==== Update a user Space
188
+
189
+ [source,ruby]
190
+ ----
191
+ Ribose::Space.update("space_uuid", name: "New updated name", **other_attributes)
192
+ ----
193
+
194
+ ==== Remove a user Space
195
+
196
+ To remove an existing Space,
197
+
198
+ [source,ruby]
199
+ ----
200
+ Ribose::Space.remove(space_uuid, confirmation: true)
201
+ ----
202
+
203
+ === Members
204
+
205
+ The members endpoint are Space-specific.
206
+
207
+ To retrieve the member details under any specific Space, we can use this interface.
208
+
209
+ ==== List space members
210
+
211
+ To retrieve the list of members,
212
+
213
+ [source,ruby]
214
+ ----
215
+ Ribose::Member.all(space_id, options)
216
+ ----
217
+
218
+ ==== Delete a space member
219
+
220
+ [source,ruby]
221
+ ----
222
+ Ribose::Member.delete(space_id, member_id, options)
223
+ ----
224
+
225
+ ==== Fetch Member Role
226
+
227
+ [source,ruby]
228
+ ----
229
+ Ribose::MemberRole.fetch(space_id, member_id, options)
230
+ ----
231
+
232
+ ==== Assign a role to member
233
+
234
+ [source,ruby]
235
+ ----
236
+ Ribose::MemberRole.assign(space_id, member_id, role_id)
237
+ ----
238
+
239
+ === Files
240
+
241
+ ==== List of Files
242
+
243
+ To retrieve the list of files for any specific Space,
244
+
245
+ [source,ruby]
246
+ ----
247
+ Ribose::SpaceFile.all(space_id, options)
248
+ ----
249
+
250
+ ==== Fetch a file details
251
+
252
+ [source,ruby]
253
+ ----
254
+ Ribose::SpaceFile.fetch(space_id, file_id, options = {})
255
+ ----
256
+
257
+ ==== Fetch a file icon
258
+
259
+ [source,ruby]
260
+ ----
261
+ Ribose::SpaceFile.fetch_icon(space_id, file_id, options = {})
262
+ ----
263
+
264
+ ==== Create a file upload
265
+
266
+ [source,ruby]
267
+ ----
268
+ Ribose::SpaceFile.create(space_id, file: "The complete file path", **attributes)
269
+ ----
270
+
271
+ ==== Update a space file
272
+
273
+ [source,ruby]
274
+ ----
275
+ Ribose::SpaceFile.update(space_id, file_id, new_file_attributes = {})
276
+ ----
277
+
278
+ ==== Remove a space file
279
+
280
+ [source,ruby]
281
+ ----
282
+ Ribose::SpaceFile.delete(space_id, file_id)
283
+ ----
284
+
285
+ === File Version
286
+
287
+ ==== Fetch file version
288
+
289
+ [source,ruby]
290
+ ----
291
+ Ribose::FileVersion.fetch(
292
+ space_id: space_id, file_id: file_id, version_id: version_id
293
+ )
294
+ ----
295
+
296
+ ==== Create a new file version
297
+
298
+ [source,ruby]
299
+ ----
300
+ Ribose::FileVersion.create(
301
+ space_id: your_space_id,
302
+ file_id: existing_file_id_in_space,
303
+ file: file_path_for_the_new_version,
304
+
305
+ **any_other_additional_attributes
306
+ )
307
+ ----
308
+
309
+ === Conversations
310
+
311
+ ==== Listing Space Conversations
312
+
313
+ [source,ruby]
314
+ ----
315
+ Ribose::Conversation.all(space_id, options = {})
316
+ ----
317
+
318
+ ==== Retrieve a conversation details
319
+
320
+ [source,ruby]
321
+ ----
322
+ Ribose::Conversation.fetch(space_id, conversation_id)
323
+ ----
324
+
325
+ ==== Create A New Conversation
326
+
327
+ [source,ruby]
328
+ ----
329
+ Ribose::Conversation.create(
330
+ space_id, name: "Sample conversation", tag_list: "sample, conversation"
331
+ )
332
+ ----
333
+
334
+ ==== Update a conversation
335
+
336
+ [source,ruby]
337
+ ----
338
+ Ribose::Conversation.update(space_id, conversation_id, new_attributes_hash)
339
+ ----
340
+
341
+ ==== Remove A Conversation
342
+
343
+ [source,ruby]
344
+ ----
345
+ Ribose::Conversation.destroy(space_id: "space_id", conversation_id: "12345")
346
+ ----
347
+
348
+ ==== Mark a conversation as favorite
349
+
350
+ [source,ruby]
351
+ ----
352
+ Ribose::Conversation.mark_as_favorite(space_id, conversation_id)
353
+ ----
354
+
355
+ === Message
356
+
357
+ ==== List Conversation Messages
358
+
359
+ [source,ruby]
360
+ ----
361
+ Ribose::Message.all(space_id: space_uuid, conversation_id: conversation_uuid)
362
+ ----
363
+
364
+ ==== Create a new message
365
+
366
+ [source,ruby]
367
+ ----
368
+ Ribose::Message.create(
369
+ space_id: space_uuid,
370
+ conversation_id: conversation_uuid,
371
+ contents: "Provide your message body here",
372
+ )
373
+ ----
374
+
375
+ ==== Update an existing message
376
+
377
+ [source,ruby]
378
+ ----
379
+ Ribose::Message.update(
380
+ space_id: space_uuid,
381
+ message_id: message_uuid,
382
+ conversation_id: conversation_uuid,
383
+ contents: "The new content for message",
384
+ )
385
+ ----
386
+
387
+ ==== Remove a message
388
+
389
+ [source,ruby]
390
+ ----
391
+ Ribose::Message.remove(
392
+ space_id: space_uuid,
393
+ message_id: message_uuid,
394
+ conversation_id: conversation_uuid,
395
+ )
396
+ ----
397
+
398
+ === Feeds
399
+
400
+ ==== List user feeds
401
+
402
+ To retrieve the list of user feeds,
403
+
404
+ [source,ruby]
405
+ ----
406
+ Ribose::Feed.all
407
+ ----
408
+
409
+ === Widgets
410
+
411
+ ==== List widgets
412
+
413
+ To retrieve the list of widgets,
414
+
415
+ [source,ruby]
416
+ ----
417
+ Ribose::Widget.all
418
+ ----
419
+
420
+ === Stream
421
+
422
+ ==== List of stream notifications
423
+
424
+ To retrieve the list of notifications,
425
+
426
+ [source,ruby]
427
+ ----
428
+ Ribose::Stream.all
429
+ ----
430
+
431
+ === Leaderboard
432
+
433
+ ==== Retrieve the current leadership board
434
+
435
+ To retrieve the current leadership board,
436
+
437
+ [source,ruby]
438
+ ----
439
+ Ribose::Leaderboard.all
440
+ ----
441
+
442
+ === Connections
443
+
444
+ ==== List of connections
445
+
446
+ To retrieve the list of connections, we can use the `Connection.all` interface and it will return the connection as `Sawyer::Resource`.
447
+
448
+ [source,ruby]
449
+ ----
450
+ Ribose::Connection.all
451
+ ----
452
+
453
+ ==== Disconnect a connection
454
+
455
+ To disconnect with an existing connection, we can use `Connection.disconnect` interface as following.
456
+ This expect us to provide the connection id, and it also support an additional options hash to provide custom options.
457
+
458
+ [source,ruby]
459
+ ----
460
+ Ribose::Connection.disconnect(connection_id, options)
461
+ ----
462
+
463
+ ==== Connection suggestions
464
+
465
+ To retrieve the list of user connection suggestions,
466
+
467
+ [source,ruby]
468
+ ----
469
+ Ribose::Connection.suggestions
470
+ ----
471
+
472
+ === Invitations
473
+
474
+ ==== List connection invitations
475
+
476
+ [source,ruby]
477
+ ----
478
+ Ribose::ConnectionInvitation.all
479
+ ----
480
+
481
+ ==== List Space invitations
482
+
483
+ [source,ruby]
484
+ ----
485
+ Ribose::SpaceInvitation.all
486
+ ----
487
+
488
+ ==== Fetch a connection invitation
489
+
490
+ [source,ruby]
491
+ ----
492
+ Ribose::ConnectionInvitation.fetch(invitation_id)
493
+ ----
494
+
495
+ ==== Create mass connection invitations
496
+
497
+ [source,ruby]
498
+ ----
499
+ Ribose::ConnectionInvitation.create(
500
+ emails: ["email-one@example.com", "email-two@example.com"],
501
+ body: "This contains the details message about the invitation",
502
+ )
503
+ ----
504
+
505
+ ==== Accept a connection invitation
506
+
507
+ [source,ruby]
508
+ ----
509
+ Ribose::ConnectionInvitation.accept(invitation_id)
510
+ ----
511
+
512
+ ==== Reject a connection invitation
513
+
514
+ [source,ruby]
515
+ ----
516
+ Ribose::ConnectionInvitation.reject(invitation_id)
517
+ ----
518
+
519
+ ==== Cancel a connection invitation
520
+
521
+ [source,ruby]
522
+ ----
523
+ Ribose::ConnectionInvitation.cancel(invitation_id)
524
+ ----
525
+
526
+ ==== Invite user to a Space
527
+
528
+ [source,ruby]
529
+ ----
530
+ Ribose::SpaceInvitation.create(
531
+ state: "0",
532
+ space_id: "123_456_789",
533
+ invitee_id: "456_789_012",
534
+ type: "Invitation::ToSpace",
535
+ body: "Please join to this amazing Space",
536
+ )
537
+ ----
538
+
539
+ ==== Create Space invitation - Mass
540
+
541
+ [source,ruby]
542
+ ----
543
+ Ribose::SpaceInvitation.mass_create(
544
+ space_id,
545
+ emails: ["email-one@example.com"],
546
+ role_ids: ["role-for-email-address-in-sequance"],
547
+ body: "The complete message body for the invitation",
548
+ )
549
+ ----
550
+
551
+ ==== Update a Space invitation
552
+
553
+ [source,ruby]
554
+ ----
555
+ Ribose::SpaceInvitation.update(invitation_id, new_attributes_hash)
556
+ ----
557
+
558
+ ==== Accept a Space invitation
559
+
560
+ [source,ruby]
561
+ ----
562
+ Ribose::SpaceInvitation.accept(invitation_id)
563
+ ----
564
+
565
+ ==== Resend a Space invitation
566
+
567
+ [source,ruby]
568
+ ----
569
+ Ribose::SpaceInvitation.resend(invitation_id)
570
+ ----
571
+
572
+ ==== Reject a Space invitation
573
+
574
+ [source,ruby]
575
+ ----
576
+ Ribose::SpaceInvitation.reject(invitation_id)
577
+ ----
578
+
579
+ ==== Cancel a Space invitation
580
+
581
+ [source,ruby]
582
+ ----
583
+ Ribose::SpaceInvitation.cancel(invitation_id)
584
+ ----
585
+
586
+ === Join Space Request
587
+
588
+ ==== List Join Space Requests
589
+
590
+ [source,ruby]
591
+ ----
592
+ Ribose::JoinSpaceRequest.all
593
+ ----
594
+
595
+ ==== Fetch a join space request
596
+
597
+ [source,ruby]
598
+ ----
599
+ Ribose::JoinSpaceRequest.fetch(request_id)
600
+ ----
601
+
602
+ ==== Create a Join Space Request
603
+
604
+ [source,ruby]
605
+ ----
606
+ Ribose::JoinSpaceRequest.create(
607
+ state: 0,
608
+ Space_id: 123_456_789,
609
+ type: "Invitation::JoinSpaceRequest",
610
+ body: "Hi, I would like to join to your Space",
611
+ )
612
+ ----
613
+
614
+ ==== Accept a Join Space Request
615
+
616
+ [source,ruby]
617
+ ----
618
+ Ribose::JoinSpaceRequest.accept(invitation_id)
619
+ ----
620
+
621
+ ==== Reject a Join Space Requests
622
+
623
+ [source,ruby]
624
+ ----
625
+ Ribose::JoinSpaceRequest.reject(invitation_id)
626
+ ----
627
+
628
+ ==== Update an Join Space Requests
629
+
630
+ [source,ruby]
631
+ ----
632
+ Ribose::JoinSpaceRequest.update(invitation_id, new_attributes_hash)
633
+ ----
634
+
635
+ === Calendar
636
+
637
+ ==== List user calendars
638
+
639
+ To retrieve the list of calendars accessible to the current user,
640
+
641
+ [source,ruby]
642
+ ----
643
+ Ribose::Calendar.all
644
+ ----
645
+
646
+ ==== Fetch a calendar events
647
+
648
+ [source,ruby]
649
+ ----
650
+ Ribose::Calendar.fetch(calendar_ids, start: Data.today, length: 7)
651
+ ----
652
+
653
+ ==== Create a calendar
654
+
655
+ [source,ruby]
656
+ ----
657
+ Ribose::Calendar.create(
658
+ owner_type: "User",
659
+ owner_id: "The Owner UUID",
660
+ name: "The name for the calendar",
661
+ )
662
+ ----
663
+
664
+ ==== Delete a calendar
665
+
666
+ [source,ruby]
667
+ ----
668
+ Ribose::Calendar.delete(calendar_id)
669
+ ----
670
+
671
+ === Event
672
+
673
+ ==== List calendar events
674
+
675
+ [source,ruby]
676
+ ----
677
+ Ribose::Event.all(calendar_id)
678
+ ----
679
+
680
+ ==== Fetch a calendar event
681
+
682
+ [source,ruby]
683
+ ----
684
+ Ribose::Event.fetch(calendar_id, event_id)
685
+ ----
686
+
687
+ ==== Create a calendar event
688
+
689
+ [source,ruby]
690
+ ----
691
+ Ribose::Event.create(
692
+ calendar_id,
693
+ name: "Sample Event",
694
+ date_start: "04/04/2018",
695
+ time_start: "4:30pm",
696
+ date_finish: "04/04/2018",
697
+ time_finish: "5:30pm",
698
+ recurring_type: "not_repeat",
699
+ until: "never",
700
+ repeat_every: "1",
701
+ where: "Skype",
702
+ description: "Sample event",
703
+ all_day: false,
704
+ )
705
+ ----
706
+
707
+ ==== Update a calendar event
708
+
709
+ [source,ruby]
710
+ ----
711
+ Ribose::Event.update(
712
+ calendar_id, event_id, new_attributes_hash, options_params
713
+ )
714
+ ----
715
+
716
+ ==== Delete a calendar event
717
+
718
+ [source,ruby]
719
+ ----
720
+ Ribose::Event.delete(calendar_id, event_id)
721
+ ----
722
+
723
+ === User
724
+
725
+ ==== Create a signup request
726
+
727
+ [source,ruby]
728
+ ----
729
+ Ribose::User.create(email: "user@example.com", **other_attributes)
730
+ ----
731
+
732
+ ==== Activate a signup request
733
+
734
+ [source,ruby]
735
+ ----
736
+ Ribose::User.activate(
737
+ email: "user@example.com",
738
+ password: "ASecureUserPassword",
739
+ otp: "OTP Recived via the Email",
740
+ )
741
+ ----
742
+
743
+ === Wikis
744
+
745
+ ==== List wiki pages
746
+
747
+ [source,ruby]
748
+ ----
749
+ Ribose::Wiki.all(space_id, options = {})
750
+ ----
751
+
752
+ ==== Fetch a wiki page
753
+
754
+ [source,ruby]
755
+ ----
756
+ Ribose::Wiki.fetch(space_id, wiki_id, options = {})
757
+ ----
758
+
759
+ ==== Create a wiki page
760
+
761
+ [source,ruby]
762
+ ----
763
+ Ribose::Wiki.create(
764
+ space_id, name: "Wiki Name", tag_list: "sample", **other_attributes_hash
765
+ )
766
+ ----
767
+
768
+ ==== Update a wiki page
769
+
770
+ [source,ruby]
771
+ ----
772
+ Ribose::Wiki.update(
773
+ space_id, wiki_id, **updated_attributes_hash
774
+ )
775
+ ----
776
+
777
+ ==== Remove a wiki page
778
+
779
+ [source,ruby]
780
+ ----
781
+ Ribose::Wiki.delete(space_id, wiki_id)
782
+ ----
783
+
784
+ === Space categories
785
+
786
+ ==== List space categories
787
+
788
+ [source,ruby]
789
+ ----
790
+ Ribose::SpaceCategory.all
791
+ ----
792
+
793
+ == Development
794
+
795
+ We are following Sandi Metz's Rules for this gem, you can read the http://robots.thoughtbot.com/post/50655960596/sandi-metz-rules-for-developers[description of the rules here] All new code should follow these rules.
796
+ If you make changes in a pre-existing file that violates these rules you should fix the violations as part of your contribution.
797
+
798
+ === Setup
799
+
800
+ Clone the repository.
801
+
802
+ [source,sh]
803
+ ----
804
+ git clone https://github.com/riboseinc/ribose-ruby
805
+ ----
806
+
807
+ Setup your environment.
808
+
809
+ [source,sh]
810
+ ----
811
+ bin/setup
812
+ ----
813
+
814
+ Run the test suite
815
+
816
+ [source,sh]
817
+ ----
818
+ bin/rspec
819
+ ----
820
+
821
+ == Contributing
822
+
823
+ First, thank you for contributing!
824
+ We love pull requests from everyone.
825
+ By participating in this project, you hereby grant https://www.ribose.com[Ribose Inc.] the right to grant or transfer an unlimited number of non exclusive licenses or sub-licenses to third parties, under the copyright covering the contribution to use the contribution by all means.
826
+
827
+ Here are a few technical guidelines to follow:
828
+
829
+ . Open an https://github.com/riboseinc/ribose-ruby/issues[issue] to discuss a new feature.
830
+ . Write tests to support your new feature.
831
+ . Make sure the entire test suite passes locally and on CI.
832
+ . Open a Pull Request.
833
+ . https://github.com/thoughtbot/guides/tree/master/protocol/git#write-a-feature[Squash your commits] after receiving feedback.
834
+ . Party!
835
+
836
+ == Credits
837
+
838
+ This gem is developed, maintained and funded by https://www.ribose.com[Ribose Inc.]
839
+
840
+ == License
841
+
842
+ The gem is available as open source under the terms of the http://opensource.org/licenses/MIT[MIT License].