Class: Teams::Api::MessagingExtensionAttachment

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

Overview

An attachment in a message extension result; preview: carries the optional preview card shown in the result list.

Instance Method Summary collapse

Constructor Details

#initialize(content_type: nil, content: nil, content_url: nil, name: nil, thumbnail_url: nil, preview: nil) ⇒ MessagingExtensionAttachment

Returns a new instance of MessagingExtensionAttachment.



8
9
10
11
12
13
14
15
16
# File 'lib/teams/api/message_extension.rb', line 8

def initialize(content_type: nil, content: nil, content_url: nil, name: nil,
               thumbnail_url: nil, preview: nil)
  @content_type = content_type
  @content = content
  @content_url = content_url
  @name = name
  @thumbnail_url = thumbnail_url
  @preview = preview
end

Instance Method Details

#to_hObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/teams/api/message_extension.rb', line 18

def to_h
  body = {}
  body["contentType"] = @content_type if @content_type
  body["content"] = serialize(@content) if @content
  body["contentUrl"] = @content_url if @content_url
  body["name"] = @name if @name
  body["thumbnailUrl"] = @thumbnail_url if @thumbnail_url
  body["preview"] = serialize(@preview) if @preview
  body
end