Sha256: 5ec17b54da5bb514d2c3faa0031b74c4e7bd0a872fae46021f0d6474a7e1fa1e

Contents?: true

Size: 778 Bytes

Versions: 7

Compression:

Stored size: 778 Bytes

Contents

module DingBot
  module Message

    # FeedCard类型
    class FeedCard < Base
      attr_accessor :links

      def initialize(links=[])
        @links = links
      end

      def msg_type
        TYPE::FEED_CARD
      end

      def body_params
        super.merge(feedCard: {
            links: @links.map {|link| link.format}
        })
      end
    end

    # FeedCard跳转链接
    class FeedCardLink
      attr_accessor :title, :pic_url, :message_url

      def initialize(title='', pic_url='', message_url='')
        @title = title
        @pic_url = pic_url
        @message_url = message_url
      end

      def format
        {
            title: @title,
            messageURL: @message_url,
            picURL: @pic_url
        }
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dingbot-0.2.5 lib/dingbot/message/feed_card.rb
dingbot-0.2.3 lib/dingbot/message/feed_card.rb
dingbot-0.2.2 lib/dingbot/message/feed_card.rb
dingbot-0.2.1 lib/dingbot/message/feed_card.rb
dingbot-0.2.0 lib/dingbot/message/feed_card.rb
dingbot-0.1.1 lib/dingbot/message/feed_card.rb
dingbot-0.1.0 lib/dingbot/message/feed_card.rb