Class: Dingding::Notifier::PayloadMiddleware::FormatActionCard

Inherits:
Base
  • Object
show all
Defined in:
lib/dingding-notifier/payload_middleware/format_action_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



32
33
34
35
36
37
38
39
40
41
# File 'lib/dingding-notifier/payload_middleware/format_action_card.rb', line 32

def call payload={}
  
  return payload unless payload[:format_action_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[:actionCard] = payload[:format_action_card] if payload.has_key?(:format_action_card)
  tmp
end