Class: Nuntius::SlackSlackProvider
- Inherits:
-
BaseProvider
- Object
- BaseProvider
- Nuntius::SlackSlackProvider
- Defined in:
- app/providers/nuntius/slack_slack_provider.rb
Instance Attribute Summary
Attributes inherited from BaseProvider
Instance Method Summary collapse
Methods inherited from BaseProvider
all_settings, #callback, class_from_name, #initialize, #name, #refresh, setting_reader, states, transport
Constructor Details
This class inherits a constructor from Nuntius::BaseProvider
Instance Method Details
#deliver ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/providers/nuntius/slack_slack_provider.rb', line 11 def deliver client = Slack::Web::Client.new(token: api_key) ..each do || client.files_upload( channels: [:to], as_user: true, username: [:from], file: Faraday::UploadIO.new(StringIO.new(.download), .content_type), filename: .filename.to_s ) end args = (.payload || {}).merge(channel: [:to], text: .text, as_user: true, username: [:from]) response = client.chat_postMessage(args.deep_symbolize_keys) .status = if response["ok"] "sent" else "undelivered" end end |