class Message::MessageCard

MessageCard type

Public Instance Methods

content() click to toggle source

Get the body of the POST message as JSON.

# File lib/capistrano/teams/message/types.rb, line 54
def content
  {
    '@type' => 'MessageCard',
    '@context' => 'http://schema.org/extensions',
    'themeColor' => @theme_color,
    'summary' => fetch(:teams_card_message_summary),
    'sections' => sections,
    'potentialAction' => []
  }.to_json % placeholders
end

Private Instance Methods

facts() click to toggle source
# File lib/capistrano/teams/message/types.rb, line 77
def facts
  [
    {
      'name' => 'Deploy by',
      'value' => '%<user>s'
    },
    {
      'name' => 'Branch',
      'value' => '%<branch>s'
    },
    {
      'name' => 'Deploy date',
      'value' => Time.now.strftime('%d/%m/%Y %H:%M:%S')
    }, {
      'name' => 'Status',
      'value' => '%<status>s'
    }
  ].concat(@facts)
end
sections() click to toggle source
# File lib/capistrano/teams/message/types.rb, line 67
def sections
  [{
    'activityTitle' => fetch(:teams_card_message_title),
    'activitySubtitle' => fetch(:teams_card_message_sub_title),
    'activityImage' => fetch(:teams_card_message_image),
    'facts' => facts,
    'markdown' => fetch(:teams_card_message_markdown)
  }]
end