Class: Dingding::Notifier::PayloadMiddleware::FormatLink

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



25
26
27
28
29
30
31
32
33
34
# File 'lib/dingding-notifier/payload_middleware/format_link.rb', line 25

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