Class: Xify::Output::RocketChat
- Inherits:
-
Base::RocketChat
- Object
- Base::RocketChat
- Xify::Output::RocketChat
- Defined in:
- lib/xify/output/rocket_chat.rb
Instance Method Summary collapse
Methods inherited from Base::RocketChat
Constructor Details
This class inherits a constructor from Xify::Base::RocketChat
Instance Method Details
#process(event) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/xify/output/rocket_chat.rb', line 10 def process(event) request :post, '/api/v1/chat.postMessage' do |req| req['Content-Type'] = 'application/json' if @config['alias'] = event. title = event.args[:parent] else = nil title = "#{event.args[:parent]} by #{event.author}" end req.body = { channel: @config['channel'], alias: , attachments: [ { title: title, title_link: event.args[:parent_link], text: event.args[:link] ? "#{event.message.chomp}\n\n([link to source](#{event.args[:link]}))" : event..chomp } ] }.to_json end end |