ribose 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +539 -970
  4. data/.sample.pryrc +4 -0
  5. data/CHANGELOG.md +5 -0
  6. data/README.md +539 -3
  7. data/bin/console +2 -5
  8. data/lib/ribose.rb +31 -1
  9. data/lib/ribose/actions.rb +10 -0
  10. data/lib/ribose/actions/all.rb +43 -0
  11. data/lib/ribose/actions/base.rb +11 -0
  12. data/lib/ribose/actions/create.rb +44 -0
  13. data/lib/ribose/actions/delete.rb +32 -0
  14. data/lib/ribose/actions/fetch.rb +44 -0
  15. data/lib/ribose/actions/update.rb +35 -0
  16. data/lib/ribose/app_data.rb +15 -0
  17. data/lib/ribose/app_relation.rb +12 -0
  18. data/lib/ribose/base.rb +48 -0
  19. data/lib/ribose/calendar.rb +22 -0
  20. data/lib/ribose/client.rb +31 -0
  21. data/lib/ribose/config.rb +21 -0
  22. data/lib/ribose/configuration.rb +25 -0
  23. data/lib/ribose/connection.rb +39 -0
  24. data/lib/ribose/connection_invitation.rb +51 -0
  25. data/lib/ribose/conversation.rb +87 -0
  26. data/lib/ribose/error.rb +30 -0
  27. data/lib/ribose/feed.rb +11 -0
  28. data/lib/ribose/file_uploader.rb +93 -0
  29. data/lib/ribose/join_space_request.rb +41 -0
  30. data/lib/ribose/leaderboard.rb +19 -0
  31. data/lib/ribose/member.rb +34 -0
  32. data/lib/ribose/message.rb +94 -0
  33. data/lib/ribose/profile.rb +56 -0
  34. data/lib/ribose/request.rb +122 -0
  35. data/lib/ribose/resource_helper.rb +81 -0
  36. data/lib/ribose/response/raise_error.rb +15 -0
  37. data/lib/ribose/rspec.rb +19 -0
  38. data/lib/ribose/session.rb +48 -0
  39. data/lib/ribose/setting.rb +16 -0
  40. data/lib/ribose/space.rb +30 -0
  41. data/lib/ribose/space_file.rb +49 -0
  42. data/lib/ribose/space_invitation.rb +70 -0
  43. data/lib/ribose/stream.rb +15 -0
  44. data/lib/ribose/user.rb +42 -0
  45. data/lib/ribose/version.rb +1 -1
  46. data/lib/ribose/widget.rb +11 -0
  47. data/lib/ribose/wiki.rb +80 -0
  48. data/ribose.gemspec +6 -0
  49. data/spec/fixtures/app_data.json +188 -0
  50. data/spec/fixtures/app_relation.json +19 -0
  51. data/spec/fixtures/app_relations.json +89 -0
  52. data/spec/fixtures/calendar.json +12 -0
  53. data/spec/fixtures/calendars.json +34 -0
  54. data/spec/fixtures/connection_invitation.json +26 -0
  55. data/spec/fixtures/connection_invitation_accepted.json +26 -0
  56. data/spec/fixtures/connection_invitations.json +28 -0
  57. data/spec/fixtures/connection_invitations_created.json +37 -0
  58. data/spec/fixtures/connection_suggestion.json +22 -0
  59. data/spec/fixtures/connections.json +28 -0
  60. data/spec/fixtures/conversation.json +26 -0
  61. data/spec/fixtures/conversation_created.json +31 -0
  62. data/spec/fixtures/conversations.json +34 -0
  63. data/spec/fixtures/empty.json +1 -0
  64. data/spec/fixtures/feeds.json +84 -0
  65. data/spec/fixtures/file_upload_prepared.json +17 -0
  66. data/spec/fixtures/file_uploaded.json +38 -0
  67. data/spec/fixtures/general_information.json +16 -0
  68. data/spec/fixtures/join_space_request_created.json +26 -0
  69. data/spec/fixtures/join_space_request_updated.json +25 -0
  70. data/spec/fixtures/join_space_requests.json +34 -0
  71. data/spec/fixtures/leaderboard.json +21 -0
  72. data/spec/fixtures/login.html +323 -0
  73. data/spec/fixtures/members.json +20 -0
  74. data/spec/fixtures/message.json +22 -0
  75. data/spec/fixtures/messages.json +24 -0
  76. data/spec/fixtures/ping.json +3 -0
  77. data/spec/fixtures/profile.json +10 -0
  78. data/spec/fixtures/sample.png +0 -0
  79. data/spec/fixtures/setting.json +16 -0
  80. data/spec/fixtures/settings.json +18 -0
  81. data/spec/fixtures/space.json +59 -0
  82. data/spec/fixtures/space_created.json +59 -0
  83. data/spec/fixtures/space_file.json +58 -0
  84. data/spec/fixtures/space_invitation.json +32 -0
  85. data/spec/fixtures/space_invitation_updated.json +35 -0
  86. data/spec/fixtures/space_invitations.json +34 -0
  87. data/spec/fixtures/space_mass_invitations.json +46 -0
  88. data/spec/fixtures/spaces.json +61 -0
  89. data/spec/fixtures/stream.json +176 -0
  90. data/spec/fixtures/user_activated.json +6 -0
  91. data/spec/fixtures/widgets.json +50 -0
  92. data/spec/fixtures/wiki.json +79 -0
  93. data/spec/fixtures/wikis.json +197 -0
  94. data/spec/ribose/actions/create_spec.rb +40 -0
  95. data/spec/ribose/actions/delete_spec.rb +24 -0
  96. data/spec/ribose/actions/fetch_spec.rb +32 -0
  97. data/spec/ribose/actions/update_spec.rb +36 -0
  98. data/spec/ribose/app_data_spec.rb +15 -0
  99. data/spec/ribose/app_relation_spec.rb +27 -0
  100. data/spec/ribose/calendar_spec.rb +50 -0
  101. data/spec/ribose/client_spec.rb +48 -0
  102. data/spec/ribose/config_spec.rb +41 -0
  103. data/spec/ribose/connection_invitation_spec.rb +79 -0
  104. data/spec/ribose/connection_spec.rb +26 -0
  105. data/spec/ribose/conversation_spec.rb +84 -0
  106. data/spec/ribose/error_spec.rb +67 -0
  107. data/spec/ribose/feed_spec.rb +14 -0
  108. data/spec/ribose/file_uploader_spec.rb +30 -0
  109. data/spec/ribose/join_space_request_spec.rb +70 -0
  110. data/spec/ribose/leaderboard_spec.rb +13 -0
  111. data/spec/ribose/member_spec.rb +16 -0
  112. data/spec/ribose/message_spec.rb +69 -0
  113. data/spec/ribose/profile_spec.rb +40 -0
  114. data/spec/ribose/request_spec.rb +66 -0
  115. data/spec/ribose/resource_helper_spec.rb +58 -0
  116. data/spec/ribose/session_spec.rb +46 -0
  117. data/spec/ribose/setting_spec.rb +40 -0
  118. data/spec/ribose/space_file_spec.rb +41 -0
  119. data/spec/ribose/space_invitation_spec.rb +117 -0
  120. data/spec/ribose/space_spec.rb +70 -0
  121. data/spec/ribose/stream_spec.rb +14 -0
  122. data/spec/ribose/user_spec.rb +48 -0
  123. data/spec/ribose/widget_spec.rb +14 -0
  124. data/spec/ribose/wiki_spec.rb +67 -0
  125. data/spec/spec_helper.rb +11 -0
  126. data/spec/support/fake_ribose_api.rb +431 -0
  127. data/spec/support/file_upload_stub.rb +76 -0
  128. metadata +190 -3
  129. data/spec/ribose_spec.rb +0 -4
