Class: Redd::Models::ModMail::Conversation
- Inherits:
-
LazyModel
- Object
- BasicModel
- LazyModel
- Redd::Models::ModMail::Conversation
- Defined in:
- lib/redd/models/mod_mail.rb
Overview
Represents a conversation in the new modmail. TODO: add modmail-specific user type
Instance Attribute Summary
Attributes inherited from BasicModel
Class Method Summary collapse
-
.from_id(client, id) ⇒ Conversation
Get a Conversation from its id.
Instance Method Summary collapse
-
#archive ⇒ Object
Mark this conversation as archived.
-
#highlight ⇒ Object
Highlight this conversation.
-
#mark_as_read ⇒ Object
Mark this conversation as read.
-
#mark_as_unread ⇒ Object
Mark this conversation as unread.
-
#mute ⇒ Object
Mute this conversation.
-
#reply(body, hidden: false, internal: false) ⇒ Object
Add a reply to the ongoing conversation.
-
#unarchive ⇒ Object
Removed this conversation from archived.
-
#unhighlight ⇒ Object
Remove the highlight on this conversation.
-
#unmute ⇒ Object
Unmute this conversation.
Methods inherited from LazyModel
#force_load, #initialize, #method_missing, #respond_to_missing?, #to_h
Methods inherited from BasicModel
#initialize, #inspect, #method_missing, #respond_to_missing?, #to_ary, #to_h
Constructor Details
This class inherits a constructor from Redd::Models::LazyModel
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Redd::Models::LazyModel
Class Method Details
.from_id(client, id) ⇒ Conversation
Get a Conversation from its id.
17 18 19 |
# File 'lib/redd/models/mod_mail.rb', line 17 def self.from_id(client, id) new(client, id: id) end |
Instance Method Details
#archive ⇒ Object
Mark this conversation as archived.
41 42 43 |
# File 'lib/redd/models/mod_mail.rb', line 41 def archive perform_action(:post, 'archive') end |
#highlight ⇒ Object
Highlight this conversation.
51 52 53 |
# File 'lib/redd/models/mod_mail.rb', line 51 def highlight perform_action(:post, 'highlight') end |
#mark_as_read ⇒ Object
Mark this conversation as read.
31 32 33 |
# File 'lib/redd/models/mod_mail.rb', line 31 def mark_as_read @client.post('/api/mod/conversations/read', conversationIds: [get_attribute(:id)]) end |
#mark_as_unread ⇒ Object
Mark this conversation as unread.
36 37 38 |
# File 'lib/redd/models/mod_mail.rb', line 36 def mark_as_unread @client.post('/api/mod/conversations/unread', conversationIds: [get_attribute(:id)]) end |
#mute ⇒ Object
Mute this conversation.
61 62 63 |
# File 'lib/redd/models/mod_mail.rb', line 61 def mute perform_action(:post, 'mute') end |
#reply(body, hidden: false, internal: false) ⇒ Object
Add a reply to the ongoing conversation.
22 23 24 25 26 27 28 |
# File 'lib/redd/models/mod_mail.rb', line 22 def reply(body, hidden: false, internal: false) # TODO: merge response into the conversation @client.post( "/api/mod/conversations/#{get_attribute(:id)}", body: body, isAuthorHidden: hidden, isInternal: internal ).body end |
#unarchive ⇒ Object
Removed this conversation from archived.
46 47 48 |
# File 'lib/redd/models/mod_mail.rb', line 46 def unarchive perform_action(:post, 'unarchive') end |
#unhighlight ⇒ Object
Remove the highlight on this conversation.
56 57 58 |
# File 'lib/redd/models/mod_mail.rb', line 56 def unhighlight perform_action(:delete, 'highlight') end |
#unmute ⇒ Object
Unmute this conversation.
66 67 68 |
# File 'lib/redd/models/mod_mail.rb', line 66 def unmute perform_action(:post, 'unmute') end |