mural-ruby 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35d1d5b409d40946faea660284f87875d36785f57278c967c93a645effe6fa24
4
- data.tar.gz: 589cdad5b6ef75573fbca62b86de32b43bc084723c4c3a4a8a7589d46e81b82d
3
+ metadata.gz: c96aa829320e65007b67de1032c65f7e29ca09fc81065db1aceef1329f599d85
4
+ data.tar.gz: 9fdfb66565796a17c330b95c687c71b1d96d2c9c15d0221860d57bcd683524f8
5
5
  SHA512:
6
- metadata.gz: a2ed7a6155ab38a55199c17442a07dfb23db5e2191df44096668b1ec73d52a860b80abd0e62439611d726b0f4e95e8eb29e6e75c8b72b840a0ee684fb5d74cf8
7
- data.tar.gz: 7ca63988d68d1f4c3e9099121229582244295aa605e4928c71cdee185432aad202c3206ba457299ddaf41de40112703340158033a0ab3da183ab05b45e3f0201
6
+ metadata.gz: e4525e0df9345817de48a1d114defb147743b94ec6dcebfb026257aef7464b2d465172edbcd19b645c48e254cc47fdc2eaa312b547d5ad3eb16bbeea5db99ee6
7
+ data.tar.gz: b40ef34256eda180e34dcebfc2d88c02737a892dc467cb02f545118fc291d8fcbcc702cd0d0f5320187f1285750cf3f4c0ac931f069aa11d9f192ecbfc5bfbdd
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Mural Ruby
2
2
 
