Sha256: 27402920c19b1c82d77cf3dbc2e47fdd89ede11ead50026bcb7d35a700e6d82f

Contents?: true

Size: 790 Bytes

Versions: 7

Compression:

Stored size: 790 Bytes

Contents

module NeonRAW
  module Objects
    class Thing
      # Methods for things that can be replied to.
      module Repliable
        # Leaves a comment/PM reply to the thing.
        # @!method reply(text)
        # @param text [String] The text body of the comment.
        # @return [NeonRAW::Objects::Comment/PrivateMessage] Returns the object.
        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
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
NeonRAW-0.1.7 lib/NeonRAW/objects/thing/repliable.rb
NeonRAW-0.1.6 lib/NeonRAW/objects/thing/repliable.rb
NeonRAW-0.1.5 lib/NeonRAW/objects/thing/repliable.rb
NeonRAW-0.1.4 lib/NeonRAW/objects/thing/repliable.rb
NeonRAW-0.1.3 lib/NeonRAW/objects/thing/repliable.rb
NeonRAW-0.1.2 lib/NeonRAW/objects/thing/repliable.rb
NeonRAW-0.1.1 lib/NeonRAW/objects/thing/repliable.rb