Module: Snoo::PM
- Defined in:
- lib/snoo/pms.rb
Overview
Methods for interacting with private messages
Instance Method Summary collapse
-
#block_pm(id) ⇒ Object
Block a user from sending you messages.
-
#get_messages(where = "inbox", opts = {}) ⇒ Object
Gets a listing of PMs.
-
#mark_read(id) ⇒ Object
Mark a PM as read.
-
#mark_unread(id) ⇒ Object
Mark a PM as unread.
-
#send_pm(to, subject, text) ⇒ Object
Send a private message To reply to PM, use LinksComments#comment, with the PM id as the link id.
Instance Method Details
#block_pm(id) ⇒ Object
Block a user from sending you messages
11 12 13 14 |
# File 'lib/snoo/pms.rb', line 11 def block_pm id logged_in? post('/api/block', body: {id: id, uh: @modhash, api_type: 'json'}) end |
#get_messages(where = "inbox", opts = {}) ⇒ Object
Gets a listing of PMs
55 56 57 58 59 60 61 |
# File 'lib/snoo/pms.rb', line 55 def where = "inbox", opts = {} query = { mark: false } query.merge! opts get("/message/#{where}.json", query: query) end |
#mark_read(id) ⇒ Object
Mark a PM as read
32 33 34 35 |
# File 'lib/snoo/pms.rb', line 32 def mark_read id logged_in? post('/api/read_message', body: {id: id, uh: @modhash, api_type: 'json'}) end |
#mark_unread(id) ⇒ Object
Mark a PM as unread
41 42 43 44 |
# File 'lib/snoo/pms.rb', line 41 def mark_unread id logged_in? post('/api/unread_message', body: {id: id, uh: @modhash, api_type: 'json'}) end |
#send_pm(to, subject, text) ⇒ Object
Send a private message To reply to PM, use LinksComments#comment, with the PM id as the link id
23 24 25 26 |
# File 'lib/snoo/pms.rb', line 23 def send_pm to, subject, text logged_in? post('/api/compose.json', body: {to: to, subject: subject, text: text, uh: @modhash, api_type: 'json'}) end |