Sha256: 8c014884856f3e707b28852ad5f82abb5fa2fc8c9bf9347c378ddc35fec9059c

Contents?: true

Size: 931 Bytes

Versions: 7

Compression:

Stored size: 931 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

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

      # Mute the author of the message.
      def mute_author
        @client.post('/api/mute_message_author', id: get_attribute(:name))
      end

      # Unmute the author of the message.
      def unmute_author
        @client.post('/api/unmute_message_author', id: get_attribute(:name))
      end

      private

      def default_loader
        # FIXME: This returns the entire conversation, not the specific message. Possible to search,
        #   because depth of replies is just one.
        {}
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
redd-0.8.8 lib/redd/models/private_message.rb
redd-0.8.7 lib/redd/models/private_message.rb
redd-0.8.6 lib/redd/models/private_message.rb
redd-0.8.5 lib/redd/models/private_message.rb
redd-0.8.4 lib/redd/models/private_message.rb
redd-0.8.3 lib/redd/models/private_message.rb
redd-0.8.2 lib/redd/models/private_message.rb