Class: Dingding::Notifier::PayloadMiddleware::FormatFeedCard

Inherits:
Base
  • Object
show all
Defined in:
lib/dingding-notifier/payload_middleware/format_feed_card.rb

Instance Attribute Summary

Attributes inherited from Base

#notifier, #options

Instance Method Summary collapse

Methods inherited from Base

default_opts, #initialize, middleware_name, options

Constructor Details

This class inherits a constructor from Dingding::Notifier::PayloadMiddleware::Base

Instance Method Details

#call(payload = {}) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/dingding-notifier/payload_middleware/format_feed_card.rb', line 30

def call payload={}
  
  return payload unless payload[:format_feed_card]
  tmp = options[:formats].dup
  tmp[:at][:atMobiles] = payload[:atMobiles] if payload.has_key?(:atMobiles)
  tmp[:at][:atUserIds] = payload[:atUserIds] if payload.has_key?(:atUserIds)
  tmp[:at][:isAtAll] = payload[:isAtAll] if payload.has_key?(:isAtAll)
  tmp[:feedCard] = payload[:format_feed_card] if payload.has_key?(:format_feed_card)
  tmp
end