Module: Snooby::Compose

Included in:
Subreddit, User
Defined in:
lib/snooby/actions.rb

Instance Method Summary collapse

Instance Method Details

#compose(subject, text) ⇒ Object Also known as: message

Sends a message to the calling object, which is either a subreddit or a user; in the case of the former, this behaves like moderator mail.

Raises:



59
60
61
62
63
64
65
# File 'lib/snooby/actions.rb', line 59

def compose(subject, text)
  raise RedditError, 'You are not logged in.' unless Snooby.active

  to = (@kind == 'user' ? '' : '#') + @name
  data = {:to => to, :subject => subject, :text => text}
  Snooby.request(Paths[:compose], data)
end