Class: Teams::Api::MessagingExtensionResult

Inherits:
Object
  • Object
show all
Defined in:
lib/teams/api/message_extension.rb

Overview

type: "result", "auth", "config", "message", "botMessagePreview", or "silentAuth"; attachment_layout: "list" or "grid".

Instance Method Summary collapse

Constructor Details

#initialize(type: nil, attachment_layout: nil, attachments: nil, suggested_actions: nil, text: nil, activity_preview: nil) ⇒ MessagingExtensionResult

Returns a new instance of MessagingExtensionResult.



40
41
42
43
44
45
46
47
48
# File 'lib/teams/api/message_extension.rb', line 40

def initialize(type: nil, attachment_layout: nil, attachments: nil,
               suggested_actions: nil, text: nil, activity_preview: nil)
  @type = type
  @attachment_layout = attachment_layout
  @attachments = attachments
  @suggested_actions = suggested_actions
  @text = text
  @activity_preview = activity_preview
end

Instance Method Details

#to_hObject



50
51
52
53
54
55
56
57
58
59
# File 'lib/teams/api/message_extension.rb', line 50

def to_h
  body = {}
  body["type"] = @type if @type
  body["attachmentLayout"] = @attachment_layout if @attachment_layout
  body["attachments"] = @attachments.map { |attachment| serialize(attachment) } if @attachments
  body["suggestedActions"] = serialize(@suggested_actions) if @suggested_actions
  body["text"] = @text if @text
  body["activityPreview"] = serialize(@activity_preview) if @activity_preview
  body
end