Module: Redd::Objects::Thing::Messageable
Overview
Things that can be sent a message.
Instance Method Summary collapse
-
#send_message(subject, text, from_sr = nil, captcha = nil, identifier = nil) ⇒ Object
Compose a message to a person or the moderators of a subreddit.
Instance Method Details
#send_message(subject, text, from_sr = nil, captcha = nil, identifier = nil) ⇒ Object
Compose a message to a person or the moderators of a subreddit.
rubocop:disable Metrics/MethodLength
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/redd/objects/thing/messageable.rb', line 17 def ( subject, text, from_sr = nil, captcha = nil, identifier = nil ) params = { subject: subject, text: text } if captcha params[:captcha] = captcha params[:iden] = identifier end params[:from_sr] = client.property(from_sr, :display_name) if from_sr params[:to] = if respond_to?(:display_name) "/r/#{self[:display_name]}" else self[:name] end post('/api/compose', params) end |