Module: NeonRAW::Objects::Thing::Repliable

Included in:
Comment, InboxComment, PrivateMessage, Submission
Defined in:
lib/NeonRAW/objects/thing/repliable.rb

Overview

Methods for things that can be replied to.

Instance Method Summary collapse

Instance Method Details

#reply(text) ⇒ NeonRAW::Objects::Comment/PrivateMessage

Leaves a comment/PM reply to the thing.

Parameters:

  • text (String)

    The text body of the comment.

Returns:



10
11
12
13
14
15
16
17
18
19
# File 'lib/NeonRAW/objects/thing/repliable.rb', line 10

def reply(text)
  params = { api_type: 'json', text: text, thing_id: name }
  data = @client.request_data('/api/comment', :post, params)
  object_data = data[:json][:data][:things][0][:data]
  if data[:kind] == 't1'
    Comment.new(@client, object_data)
  elsif data[:kind] == 't4'
    PrivateMessage.new(@client, object_data)
  end
end