mural-ruby 0.1.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.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ruby.yml +28 -0
  3. data/.ruby-version +1 -0
  4. data/README.md +126 -0
  5. data/Rakefile +16 -0
  6. data/UNLICENSE +24 -0
  7. data/img/draw-widget.png +0 -0
  8. data/img/inking-widget.png +0 -0
  9. data/img/mind-map.png +0 -0
  10. data/img/smart-planner.png +0 -0
  11. data/lib/mural/asset.rb +26 -0
  12. data/lib/mural/client/authentication.rb +75 -0
  13. data/lib/mural/client/mural_content/files.rb +40 -0
  14. data/lib/mural/client/mural_content/sticky_notes.rb +30 -0
  15. data/lib/mural/client/mural_content/tags.rb +48 -0
  16. data/lib/mural/client/mural_content/widgets.rb +33 -0
  17. data/lib/mural/client/mural_content.rb +30 -0
  18. data/lib/mural/client/murals.rb +138 -0
  19. data/lib/mural/client/rooms.rb +92 -0
  20. data/lib/mural/client/search.rb +55 -0
  21. data/lib/mural/client/templates.rb +77 -0
  22. data/lib/mural/client/users/mural_users.rb +67 -0
  23. data/lib/mural/client/users/room_users.rb +62 -0
  24. data/lib/mural/client/users.rb +38 -0
  25. data/lib/mural/client/workspaces.rb +33 -0
  26. data/lib/mural/client.rb +119 -0
  27. data/lib/mural/codec.rb +44 -0
  28. data/lib/mural/create_mural_params.rb +33 -0
  29. data/lib/mural/create_room_params.rb +16 -0
  30. data/lib/mural/create_sticky_note_params.rb +37 -0
  31. data/lib/mural/create_tag_params.rb +45 -0
  32. data/lib/mural/current_user.rb +21 -0
  33. data/lib/mural/duplicate_mural_params.rb +14 -0
  34. data/lib/mural/mural_board.rb +96 -0
  35. data/lib/mural/mural_export.rb +16 -0
  36. data/lib/mural/mural_invitation.rb +16 -0
  37. data/lib/mural/mural_invitation_params.rb +14 -0
  38. data/lib/mural/mural_user.rb +30 -0
  39. data/lib/mural/removed_mural_user.rb +14 -0
  40. data/lib/mural/removed_room_user.rb +14 -0
  41. data/lib/mural/room.rb +63 -0
  42. data/lib/mural/room_folder.rb +21 -0
  43. data/lib/mural/room_invitation.rb +16 -0
  44. data/lib/mural/room_invitation_params.rb +13 -0
  45. data/lib/mural/room_user.rb +17 -0
  46. data/lib/mural/search_mural_result.rb +21 -0
  47. data/lib/mural/search_room_result.rb +16 -0
  48. data/lib/mural/search_template_result.rb +18 -0
  49. data/lib/mural/tag.rb +25 -0
  50. data/lib/mural/template.rb +24 -0
  51. data/lib/mural/update_mural_params.rb +23 -0
  52. data/lib/mural/update_room_params.rb +15 -0
  53. data/lib/mural/update_room_user_params.rb +16 -0
  54. data/lib/mural/update_sticky_note_params.rb +24 -0
  55. data/lib/mural/update_tag_params.rb +22 -0
  56. data/lib/mural/version.rb +5 -0
  57. data/lib/mural/widget/area.rb +53 -0
  58. data/lib/mural/widget/arrow.rb +139 -0
  59. data/lib/mural/widget/comment.rb +92 -0
  60. data/lib/mural/widget/create_file_params.rb +56 -0
  61. data/lib/mural/widget/file.rb +34 -0
  62. data/lib/mural/widget/icon.rb +34 -0
  63. data/lib/mural/widget/image.rb +77 -0
  64. data/lib/mural/widget/shape.rb +79 -0
  65. data/lib/mural/widget/sticky_note.rb +81 -0
  66. data/lib/mural/widget/table.rb +54 -0
  67. data/lib/mural/widget/table_cell.rb +50 -0
  68. data/lib/mural/widget/text.rb +58 -0
  69. data/lib/mural/widget/update_file_params.rb +50 -0
  70. data/lib/mural/widget.rb +158 -0
  71. data/lib/mural/workspace.rb +47 -0
  72. data/lib/mural/workspace_invitation.rb +16 -0
  73. data/lib/mural.rb +27 -0
  74. metadata +132 -0
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class CreateTagParams
5
+ include Mural::Codec
6
+
7
+ define_attributes(
8
+ # The text in the tag.
9
+ text: 'text',
10
+
11
+ # The background color of the tag in hex with alpha format.
12
+ background_color: 'backgroundColor',
13
+
14
+ # The border color of the tag in hex with alpha format.
15
+ border_color: 'borderColor',
16
+
17
+ # The text color of the tag in hex with alpha format.
18
+ color: 'color',
19
+
20
+ # The widgets to add the new tag to.
21
+ #
22
+ # ⚠️ This is rejected by Mural API with the following error:
23
+ # > Invalid "widgets" property type was sent. Type undefined was expected.
24
+ widgets: 'widgets'
25
+ )
26
+
27
+ def encode
28
+ super.tap do |json|
29
+ json['widgets']&.map!(&:encode)
30
+ end
31
+ end
32
+
33
+ class Widget
34
+ include Mural::Codec
35
+
36
+ define_attributes(
37
+ # The unique ID of the widget to add the new tag to.
38
+ id: 'id',
39
+
40
+ # Text size.
41
+ font_size: 'fontSize'
42
+ )
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class CurrentUser
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/getcurrentmember
8
+ define_attributes(
9
+ id: 'id',
10
+ email: 'email',
11
+ avatar: 'avatar',
12
+ first_name: 'firstName',
13
+ last_name: 'lastName',
14
+ created_on: 'createdOn',
15
+ company_id: 'companyId',
16
+ company_name: 'companyName',
17
+ type: 'type',
18
+ last_active_workspace: 'lastActiveWorkspace'
19
+ )
20
+ end
21
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class DuplicateMuralParams
5
+ include Mural::Codec
6
+
7
+ define_attributes(
8
+ room_id: 'roomId',
9
+ folder_id: 'folderId',
10
+ infinite: 'infinite',
11
+ title: 'title'
12
+ )
13
+ end
14
+ end
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ # Mural, the company, is also calling their main document a "mural" in lower
5
+ # case. Unfortunately, this doesn't translate well to a programming language
6
+ # and I'd rather have a #<Mural::MuralBoard> instance instead of a
7
+ # #<Mural::Mural> one, the repetition is driving me insane. And it's also
8
+ # what their main competitor (Miro) is calling the document, so it's not to
9
+ # far-fetched. I also believe that historically, a "mural" (the document) used
10
+ # to be called a board as well within Mural (the company/product).
11
+ class MuralBoard
12
+ include Mural::Codec
13
+
14
+ # https://developers.mural.co/public/reference/getmuralbyid
15
+ define_attributes(
16
+ background_color: 'backgroundColor',
17
+ created_by: 'createdBy',
18
+ created_on: 'createdOn',
19
+ embed_link: 'embedLink',
20
+ favorite: 'favorite',
21
+ folder_id: 'folderId',
22
+ height: 'height',
23
+ id: 'id',
24
+ infinite: 'infinite',
25
+ room_id: 'roomId',
26
+ sharing_settings: 'sharingSettings',
27
+ state: 'state',
28
+ status: 'status',
29
+ thumbnail_url: 'thumbnailUrl',
30
+ timer_sound_theme: 'timerSoundTheme',
31
+ title: 'title',
32
+ updated_by: 'updatedBy',
33
+ updated_on: 'updatedOn',
34
+ visitor_avatar_theme: 'visitorAvatarTheme',
35
+ visitors_settings: 'visitorsSettings', # spelling is on Mural side
36
+ width: 'width',
37
+ workspace_id: 'workspaceId'
38
+ )
39
+
40
+ def self.decode(json)
41
+ super.tap do |mural|
42
+ mural.created_by = CreatedBy.decode(mural.created_by)
43
+ mural.updated_by = UpdatedBy.decode(mural.updated_by)
44
+ mural.sharing_settings = SharingSettings.decode(mural.sharing_settings)
45
+ mural.visitors_settings =
46
+ VisitorsSettings.decode(mural.visitors_settings)
47
+ end
48
+ end
49
+
50
+ class AccessInformation
51
+ include Mural::Codec
52
+
53
+ define_attributes(
54
+ visitors: 'visitors',
55
+ workspace_members: 'workspaceMembers'
56
+ )
57
+ end
58
+
59
+ class CreatedBy
60
+ include Mural::Codec
61
+
62
+ define_attributes(
63
+ first_name: 'firstName',
64
+ id: 'id',
65
+ last_name: 'lastName'
66
+ )
67
+ end
68
+
69
+ class UpdatedBy
70
+ include Mural::Codec
71
+
72
+ define_attributes(
73
+ first_name: 'firstName',
74
+ id: 'id',
75
+ last_name: 'lastName'
76
+ )
77
+ end
78
+
79
+ class SharingSettings
80
+ include Mural::Codec
81
+
82
+ define_attributes(link: 'link')
83
+ end
84
+
85
+ class VisitorsSettings
86
+ include Mural::Codec
87
+
88
+ define_attributes(
89
+ visitors: 'visitors',
90
+ workspace_members: 'workspaceMembers',
91
+ link: 'link',
92
+ expires_on: 'expiresOn'
93
+ )
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class MuralExport
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/exporturlmural
8
+ define_attributes(
9
+ created_on: 'createdOn',
10
+ expire_on: 'expireOn',
11
+ export_id: 'exportId',
12
+ mural_id: 'muralId',
13
+ url: 'url'
14
+ )
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class MuralInvitation
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/inviteuserstomural
8
+ define_attributes(
9
+ email: 'email',
10
+ ref_code: 'refCode',
11
+ rejected: 'rejected',
12
+ reason: 'reason',
13
+ username: 'username'
14
+ )
15
+ end
16
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class MuralInvitationParams
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/inviteuserstomural
8
+ define_attributes(
9
+ edit_permission: 'editPermission',
10
+ email: 'email',
11
+ username: 'username'
12
+ )
13
+ end
14
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class MuralUser
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/getmuralusers
8
+ define_attributes(
9
+ id: 'id',
10
+ email: 'email',
11
+ avatar: 'avatar',
12
+ first_name: 'firstName',
13
+ last_name: 'lastName',
14
+ type: 'type',
15
+ permissions: 'permissions'
16
+ )
17
+
18
+ class Permissions
19
+ include Mural::Codec
20
+
21
+ define_attributes({ owner: 'owner', facilitator: 'facilitator' })
22
+ end
23
+
24
+ def self.decode(json)
25
+ super.tap do |mural_user|
26
+ mural_user.permissions = Permissions.decode(mural_user.permissions)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class RemovedMuralUser
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/removemuralusers
8
+ define_attributes(
9
+ email: 'email',
10
+ rejected: 'rejected',
11
+ reason: 'reason'
12
+ )
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class RemovedRoomUser
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/removeroomusers
8
+ define_attributes(
9
+ email: 'email',
10
+ rejected: 'rejected',
11
+ reason: 'reason'
12
+ )
13
+ end
14
+ end
data/lib/mural/room.rb ADDED
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class Room
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/getroominfobyid
8
+ define_attributes(
9
+ id: 'id',
10
+ name: 'name',
11
+ description: 'description',
12
+ favorite: 'favorite',
13
+ created_by: 'createdBy',
14
+ created_on: 'createdOn',
15
+ updated_by: 'updatedBy',
16
+ updated_on: 'updatedOn',
17
+ type: 'type',
18
+ confidential: 'confidential',
19
+ workspace_id: 'workspaceId',
20
+ # 👇 Only visible when the logged in user is an admin ("owner" in Mural
21
+ # terminology) of the room. Not returned on creation.
22
+ sharing_settings: 'sharingSettings'
23
+ )
24
+
25
+ def self.decode(json)
26
+ super.tap do |room|
27
+ room.created_by = CreatedBy.decode(room.created_by)
28
+ room.updated_by = CreatedBy.decode(room.updated_by)
29
+ room.sharing_settings = SharingSettings.decode(room.sharing_settings)
30
+ end
31
+ end
32
+
33
+ class CreatedBy
34
+ include Mural::Codec
35
+
36
+ define_attributes(
37
+ {
38
+ first_name: 'firstName',
39
+ id: 'id',
40
+ last_name: 'lastName'
41
+ }
42
+ )
43
+ end
44
+
45
+ class UpdatedBy
46
+ include Mural::Codec
47
+
48
+ define_attributes(
49
+ {
50
+ first_name: 'firstName',
51
+ id: 'id',
52
+ last_name: 'lastName'
53
+ }
54
+ )
55
+ end
56
+
57
+ class SharingSettings
58
+ include Mural::Codec
59
+
60
+ define_attributes({ link: 'link' })
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class RoomFolder
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/getroomfolders
8
+ define_attributes(
9
+ children: 'children',
10
+ id: 'id',
11
+ name: 'name'
12
+ )
13
+
14
+ def self.decode(json)
15
+ super.tap do |folder|
16
+ # Recursively map out the children
17
+ folder.children&.map! { |child| decode(child) }
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class RoomInvitation
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/inviteuserstoroom
8
+ define_attributes(
9
+ email: 'email',
10
+ ref_code: 'refCode',
11
+ rejected: 'rejected',
12
+ reason: 'reason',
13
+ username: 'username'
14
+ )
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class RoomInvitationParams
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/inviteuserstoroom
8
+ define_attributes(
9
+ email: 'email',
10
+ username: 'username'
11
+ )
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class RoomUser
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/getroommembers
8
+ define_attributes(
9
+ id: 'id',
10
+ email: 'email',
11
+ avatar: 'avatar',
12
+ first_name: 'firstName',
13
+ last_name: 'lastName',
14
+ type: 'type'
15
+ )
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class SearchMuralResult
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/searchmurals
8
+ define_attributes(
9
+ id: 'id',
10
+ room_id: 'roomId',
11
+ workspace_id: 'workspaceId',
12
+ workspace_name: 'workspaceName',
13
+ created_by: 'createdBy',
14
+ created_on: 'createdOn',
15
+ updated_by: 'updatedBy',
16
+ status: 'status',
17
+ thumbnail_url: 'thumbnailUrl',
18
+ title: 'title'
19
+ )
20
+ end
21
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class SearchRoomResult
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/searchrooms
8
+ define_attributes(
9
+ id: 'id',
10
+ name: 'name',
11
+ description: 'description',
12
+ type: 'type',
13
+ workspace_id: 'workspaceId'
14
+ )
15
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class SearchTemplateResult
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/searchtemplates
8
+ define_attributes(
9
+ id: 'id',
10
+ workspace_id: 'workspaceId',
11
+ created_on: 'createdOn',
12
+ thumb_url: 'thumbUrl',
13
+ view_link: 'viewLink',
14
+ type: 'type',
15
+ name: 'name'
16
+ )
17
+ end
18
+ end
data/lib/mural/tag.rb ADDED
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class Tag
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/getmuraltags
8
+ define_attributes(
9
+ # The ID of the tag.
10
+ id: 'id',
11
+
12
+ # The text in the tag.
13
+ text: 'text',
14
+
15
+ # The background color of the tag in hex with alpha format.
16
+ background_color: 'backgroundColor',
17
+
18
+ # The border color of the tag in hex with alpha format.
19
+ border_color: 'borderColor',
20
+
21
+ # The text color of the tag in hex with alpha format.
22
+ color: 'color'
23
+ )
24
+ end
25
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class Template
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/getdefaulttemplates
8
+ define_attributes(
9
+ id: 'id',
10
+ name: 'name',
11
+ description: 'description',
12
+ created_on: 'createdOn',
13
+ created_by: 'createdBy',
14
+ updated_on: 'updatedOn',
15
+ updated_by: 'updatedBy',
16
+ type: 'type',
17
+ workspace_id: 'workspaceId',
18
+ thumb_url: 'thumbUrl',
19
+ view_link: 'viewLink',
20
+ # 👇 only returned when creating a custom template
21
+ mural_id: 'muralId'
22
+ )
23
+ end
24
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class UpdateMuralParams
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/updatemuralbyid
8
+ define_attributes(
9
+ background_color: 'backgroundColor',
10
+ favorite: 'favorite',
11
+ folderId: 'folderId',
12
+ height: 'height',
13
+ infinite: 'infinite',
14
+ width: 'width',
15
+ title: 'title',
16
+ status: 'status',
17
+ timer_sound_theme: 'timerSoundTheme',
18
+ visitor_avatar_theme: 'visitorAvatarTheme',
19
+ visitors_permission: 'visitorsPermission',
20
+ workspace_members_permission: 'workspaceMembersPermission'
21
+ )
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class UpdateRoomParams
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/updateroombyid
8
+ define_attributes(
9
+ description: 'description',
10
+ favorite: 'favorite',
11
+ name: 'name',
12
+ type: 'type'
13
+ )
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class UpdateRoomUserParams
5
+ include Mural::Codec
6
+
7
+ define_attributes(
8
+ create_murals: 'createMurals',
9
+ duplicate_room: 'duplicateRoom',
10
+ invite_others: 'inviteOthers',
11
+ owner: 'owner',
12
+ username: 'username',
13
+ ref_code: 'refCode'
14
+ )
15
+ end
16
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class UpdateStickyNoteParams
5
+ include Mural::Codec
6
+
7
+ define_attributes(
8
+ **Mural::CreateStickyNoteParams.attrs.reject do |attr|
9
+ %i[
10
+ stacking_order
11
+ shape
12
+ ].include?(attr)
13
+ end
14
+ )
15
+
16
+ def encode
17
+ super.tap do |json|
18
+ json['style'] = json['style']&.encode
19
+ end
20
+ end
21
+
22
+ Style = Mural::Widget::StickyNote::Style
23
+ end
24
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class UpdateTagParams
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/updatetagbyid
8
+ define_attributes(
9
+ # The text in the tag.
10
+ text: 'text',
11
+
12
+ # The background color of the tag in hex with alpha format.
13
+ background_color: 'backgroundColor',
14
+
15
+ # The border color of the tag in hex with alpha format.
16
+ border_color: 'borderColor',
17
+
18
+ # The text color of the tag in hex with alpha format.
19
+ color: 'color'
20
+ )
21
+ end
22
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ VERSION = '0.1.0'
5
+ end