Class: Dingding::Notifier::PayloadMiddleware::FormatMarkdown
- Defined in:
- lib/dingding-notifier/payload_middleware/format_markdown.rb
Instance Attribute Summary
Attributes inherited from Base
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
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/dingding-notifier/payload_middleware/format_markdown.rb', line 23 def call payload={} return payload unless payload[:format_markdown] tmp = [:formats].dup tmp[:at][:atUserIds] = payload[:atUserIds] if payload.has_key?(:atUserIds) tmp[:at][:isAtAll] = payload[:isAtAll] if payload.has_key?(:isAtAll) tmp[:markdown] = payload[:format_markdown] if payload.has_key?(:format_markdown) if payload.has_key?(:atMobiles) tmp[:at][:atMobiles] = payload[:atMobiles] tmp[:markdown][:text] = "#### #{tmp[:markdown][:title]} #{payload[:atMobiles].map{|a| "@#{a} "}.join(' ')} \n #{tmp[:markdown][:text]}" end tmp end |