Class: ChatworkTo::Notifiers::Slack

Inherits:
Object
  • Object
show all
Defined in:
lib/chatwork_to/notifiers/slack.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Slack

Returns a new instance of Slack.



6
7
8
9
10
# File 'lib/chatwork_to/notifiers/slack.rb', line 6

def initialize(opts = {})
  @debug = !!opts.delete('debug')
  build_uri
  build_default_query(opts)
end

Instance Method Details

#info(message) ⇒ Object



19
20
21
# File 'lib/chatwork_to/notifiers/slack.rb', line 19

def info(message)
  exec_notify(post_request(text: decorate(message)))
end

#notify(hash) ⇒ Object



12
13
14
15
16
17
# File 'lib/chatwork_to/notifiers/slack.rb', line 12

def notify(hash)
  hash['chat_list'].each do |chat|
    text, attachment = request_body(chat, hash['room'], hash['users'])
    exec_notify(post_request(text: text, attachment: attachment))
  end
end