Class: BotFramework::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/bot_framework/message.rb

Constant Summary collapse

TEXT_FORMAT =
{
  plain: 'plain',
  markdown: 'markdown',
  xml: 'xml'
}.freeze
ATTACHMENT_LAYOUT =
{
  list: 'list',
  carousel: 'carousel'
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_session = nil) ⇒ Message

Returns a new instance of Message.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bot_framework/message.rb', line 13

def initialize(_session = nil)
  @data = {}
  @data[:type] = 'consts.MessageType' # FIXME
  @data[:agent] = 'consts.agent'
  if @session
    m = @session.message
    @data[:source] = m[:source] if m[:source]
    @data[:text_locale] = m[:text_locale] if m[:text_locale]
    @data[:address] = m[:address] if m[:address]
  end
end

Class Method Details

.compose_promptObject



77
# File 'lib/bot_framework/message.rb', line 77

def compose_prompt; end

.random_promptObject



75
# File 'lib/bot_framework/message.rb', line 75

def random_prompt; end

Instance Method Details

#add_attachmentObject



60
# File 'lib/bot_framework/message.rb', line 60

def add_attachment; end

#add_entityObject



64
# File 'lib/bot_framework/message.rb', line 64

def add_entity; end

#addressObject



66
# File 'lib/bot_framework/message.rb', line 66

def address; end

#attachment_layoutObject



56
# File 'lib/bot_framework/message.rb', line 56

def attachment_layout; end

#attachmentsObject



58
# File 'lib/bot_framework/message.rb', line 58

def attachments; end

#compose(prompts, *args) ⇒ Object



47
48
49
50
51
52
# File 'lib/bot_framework/message.rb', line 47

def compose(prompts, *args)
  if prompts
    @data[:text] = Message.compose_prompt(@session, prompts, *args)
    self
  end
end

#entitiesObject



62
# File 'lib/bot_framework/message.rb', line 62

def entities; end

#ntext(msg, _msg_plural, count) ⇒ Object



40
41
42
43
44
45
# File 'lib/bot_framework/message.rb', line 40

def ntext(msg, _msg_plural, count)
  fmt = count == 1 ? self.class.random_prompt(msg) : self.class.random_prmpt(message_plural)
  fmt = @session.get_text(fmt) if @session
  @data[:text] = fmt, count # FIXME
  self
end

#source_eventObject



70
# File 'lib/bot_framework/message.rb', line 70

def source_event; end

#summaryObject



54
# File 'lib/bot_framework/message.rb', line 54

def summary; end

#text(text, *_args) ⇒ Object



35
36
37
38
# File 'lib/bot_framework/message.rb', line 35

def text(text, *_args)
  @data[:text] = text.present? ? format_text(text) : ''
  self
end

#text_format(style) ⇒ Object



30
31
32
33
# File 'lib/bot_framework/message.rb', line 30

def text_format(style)
  @data[:text_format] = style
  self
end

#text_locale(locale) ⇒ Object



25
26
27
28
# File 'lib/bot_framework/message.rb', line 25

def text_locale(locale)
  @data[:text_locale] = locale
  self
end

#timestampObject



68
# File 'lib/bot_framework/message.rb', line 68

def timestamp; end

#to_messageObject



72
# File 'lib/bot_framework/message.rb', line 72

def to_message; end