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,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class Widget
5
+ class Area
6
+ include Mural::Codec
7
+
8
+ define_attributes(
9
+ **Mural::Widget.attrs,
10
+
11
+ # Style properties of the widget.
12
+ style: 'style',
13
+
14
+ # The area layout type.
15
+ layout: 'layout',
16
+
17
+ # If true, the title is displayed.
18
+ show_title: 'showTitle',
19
+
20
+ # The title in the area widget and in the outline.
21
+ title: 'title'
22
+ )
23
+
24
+ def self.decode(json)
25
+ super.tap do |area|
26
+ area.style = Style.decode(area.style)
27
+ end
28
+ end
29
+
30
+ class Style
31
+ include Mural::Codec
32
+
33
+ define_attributes(
34
+ # The background color of the widget in hex with alpha format.
35
+ background_color: 'backgroundColor',
36
+
37
+ # The border color of the widget in hex with alpha format.
38
+ border_color: 'borderColor',
39
+
40
+ # The border style of the widget.
41
+ # ["solid", "dashed", "dotted-spaced", "dotted"]
42
+ border_style: 'borderStyle',
43
+
44
+ # The border width of the widget.
45
+ border_width: 'borderWidth',
46
+
47
+ # The font size of the title of the widget.
48
+ title_font_size: 'titleFontSize'
49
+ )
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,139 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class Widget
5
+ class Arrow
6
+ include Mural::Codec
7
+
8
+ define_attributes(
9
+ **Mural::Widget.attrs,
10
+
11
+ # The type of the arrow line.
12
+ # ["straight", "curved", "orthogonal"]
13
+ arrow_type: 'arrowType',
14
+
15
+ # The type of the arrow tip.
16
+ # ["no tip", "single", "double"]
17
+ tip: 'tip',
18
+
19
+ # If true, the widget is stackable.
20
+ stackable: 'stackable',
21
+
22
+ # Array of objects
23
+ points: 'points',
24
+
25
+ # Style properties of the widget.
26
+ style: 'style',
27
+
28
+ # The ID of the widget that the start point is connected to.
29
+ start_ref_id: 'startRefId',
30
+
31
+ # The ID of the widget that the end point is connected to.
32
+ end_ref_id: 'endRefId',
33
+
34
+ # label
35
+ label: 'label',
36
+
37
+ # The title of the widget in the outline.
38
+ title: 'title'
39
+ )
40
+
41
+ def self.decode(json)
42
+ super.tap do |arrow|
43
+ arrow.points = arrow.points&.map { |point| Point.decode(point) }
44
+ arrow.style = Style.decode(arrow.style)
45
+
46
+ # Making sure I'm calling the "right" Label class
47
+ arrow.label = Mural::Widget::Arrow::Label.decode(arrow.label)
48
+ end
49
+ end
50
+
51
+ class Point
52
+ include Mural::Codec
53
+
54
+ define_attributes(x: 'x', y: 'y')
55
+ end
56
+
57
+ class Style
58
+ include Mural::Codec
59
+
60
+ define_attributes(
61
+ # The stroke color of the connector in hex with alpha format.
62
+ stroke_color: 'strokeColor',
63
+
64
+ # The stroke style of the connector.
65
+ # ["solid", "dashed", "dotted-spaced", "dotted"]
66
+ stroke_style: 'strokeStyle',
67
+
68
+ # The stroke width of the connector.
69
+ stroke_width: 'strokeWidth'
70
+ )
71
+ end
72
+
73
+ class Label
74
+ include Mural::Codec
75
+
76
+ define_attributes(format: 'format', labels: 'labels')
77
+
78
+ def self.decode(json)
79
+ super.tap do |label|
80
+ next if label.nil?
81
+
82
+ label.labels = label.labels.map do |l|
83
+ # I'm not responsible for this naming…
84
+ Mural::Widget::Arrow::Label::Label.decode(l)
85
+ end
86
+
87
+ label.format = Format.decode(label.format)
88
+ end
89
+ end
90
+
91
+ class Format
92
+ include Mural::Codec
93
+
94
+ define_attributes(
95
+ # color
96
+ color: 'color',
97
+
98
+ # Font-family of the text.
99
+ font_family: 'fontFamily',
100
+
101
+ # If true, the text of the label on the connector is bold.
102
+ bold: 'bold',
103
+
104
+ # If true, the text of the label on the connector is italic.
105
+ italic: 'italic',
106
+
107
+ # The alignment of the text of the label on the connector.
108
+ # ["left", "center", "right"]
109
+ text_align: 'textAlign',
110
+
111
+ # The font size of the text of the label on the connector.
112
+ font_size: 'fontSize'
113
+ )
114
+ end
115
+
116
+ class Label
117
+ include Mural::Codec
118
+
119
+ define_attributes(
120
+ # The horizontal position of the label on the connector in px.
121
+ x: 'x',
122
+
123
+ # The vertical position of the label on the connector in px.
124
+ y: 'y',
125
+
126
+ # The height of the label on the connector in px.
127
+ height: 'height',
128
+
129
+ # The width of the label on the connector in px.
130
+ width: 'width',
131
+
132
+ # The text of the label on the connector.
133
+ text: 'text'
134
+ )
135
+ end
136
+ end
137
+ end
138
+ end
139
+ end
@@ -0,0 +1,92 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class Widget
5
+ class Comment
6
+ include Mural::Codec
7
+
8
+ define_attributes(
9
+ **Mural::Widget.attrs,
10
+
11
+ # The message text of the comment widget.
12
+ message: 'message',
13
+
14
+ # Array of replies
15
+ replies: 'replies',
16
+
17
+ # The timestamp for the creation of the comment in milliseconds.
18
+ timestamp: 'timestamp',
19
+
20
+ # The reference ID of the widget that the comment points to.
21
+ reference_widget_id: 'referenceWidgetId',
22
+
23
+ # The collaborator who resolved the comment.
24
+ resolved_by: 'resolvedBy',
25
+
26
+ # The timestamp when the comment was resolved, in milliseconds.
27
+ resolved_on: 'resolvedOn',
28
+
29
+ # The title of the widget in the outline.
30
+ title: 'title'
31
+ )
32
+
33
+ def self.decode(json)
34
+ super.tap do |comment|
35
+ comment.replies = comment.replies&.map { |r| Reply.decode(r) }
36
+ comment.resolved_by = ResolvedBy.decode(comment.resolved_by)
37
+ end
38
+ end
39
+
40
+ class ResolvedBy
41
+ include Mural::Codec
42
+
43
+ define_attributes(
44
+ # ID of a user.
45
+ id: 'id',
46
+
47
+ # When the user is a member
48
+ first_name: 'firstName',
49
+ last_name: 'lastName',
50
+
51
+ # When the user is a visitor
52
+ alias: 'alias'
53
+ )
54
+ end
55
+
56
+ class Reply
57
+ include Mural::Codec
58
+
59
+ define_attributes(
60
+ # The timestamp of the reply in milliseconds.
61
+ created: 'created',
62
+
63
+ # The text of the reply.
64
+ message: 'message',
65
+ user: 'user'
66
+ )
67
+
68
+ def self.decode(json)
69
+ super.tap do |reply|
70
+ reply.user = User.decode(reply.user)
71
+ end
72
+ end
73
+
74
+ class User
75
+ include Mural::Codec
76
+
77
+ define_attributes(
78
+ # ID of a user.
79
+ id: 'id',
80
+
81
+ # When the user is a member
82
+ first_name: 'firstName',
83
+ last_name: 'lastName',
84
+
85
+ # When the user is a visitor
86
+ alias: 'alias'
87
+ )
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class Widget
5
+ class CreateFileParams
6
+ include Mural::Codec
7
+
8
+ # https://developers.mural.co/public/reference/createfile
9
+ define_attributes(
10
+ # The height of the widget in px. This value will be overwritten if the
11
+ # file has a preview from which the final value will be extracted.
12
+ height: 'height',
13
+
14
+ # If true, the widget is hidden from non-facilitators. Applies only when
15
+ # the widget is in the outline.
16
+ hidden: 'hidden',
17
+
18
+ # The instructions for a section of the outline. This text can only be
19
+ # added and modified by a facilitator.
20
+ instruction: 'instruction',
21
+
22
+ # The name of the file.
23
+ name: 'name',
24
+
25
+ # The ID of the area widget that contains the widget.
26
+ parent_id: 'parentId',
27
+
28
+ # The list order of the widget in the outline.
29
+ presentation_index: 'presentationIndex',
30
+
31
+ # The angle of widget rotation in degrees.
32
+ rotation: 'rotation',
33
+
34
+ # The z-index stacking order of the widget.
35
+ stacking_order: 'stackingOrder',
36
+
37
+ # The title in the file widget and in the outline.
38
+ title: 'title',
39
+
40
+ # The width of the widget in px. This value will be overwritten if the
41
+ # file has a preview from which the final value will be extracted.
42
+ width: 'width',
43
+
44
+ # The horizontal position of the widget in px. This is the distance from
45
+ # the left of the parent widget, such as an area. If the widget has no
46
+ # parent widget, this is the distance from the left of the mural.
47
+ x: 'x',
48
+
49
+ # The vertical position of the widget in px. This is the distance from
50
+ # the top of the parent widget, such as an area. If the widget has no
51
+ # parent widget, this is the distance from the top of the mural.
52
+ y: 'y'
53
+ )
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class Widget
5
+ class File
6
+ include Mural::Codec
7
+
8
+ # https://developers.mural.co/public/reference/createfile
9
+ define_attributes(
10
+ **Mural::Widget.attrs,
11
+
12
+ # The number of minutes after which the file URL expires.
13
+ # May be null when download restriction is enabled.
14
+ expires_in_minutes: 'expiresInMinutes',
15
+
16
+ # The link to the file widget on a mural.
17
+ link: 'link',
18
+
19
+ # The download URL of the file. This URL has expiration time.
20
+ # May be null when download restriction is enabled.
21
+ url: 'url',
22
+
23
+ # Indicates that file was scanned by antivirus.
24
+ scanning: 'scanning',
25
+
26
+ # The URL of the file preview.
27
+ preview_url: 'previewUrl',
28
+
29
+ # The title of the widget in the outline.
30
+ title: 'title'
31
+ )
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class Widget
5
+ class Icon
6
+ include Mural::Codec
7
+
8
+ define_attributes(
9
+ **Mural::Widget.attrs,
10
+
11
+ # The name of the icon.
12
+ name: 'name',
13
+
14
+ # Style properties of the widget.
15
+ style: 'style',
16
+
17
+ # The title of the widget in the outline.
18
+ title: 'title'
19
+ )
20
+
21
+ def self.decode(json)
22
+ super.tap do |icon|
23
+ icon.style = Style.decode(icon.style)
24
+ end
25
+ end
26
+
27
+ class Style
28
+ include Mural::Codec
29
+
30
+ define_attributes(color: 'color')
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class Widget
5
+ class Image
6
+ include Mural::Codec
7
+
8
+ define_attributes(
9
+ **Mural::Widget.attrs,
10
+
11
+ # The aspect ratio of the image.
12
+ aspect_ratio: 'aspectRatio',
13
+
14
+ # If true, a border is displayed around the image.
15
+ border: 'border',
16
+
17
+ # The caption of the image.
18
+ caption: 'caption',
19
+
20
+ # The description of the image.
21
+ description: 'description',
22
+
23
+ # The number of minutes after which the image URL may expire.
24
+ # May be null when download restriction is enabled.
25
+ expires_in_minutes: 'expiresInMinutes',
26
+
27
+ # The URL of the image link.
28
+ link: 'link',
29
+
30
+ # Mask object
31
+ mask: 'mask',
32
+
33
+ # The uncropped height of the image.
34
+ natural_height: 'naturalHeight',
35
+
36
+ # The uncropped width of the image.
37
+ natural_width: 'naturalWidth',
38
+
39
+ # If true, the caption and description are visible.
40
+ show_caption: 'showCaption',
41
+
42
+ # The URL of the image thumbnail.
43
+ thumbnailUrl: 'thumbnail_url',
44
+
45
+ # The download URL of the image. This URL has expiration time.
46
+ # May be null when download restriction is enabled.
47
+ url: 'url'
48
+ )
49
+
50
+ def self.decode(json)
51
+ super.tap do |image|
52
+ image.mask = Mask.decode(image.mask)
53
+ end
54
+ end
55
+
56
+ class Mask
57
+ include Mural::Codec
58
+
59
+ define_attributes(
60
+ # The vertical offset of the cropping mask from the upper-left corner
61
+ # of the image.
62
+ top: 'top',
63
+
64
+ # The horizontal offset of the cropping mask from the upper-left
65
+ # corner of the image.
66
+ left: 'left',
67
+
68
+ # The height of the cropping mask.
69
+ height: 'height',
70
+
71
+ # The width of the cropping mask.
72
+ widgth: 'width'
73
+ )
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class Widget
5
+ class Shape
6
+ include Mural::Codec
7
+
8
+ define_attributes(
9
+ **Mural::Widget.attrs,
10
+
11
+ # The text in the widget. It supports inline formatting using HTML tags.
12
+ html_text: 'htmlText',
13
+
14
+ # The type of shape of the shape widget.
15
+ shape: 'shape',
16
+
17
+ # Style properties of the widget.
18
+ style: 'style',
19
+
20
+ # The text in the widget.
21
+ text: 'text',
22
+
23
+ # The title of the widget in the outline.
24
+ title: 'title'
25
+ )
26
+
27
+ def self.decode(json)
28
+ super.tap do |shape|
29
+ shape.style = Style.decode(shape.style)
30
+ end
31
+ end
32
+
33
+ class Style
34
+ include Mural::Codec
35
+
36
+ define_attributes(
37
+ # The background color of the widget in hex with alpha format.
38
+ background_color: 'backgroundColor',
39
+
40
+ # The border color of the widget in hex with alpha format.
41
+ border_color: 'borderColor',
42
+
43
+ # The border style of the widget.
44
+ # ["solid", "dotted"]
45
+ border_style: 'borderStyle',
46
+
47
+ # The border width of the widget.
48
+ # 1 to 7
49
+ border_width: 'borderWidth',
50
+
51
+ # If true, text is bold.
52
+ bold: 'bold',
53
+
54
+ # If true, text is italic.
55
+ italic: 'italic',
56
+
57
+ # If true, text is underlined.
58
+ underline: 'underline',
59
+
60
+ # If true, text is striked.
61
+ strike: 'strike',
62
+
63
+ # Font-family of the text.
64
+ font: 'font',
65
+
66
+ # The font color of the widget in hex with alpha format.
67
+ font_color: 'fontColor',
68
+
69
+ # Text size.
70
+ font_size: 'fontSize',
71
+
72
+ # The alignment of the text.
73
+ # ["left", "center", "right"]
74
+ text_align: 'textAlign'
75
+ )
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class Widget
5
+ class StickyNote
6
+ include Mural::Codec
7
+
8
+ define_attributes(
9
+ **Mural::Widget.attrs,
10
+
11
+ # The text in the widget. It supports inline formatting using HTML tags.
12
+ html_text: 'htmlText',
13
+
14
+ # The shape of the sticky note widget.
15
+ # ["circle", "rectangle"]
16
+ shape: 'shape',
17
+
18
+ # Style properties of the widget.
19
+ style: 'style',
20
+
21
+ # The text in the widget.
22
+ text: 'text',
23
+
24
+ # The URL used in the widget.
25
+ hyperlink: 'hyperlink',
26
+
27
+ # Text displayed on the hyperlink button.
28
+ hyperlink_title: 'hyperlinkTitle',
29
+
30
+ # The minimum number of lines in the sticky note widget.
31
+ min_lines: 'minLines',
32
+
33
+ # Unique identifiers of the tags in the widget.
34
+ tags: 'tags',
35
+
36
+ # The title of the widget in the outline.
37
+ title: 'title'
38
+ )
39
+
40
+ def self.decode(json)
41
+ super.tap do |sticky_note|
42
+ sticky_note.style = Style.decode(sticky_note.style)
43
+ end
44
+ end
45
+
46
+ class Style
47
+ include Mural::Codec
48
+
49
+ define_attributes(
50
+ # The background color of the widget in hex with alpha format.
51
+ background_color: 'backgroundColor',
52
+
53
+ # If true, text is bold.
54
+ bold: 'bold',
55
+
56
+ # If true, a black border is displayed around the widget.
57
+ border: 'border',
58
+
59
+ # If true, text is italic.
60
+ italic: 'italic',
61
+
62
+ # If true, text is underlined.
63
+ underline: 'underline',
64
+
65
+ # If true, text is striked.
66
+ strike: 'strike',
67
+
68
+ # Font-family of the text.
69
+ font: 'font',
70
+
71
+ # Text size.
72
+ font_size: 'fontSize',
73
+
74
+ # The alignment of the text.
75
+ # ["left", "center", "right"]
76
+ text_align: 'textAlign'
77
+ )
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class Widget
5
+ # UNDOCUMENTED
6
+ # This widget is not documented within Mural public API documentation.
7
+ class Table
8
+ include Mural::Codec
9
+
10
+ define_attributes(
11
+ **Mural::Widget.attrs,
12
+
13
+ title: 'title',
14
+ auto_resize: 'autoResize',
15
+ columns: 'columns',
16
+ rows: 'rows',
17
+ style: 'style'
18
+ )
19
+
20
+ def self.decode(json)
21
+ super.tap do |table|
22
+ table.columns = table.columns&.map { |col| Column.decode(col) }
23
+ table.rows = table.rows&.map { |row| Row.decode(row) }
24
+ table.style = Style.decode(table.style)
25
+ end
26
+ end
27
+
28
+ class Column
29
+ include Mural::Codec
30
+
31
+ define_attributes(column_id: 'columnId', width: 'width')
32
+ end
33
+
34
+ class Row
35
+ include Mural::Codec
36
+
37
+ define_attributes(
38
+ height: 'height',
39
+ min_height: 'minHeight',
40
+ row_id: 'row_id'
41
+ )
42
+ end
43
+
44
+ class Style
45
+ include Mural::Codec
46
+
47
+ define_attributes(
48
+ border_color: 'borderColor',
49
+ border_width: 'borderWidth'
50
+ )
51
+ end
52
+ end
53
+ end
54
+ end