module SlackTsuribari::Angler

Public Class Methods

easy_throw!(hook, message = nil) click to toggle source
# File lib/slack_tsuribari/angler.rb, line 8
def easy_throw!(hook, message = nil)
  payload = message.nil? ? nil : { text: message }
  throw_action(hook, payload, true)
end
throw!(hook, payload = nil) click to toggle source
# File lib/slack_tsuribari/angler.rb, line 13
def throw!(hook, payload = nil)
  throw_action(hook, payload, true)
end

Private Class Methods

throw_action(hook, payload, auto_detach) click to toggle source
# File lib/slack_tsuribari/angler.rb, line 19
def throw_action(hook, payload, auto_detach)
  hook.attach(payload)
  Connection.new(hook.uri, hook.setting).post(hook.payload_to_json)
ensure
  hook.detach if auto_detach
end