Class: InstagramConnect::Message

Inherits:
ApplicationRecord show all
Defined in:
app/models/instagram_connect/message.rb

Overview

One message bubble in a DM thread (or a story reply mirrored as a DM).

Constant Summary collapse

DIRECTIONS =
%w[inbound outbound].freeze
STATUSES =
%w[received pending sending sent failed].freeze
KINDS =
%w[dm story_reply reaction].freeze
SOURCES =
%w[inbound manual api operator_app].freeze
MEDIA_STATUSES =
%w[none pending downloadable attached unavailable].freeze
PREVIEW_LIMIT =
140

Instance Method Summary collapse

Instance Method Details

#inbound?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'app/models/instagram_connect/message.rb', line 23

def inbound?
  direction == "inbound"
end

#outbound?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'app/models/instagram_connect/message.rb', line 27

def outbound?
  direction == "outbound"
end

#previewObject

Short summary used for the inbox row preview.



32
33
34
35
# File 'app/models/instagram_connect/message.rb', line 32

def preview
  return body.to_s.truncate(PREVIEW_LIMIT) if body.present?
  "[#{kind}]"
end