Sha256: f60620263ea1331b45bf0fe483af2b6370947f6d67cd4c82908df3d6b3dd2146

Contents?: true

Size: 762 Bytes

Versions: 4

Compression:

Stored size: 762 Bytes

Contents

# frozen_string_literal: true

require_relative 'lazy_model'
require_relative 'inboxable'
require_relative 'replyable'

module Redd
  module Models
    # A private message
    class PrivateMessage < LazyModel
      include Inboxable
      include Replyable

      # Make a Message from its id.
      # @option hash [String] :id the post's id (e.g. abc123)
      # @return [Submission]
      def self.from_response(client, hash)
        # FIXME: This returns the entire conversation, not the specific message. Possible to search,
        #   because depth of replies is just one.
        super
      end

      # Delete the message from the user's inbox.
      def delete
        @client.post('/api/del_msg', id: get_attribute(:name))
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redd-0.8.1 lib/redd/models/private_message.rb
redd-0.8.0 lib/redd/models/private_message.rb
redd-0.8.0.pre.2 lib/redd/models/private_message.rb
redd-0.8.0.pre.1 lib/redd/models/private_message.rb