Module: Redd::Client::Authenticated::PrivateMessages

Included in:
Redd::Client::Authenticated
Defined in:
lib/redd/client/authenticated/private_messages.rb

Instance Method Summary collapse

Instance Method Details

#block_message(message) ⇒ Object



5
6
7
8
# File 'lib/redd/client/authenticated/private_messages.rb', line 5

def block_message(message)
  fullname = extract_fullname(message)
  post "/api/block", id: fullname
end

#compose_message(to, subject, text, captcha = nil, identifier = nil) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/redd/client/authenticated/private_messages.rb', line 10

def compose_message(to, subject, text, captcha = nil, identifier = nil)
  params = {
    api_type: "json", to: to.to_s, subject: subject, text: text
  }
  params << {captcha: captcha, iden: identifier} if captcha

  post "/api/compose", params
end

#mark_as_read(message) ⇒ Object



19
20
21
22
# File 'lib/redd/client/authenticated/private_messages.rb', line 19

def mark_as_read(message)
  fullname = extract_fullname(message)
  post "/api/read_message", id: fullname
end

#mark_as_unread(message) ⇒ Object



24
25
26
27
# File 'lib/redd/client/authenticated/private_messages.rb', line 24

def mark_as_unread(message)
  fullname = extract_fullname(message)
  post "/api/unread_message", id: fullname
end

#messages(category = "inbox", params = {}) ⇒ Object



29
30
31
# File 'lib/redd/client/authenticated/private_messages.rb', line 29

def messages(category = "inbox", params = {})
  object_from_response :get, "/message/#{category}.json", params
end