3
+ [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/mickaelpham/mural-ruby/ruby.yml?branch=main&style=for-the-badge)](https://github.com/mickaelpham/mural-ruby/actions/workflows/ruby.yml?query=branch%3Amain)
4
+ [![Gem Version](https://img.shields.io/gem/v/mural-ruby?style=for-the-badge)](https://rubygems.org/gems/mural-ruby)
5
+ [![GitHub License](https://img.shields.io/github/license/mickaelpham/mural-ruby?style=for-the-badge)](https://github.com/mickaelpham/mural-ruby/blob/main/UNLICENSE)
6
+
7
+
3
8
  Ruby library for the [Mural](https://app.mural.co) public API.
4
9
 
5
10
  ## Installation
data/lib/mural/chat.rb ADDED
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class Chat
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/getmuralchat
8
+ define_attributes(
9
+ # The ID of the chat message.
10
+ id: 'id',
11
+ # The content of the chat message.
12
+ message: 'message',
13
+ # The timestamp of the chat message.
14
+ created_on: 'createdOn',
15
+ # The user object
16
+ user: 'user'
17
+ )
18
+
19
+ def self.decode(json)
20
+ super.tap do |chat|
21
+ chat.user = User.decode(chat.user)
22
+ end
23
+ end
24
+
25
+ class User
26
+ include Mural::Codec
27
+
28
+ define_attributes(
29
+ # First name of the member or guest in the chat.
30
+ first_name: 'firstName',
31
+ # Last name of the member or guest in the chat.
32
+ last_name: 'lastName',
33
+ # ID of a user.
34
+ id: 'id'
35
+ )
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class Client
5
+ class MuralContent
6
+ module Chats
7
+ # https://developers.mural.co/public/reference/getmuralchat
8
+ def list_chats(mural_id, next_page: nil)
9
+ json = get(
10
+ "/api/public/v1/murals/#{mural_id}/chat",
11
+ { next: next_page }
12
+ )
13
+
14
+ chats = json['value'].map { |c| Mural::Chat.decode(c) }
15
+ [chats, json['next']]
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,137 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class Client
5
+ class MuralContent
6
+ module FacilitationFeatures
7
+ # https://developers.mural.co/public/reference/startprivatemode
8
+ def start_private_mode(mural_id, hide_authors: false)
9
+ json = post(
10
+ "/api/public/v1/murals/#{mural_id}/private-mode/start",
11
+ { hideAuthors: hide_authors }
12
+ )
13
+
14
+ Mural::PrivateMode.decode(json['value'])
15
+ end
16
+
17
+ # https://developers.mural.co/public/reference/stopprivatemode
18
+ def end_private_mode(mural_id)
19
+ post("/api/public/v1/murals/#{mural_id}/private-mode/end")
20
+ end
21
+
22
+ # https://developers.mural.co/public/reference/getprivatemode
23
+ def retrieve_private_mode(mural_id)
24
+ json = get("/api/public/v1/murals/#{mural_id}/private-mode")
25
+
26
+ Mural::PrivateMode.decode(json['value'])
27
+ end
28
+
29
+ # https://developers.mural.co/public/reference/getmuralvotingsessions
30
+ def list_voting_sessions(mural_id, next_page: nil)
31
+ json = get(
32
+ "/api/public/v1/murals/#{mural_id}/voting-sessions",
33
+ { next: next_page }
34
+ )
35
+
36
+ voting_sessions = json['value'].map do |session|
37
+ Mural::VotingSession.decode(session)
38
+ end
39
+
40
+ [voting_sessions, json['next']]
41
+ end
42
+
43
+ # https://developers.mural.co/public/reference/getmuralvotingsessionresults
44
+ def list_voting_session_results(
45
+ mural_id,
46
+ voting_session_id,
47
+ next_page: nil
48
+ )
49
+ json = get(
50
+ "/api/public/v1/murals/#{mural_id}/voting-sessions" \
51
+ "/#{voting_session_id}/results",
52
+ { next: next_page }
53
+ )
54
+
55
+ voting_session_results = json['value'].map do |result|
56
+ Mural::VotingSessionResult.decode(result)
57
+ end
58
+
59
+ [voting_session_results, json['next']]
60
+ end
61
+
62
+ # https://developers.mural.co/public/reference/getmuralvotingsessionbyid
63
+ def retrieve_voting_session(mural_id, voting_session_id)
64
+ json = get(
65
+ "/api/public/v1/murals/#{mural_id}/voting-sessions" \
66
+ "/#{voting_session_id}"
67
+ )
68
+
69
+ Mural::VotingSession.decode(json['value'])
70
+ end
71
+
72
+ # https://developers.mural.co/public/reference/deletemuralvotingsessionbyid
73
+ def destroy_voting_session(mural_id, voting_session_id)
74
+ delete(
75
+ "/api/public/v1/murals/#{mural_id}/voting-sessions" \
76
+ "/#{voting_session_id}"
77
+ )
78
+ end
79
+
80
+ # https://developers.mural.co/public/reference/startmuralvotingsession
81
+ def start_voting_session(mural_id, start_voting_session_params)
82
+ json = post(
83
+ "/api/public/v1/murals/#{mural_id}/voting-sessions/start",
84
+ start_voting_session_params.encode
85
+ )
86
+
87
+ Mural::VotingSession.decode(json['value'])
88
+ end
89
+
90
+ # https://developers.mural.co/public/reference/endmuralvotingsession
91
+ def end_voting_session(mural_id)
92
+ post("/api/public/v1/murals/#{mural_id}/voting-sessions/end")
93
+ end
94
+
95
+ # https://developers.mural.co/public/reference/votewidgetmuralvotingsession
96
+ def vote_for_widget(mural_id, widget_id)
97
+ post(
98
+ "/api/public/v1/murals/#{mural_id}/voting-sessions" \
99
+ "/vote/#{widget_id}"
100
+ )
101
+ end
102
+
103
+ # https://developers.mural.co/public/reference/getmuraltimer
104
+ def retrieve_timer(mural_id)
105
+ json = get("/api/public/v1/murals/#{mural_id}/timer")
106
+
107
+ Mural::Timer.decode(json['value'])
108
+ end
109
+
110
+ # https://developers.mural.co/public/reference/startmuraltimer
111
+ def start_timer(mural_id, duration:, sound_enabled: true)
112
+ json = post(
113
+ "/api/public/v1/murals/#{mural_id}/timer/start",
114
+ { duration: duration, soundEnabled: sound_enabled }
115
+ )
116
+
117
+ Mural::Timer.decode(json['value'])
118
+ end
119
+
120
+ # https://developers.mural.co/public/reference/stopmuraltimer
121
+ def end_timer(mural_id)
122
+ post("/api/public/v1/murals/#{mural_id}/timer/end")
123
+ end
124
+
125
+ # https://developers.mural.co/public/reference/updatemuraltimer
126
+ def update_timer(mural_id, update_timer_params)
127
+ json = patch(
128
+ "/api/public/v1/murals/#{mural_id}/timer",
129
+ update_timer_params.encode
130
+ )
131
+
132
+ Mural::Timer.decode(json['value'])
133
+ end
134
+ end
135
+ end
136
+ end
137
+ end
@@ -5,6 +5,8 @@ module Mural
5
5
  class MuralContent
6
6
  extend Forwardable
7
7
 
8
+ include Chats
9
+ include FacilitationFeatures
8
10
  include Files
9
11
  include StickyNotes
10
12
  include Tags
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class PrivateMode
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/startprivatemode
8
+ define_attributes(
9
+ # If true, the private mode is active.
10
+ active: 'active',
11
+ # The timestamp when private mode started.
12
+ initial_timestamp: 'initialTimestamp',
13
+ # The user who started the private mode.
14
+ started_by: 'startedBy',
15
+ # If true, the authors of the content will be hidden.
16
+ hide_authors: 'hideAuthors'
17
+ )
18
+ end
19
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class StartVotingSessionParams
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/startmuralvotingsession
8
+ define_attributes(
9
+ # The title of the voting session.
10
+ title: 'title',
11
+ # The number of votes allowed in the session.
12
+ number_of_votes: 'numberOfVotes',
13
+ # The types of widgets that can be voted on in this session.
14
+ widget_types: 'widgetTypes',
15
+ # If true, anyone can end the voting session.
16
+ anyone_can_end: 'anyoneCanEnd',
17
+ # The area on the mural where the voting session will take place.
18
+ area: 'area'
19
+ )
20
+
21
+ def encode
22
+ super.tap do |json|
23
+ json['area'] = json['area']&.encode
24
+ end
25
+ end
26
+
27
+ class Area
28
+ include Mural::Codec
29
+
30
+ define_attributes(
31
+ # The top coordinate of the area.
32
+ top: 'top',
33
+ # The left coordinate of the area.
34
+ left: 'left',
35
+ # The width of the area.
36
+ width: 'width',
37
+ # The height of the area.
38
+ height: 'height'
39
+ )
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class Timer
5
+ include Mural::Codec
6
+
7
+ define_attributes(
8
+ # Timer duration in seconds.
9
+ duration: 'duration',
10
+ # The initial timestamp of the timer in ms.
11
+ initial_timestamp: 'initialTimestamp',
12
+ # The current timestamp of the timer in ms.
13
+ now: 'now',
14
+ # The paused timestamp of the timer in ms. Null if no pause action was
15
+ # performed.
16
+ paused_timestamp: 'pausedTimestamp',
17
+ # If true, the timer will play a sound when it ends.
18
+ sound_enabled: 'soundEnabled'
19
+ )
20
+ end
21
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class UpdateTimerParams
5
+ include Mural::Codec
6
+
7
+ define_attributes(
8
+ # Add +/- extra time to the running timer in seconds.
9
+ delta: 'delta',
10
+ # If true, the timer will pause.
11
+ paused: 'paused',
12
+ # If true, the timer will play a sound when it ends.
13
+ sound_enabled: 'soundEnabled'
14
+ )
15
+ end
16
+ end
data/lib/mural/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mural
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class VotingSession
5
+ include Mural::Codec
6
+
7
+ # https://developers.mural.co/public/reference/getmuralvotingsessions
8
+ define_attributes(
9
+ # The ID of the voting session.
10
+ id: 'id',
11
+ # The title of the voting session.
12
+ title: 'title'
13
+ )
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mural
4
+ class VotingSessionResult
5
+ include Mural::Codec
6
+
7
+ define_attributes(
8
+ # Unique identifier of a widget.
9
+ widget_id: 'widgetId',
10
+ # The total number of votes for the widget.
11
+ total_votes: 'totalVotes',
12
+ # The number of unique collaborators that voted for the widget.
13
+ unique_voters: 'uniqueVoters'
14
+ )
15
+ end
16
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mural-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mickaël Pham
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-09-06 00:00:00.000000000 Z
11
+ date: 2025-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -42,9 +42,12 @@ files:
42
42
  - img/smart-planner.png
43
43
  - lib/mural.rb
44
44
  - lib/mural/asset.rb
45
+ - lib/mural/chat.rb
45
46
  - lib/mural/client.rb
46
47
  - lib/mural/client/authentication.rb
47
48
  - lib/mural/client/mural_content.rb
49
+ - lib/mural/client/mural_content/chats.rb
50
+ - lib/mural/client/mural_content/facilitation_features.rb
48
51
  - lib/mural/client/mural_content/files.rb
49
52
  - lib/mural/client/mural_content/sticky_notes.rb
50
53
  - lib/mural/client/mural_content/tags.rb
@@ -69,6 +72,7 @@ files:
69
72
  - lib/mural/mural_invitation.rb
70
73
  - lib/mural/mural_invitation_params.rb
71
74
  - lib/mural/mural_user.rb
75
+ - lib/mural/private_mode.rb
72
76
  - lib/mural/removed_mural_user.rb
73
77
  - lib/mural/removed_room_user.rb
74
78
  - lib/mural/room.rb
@@ -79,14 +83,19 @@ files:
79
83
  - lib/mural/search_mural_result.rb
80
84
  - lib/mural/search_room_result.rb
81
85
  - lib/mural/search_template_result.rb
86
+ - lib/mural/start_voting_session_params.rb
82
87
  - lib/mural/tag.rb
83
88
  - lib/mural/template.rb
89
+ - lib/mural/timer.rb
84
90
  - lib/mural/update_mural_params.rb
85
91
  - lib/mural/update_room_params.rb
86
92
  - lib/mural/update_room_user_params.rb
87
93
  - lib/mural/update_sticky_note_params.rb
88
94
  - lib/mural/update_tag_params.rb
95
+ - lib/mural/update_timer_params.rb
89
96
  - lib/mural/version.rb
97
+ - lib/mural/voting_session.rb
98
+ - lib/mural/voting_session_result.rb
90
99
  - lib/mural/widget.rb
91
100
  - lib/mural/widget/area.rb
92
101
  - lib/mural/widget/arrow.rb