@@ -0,0 +1,20 @@
1
+ {
2
+ "spaces_users": [
3
+ {
4
+ "id": 19625,
5
+ "user_id": "63116bd1-c08d-4a4d-8332-fcdaecb13e34",
6
+ "space_id": "0e8d5c16-1a31-4df9-83d9-eeaa374d5adc",
7
+ "role_name_in_space": "Administrator",
8
+ "user": {
9
+ "id": "63116bd1-c08d-4a4d-8332-fcdaecb13e34",
10
+ "owner": true,
11
+ "admin": true,
12
+ "connected": true,
13
+ "mutual_spaces": [
14
+ "0e8d5c16-1a31-4df9-83d9-eeaa374d5adc"
15
+ ],
16
+ "name": "John Doe"
17
+ }
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "message": {
3
+ "id": "9af4df9f-2a30-4d66-a925-efaf45057ae4",
4
+ "conversation_id": "0c88ffab-bc5e-4243-86cc-584df87f192b",
5
+ "created_at": "2017-09-04T09:46:42.223+00:00",
6
+ "updated_at": "2017-09-04T09:46:42.223+00:00",
7
+ "contents": "Welcome to Ribose",
8
+ "attachments_listed": [],
9
+ "attachments_inline": [],
10
+ "allow_edit": true,
11
+ "allow_delete": true,
12
+ "user": {
13
+ "id": "63116bd1-c08d-4a4d-8332-fcdaecb13e34",
14
+ "name": "John Doe",
15
+ "connected": true,
16
+ "mutual_spaces": [
17
+ "268b0407-c3a3-4aad-8693-fdba789f7f0d",
18
+ "0e8d5c16-1a31-4df9-83d9-eeaa374d5adc"
19
+ ]
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "messages": [
3
+ {
4
+ "id": "eec38935-3070-4949-b217-878aa07db699",
5
+ "conversation_id": "0c88ffab-bc5e-4243-86cc-584df87f192b",
6
+ "created_at": "2017-09-04T07:30:48.000+00:00",
7
+ "updated_at": "2017-09-04T07:30:48.000+00:00",
8
+ "contents": "Welcome to Ribose Space",
9
+ "attachments_listed": [],
10
+ "attachments_inline": [],
11
+ "allow_edit": true,
12
+ "allow_delete": true,
13
+ "user": {
14
+ "id": "63116bd1-c08d-4a4d-8332-fcdaecb13e34",
15
+ "name": "John Doe",
16
+ "connected": true,
17
+ "mutual_spaces": [
18
+ "268b0407-c3a3-4aad-8693-fdba789f7f0d",
19
+ "0e8d5c16-1a31-4df9-83d9-eeaa374d5adc"
20
+ ]
21
+ }
22
+ }
23
+ ]
24
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "data": "Pong!"
3
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "user": {
3
+ "id": 12345,
4
+ "first_name": "John",
5
+ "last_name": "Doe",
6
+ "user_id": "63116bd1",
7
+ "fields": {},
8
+ "name": "John Doe"
9
+ }
10
+ }
Binary file
@@ -0,0 +1,16 @@
1
+ {
2
+ "setting": {
3
+ "id": 123456789,
4
+ "type": "Setting::Personal",
5
+ "user_id": "63116bd1-c08d-4a4d-8332-fcdaecb13e34",
6
+ "time_zone": "Asia/Bangkok",
7
+ "help_getting_started": false,
8
+ "time_format": "%H:%M",
9
+ "date_format": "%Y-%m-%d",
10
+ "theme_id": "6",
11
+ "time_zone_offset": 7,
12
+ "time_zone_detected": "Asia/Bangkok",
13
+ "time_zone_offset_detected": 25200,
14
+ "time_zone_autodetect_status": 0
15
+ }
16
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "settings": [
3
+ {
4
+ "id": 1234,
5
+ "type": "Setting::Personal",
6
+ "user_id": "12345678",
7
+ "time_zone": "Asia/Bangkok",
8
+ "help_getting_started": false,
9
+ "time_format": "%H:%M",
10
+ "date_format": "%Y-%m-%d",
11
+ "theme_id": "6",
12
+ "time_zone_offset": 7,
13
+ "time_zone_detected": "Asia/Bangkok",
14
+ "time_zone_offset_detected": 25200,
15
+ "time_zone_autodetect_status": 0
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "space": {
3
+ "id": "0e8d5c16-1a31-4df9-83d9-eeaa374d5adc",
4
+ "name": "Work",
5
+ "created_at": "2017-07-27T07:19:09.000+00:00",
6
+ "invite_access": "admins",
7
+ "space_category_id": null,
8
+ "visibility": "invisible",
9
+ "group_email": "work57",
10
+ "default_role_id": 41592,
11
+ "join_requests_access": "disabled",
12
+ "active": true,
13
+ "description": "Client work related discussion",
14
+ "members_count": 1,
15
+ "admin": true,
16
+ "invitable_roles": [
17
+ {
18
+ "id": 41592,
19
+ "name": "Member",
20
+ "space_id": "0e8d5c16-1a31-4df9-83d9-eeaa374d5adc"
21
+ },
22
+ {
23
+ "id": 41593,
24
+ "name": "Administrator",
25
+ "space_id": "0e8d5c16-1a31-4df9-83d9-eeaa374d5adc"
26
+ },
27
+ {
28
+ "id": 41594,
29
+ "name": "Read only",
30
+ "space_id": "0e8d5c16-1a31-4df9-83d9-eeaa374d5adc"
31
+ }
32
+ ],
33
+ "owner": true,
34
+ "read_only": false,
35
+ "role_name": "Administrator",
36
+ "allow_invite": true,
37
+ "joined_at": "2017-07-27T07:19:09.000+00:00",
38
+ "access": "private",
39
+ "publishable?": false,
40
+ "user": {
41
+ "id": "63116bd1-c08d-4a4d-8332-fcdaecb13e34",
42
+ "name": "John Doe"
43
+ },
44
+ "owned_roles": [
45
+ {
46
+ "id": 41592,
47
+ "name": "Member"
48
+ },
49
+ {
50
+ "id": 41593,
51
+ "name": "Administrator"
52
+ },
53
+ {
54
+ "id": 41594,
55
+ "name": "Read only"
56
+ }
57
+ ]
58
+ }
59
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "space": {
3
+ "id": "6b2741ad-4cde-4b4d-af3b-a162a4f6bc25",
4
+ "name": "Trip to the Mars",
5
+ "created_at": "2017-08-28T09:04:34.625+00:00",
6
+ "invite_access": "admins",
7
+ "space_category_id": 23,
8
+ "visibility": "invisible",
9
+ "group_email": "triptothemars",
10
+ "default_role_id": 41688,
11
+ "join_requests_access": "disabled",
12
+ "active": true,
13
+ "description": "The long awaited dream!",
14
+ "members_count": 1,
15
+ "admin": true,
16
+ "invitable_roles": [
17
+ {
18
+ "id": 41688,
19
+ "name": "Member",
20
+ "space_id": "6b2741ad-4cde-4b4d-af3b-a162a4f6bc25"
21
+ },
22
+ {
23
+ "id": 41689,
24
+ "name": "Administrator",
25
+ "space_id": "6b2741ad-4cde-4b4d-af3b-a162a4f6bc25"
26
+ },
27
+ {
28
+ "id": 41690,
29
+ "name": "Read only",
30
+ "space_id": "6b2741ad-4cde-4b4d-af3b-a162a4f6bc25"
31
+ }
32
+ ],
33
+ "owner": true,
34
+ "read_only": false,
35
+ "role_name": "Administrator",
36
+ "allow_invite": true,
37
+ "joined_at": "2017-08-28T09:04:34.000+00:00",
38
+ "access": "private",
39
+ "publishable?": false,
40
+ "user": {
41
+ "id": "63116bd1-c08d-4a4d-8332-fcdaecb13e34",
42
+ "name": "John Doe"
43
+ },
44
+ "owned_roles": [
45
+ {
46
+ "id": 41688,
47
+ "name": "Member"
48
+ },
49
+ {
50
+ "id": 41689,
51
+ "name": "Administrator"
52
+ },
53
+ {
54
+ "id": 41690,
55
+ "name": "Read only"
56
+ }
57
+ ]
58
+ }
59
+ }
@@ -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
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "to_space": {
3
+ "id": 27747,
4
+ "email": null,
5
+ "body": null,
6
+ "created_at": "2017-09-20T06:42:33.503+00:00",
7
+ "state": 0,
8
+ "role_id": 41745,
9
+ "type": "Invitation::ToSpace",
10
+ "updated_at": "2017-09-20T06:42:33.637Z",
11
+ "inviter": {
12
+ "id": "63116bd1-c08d-4a4d-8332-fcdaecb13e34",
13
+ "connected": true,
14
+ "name": "John Doe",
15
+ "mutual_spaces": [
16
+ "268b0407-c3a3-4aad-8693-fdba789f7f0d",
17
+ "0e8d5c16-1a31-4df9-83d9-eeaa374d5adc"
18
+ ]
19
+ },
20
+ "space": {
21
+ "id": "268b0407-c3a3-4aad-8693-fdba789f7f0d",
22
+ "name": "Trip to Mars!",
23
+ "members_count": 1
24
+ },
25
+ "invitee": {
26
+ "id": "2970d105-5ccc-4a8c-b0c4-ec32d539a00a",
27
+ "connected": true,
28
+ "name": "Jennie Doe",
29
+ "mutual_spaces": []
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "to_space": {
3
+ "id": 27743,
4
+ "email": null,
5
+ "body": "Jennie Doe invites you to join `The CLI Space'. Join now to start collaborating!",
6
+ "created_at": "2017-09-19T09:32:53.000+00:00",
7
+ "state": 1,
8
+ "role_id": 41739,
9
+ "type": "Invitation::ToSpace",
10
+ "updated_at": "2017-09-28T04:29:47.000+00:00",
11
+ "inviter": {
12
+ "id": "2970d105-5ccc-4a8c-b0c4-ec32d539a00a",
13
+ "connected": false,
14
+ "name": "Jennie Doe",
15
+ "mutual_spaces": [
16
+ "52e47e18-9a9d-4663-94c5-abcb18fa783a"
17
+ ]
18
+ },
19
+ "space": {
20
+ "id": "52e47e18-9a9d-4663-94c5-abcb18fa783a",
21
+ "name": "The CLI Space",
22
+ "members_count": 2
23
+ },
24
+ "invitee": {
25
+ "id": "63116bd1-c08d-4a4d-8332-fcdaecb13e34",
26
+ "connected": true,
27
+ "name": "John Doe",
28
+ "mutual_spaces": [
29
+ "268b0407-c3a3-4aad-8693-fdba789f7f0d",
30
+ "52e47e18-9a9d-4663-94c5-abcb18fa783a",
31
+ "0e8d5c16-1a31-4df9-83d9-eeaa374d5adc"
32
+ ]
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "to_spaces": [
3
+ {
4
+ "id": 27743,
5
+ "email": null,
6
+ "body": "John Doe invites you to join `The CLI Space'. Join now!",
7
+ "created_at": "2017-09-19T09:32:53.000+00:00",
8
+ "state": 0,
9
+ "role_id": 41739,
10
+ "type": "Invitation::ToSpace",
11
+ "updated_at": "2017-09-19T09:32:53.000+00:00",
12
+ "inviter": {
13
+ "id": "2970d105-5ccc-4a8c-b0c4-ec32d539a00a",
14
+ "connected": true,
15
+ "name": "Jennie Doe",
16
+ "mutual_spaces": []
17
+ },
18
+ "space": {
19
+ "id": "52e47e18-9a9d-4663-94c5-abcb18fa783a",
20
+ "name": "The CLI Space",
21
+ "members_count": 1
22
+ },
23
+ "invitee": {
24
+ "id": "63116bd1-c08d-4a4d-8332-fcdaecb13e34",
25
+ "connected": true,
26
+ "name": "Jennie Doe",
27
+ "mutual_spaces": [
28
+ "268b0407-c3a3-4aad-8693-fdba789f7f0d",
29
+ "0e8d5c16-1a31-4df9-83d9-eeaa374d5adc"
30
+ ]
31
+ }
32
+ }
33
+ ]
34
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "invitations": {
3
+ "success": {
4
+ "emails": {
5
+ "jennie.doe@example.com": {
6
+ "id": 27764,
7
+ "email": "jennie.doe@example.com",
8
+ "body": null,
9
+ "created_at": "2017-09-29T07:10:08.575+00:00",
10
+ "state": 0,
11
+ "role_id": 41745,
12
+ "type": "Invitation::ToSpace",
13
+ "updated_at": "2017-09-29T07:10:08.679+00:00",
14
+ "inviter": {
15
+ "id": "63116bd1-c08d-4a4d-8332-fcdaecb13e34",
16
+ "connected": true,
17
+ "name": "John Doe",
18
+ "mutual_spaces": [
19
+ "268b0407-c3a3-4aad-8693-fdba789f7f0d",
20
+ "52e47e18-9a9d-4663-94c5-abcb18fa783a",
21
+ "0e8d5c16-1a31-4df9-83d9-eeaa374d5adc"
22
+ ]
23
+ },
24
+ "space": {
25
+ "id": "268b0407-c3a3-4aad-8693-fdba789f7f0d",
26
+ "name": "Sample Space",
27
+ "members_count": 1
28
+ },
29
+ "invitee": {
30
+ "id": "2970d105-5ccc-4a8c-b0c4-ec32d539a00a",
31
+ "connected": false,
32
+ "name": "Jennie Doe",
33
+ "mutual_spaces": [
34
+ "52e47e18-9a9d-4663-94c5-abcb18fa783a"
35
+ ]
36
+ }
37
+ }
38
+ },
39
+ "user_ids": {}
40
+ },
41
+ "errors": {
42
+ "emails": {},
43
+ "user_ids": {}
44
+ }
45
+ }
46
+ }