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.



4
5
6
7
8
# File 'lib/chatwork_to/notifiers/slack.rb', line 4

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

Instance Method Details

#info(message) ⇒ Object



17
18
19
# File 'lib/chatwork_to/notifiers/slack.rb', line 17

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

#notify(hash) ⇒ Object



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

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