class ExceptionNotifier::IkachanNotifier::Client
Attributes
base_url[R]
Public Class Methods
new(base_url)
click to toggle source
# File lib/exception_notifier/ikachan_notifier.rb, line 8 def initialize(base_url) @base_url = base_url.match(/^https?:\/\/[^\/]+\//) ? base_url : "http://#{base_url}/" end
Public Instance Methods
notice_all(channels, message)
click to toggle source
# File lib/exception_notifier/ikachan_notifier.rb, line 13 def notice_all(channels, message) channels.each do |channel| join(channel) message.each_line do |line| notice(channel, line) end end end
Private Instance Methods
dispatch(type, params = {})
click to toggle source
# File lib/exception_notifier/ikachan_notifier.rb, line 31 def dispatch(type, params = {}) uri = URI.parse "#{base_url}#{type.to_s}" Net::HTTP.post_form uri, params end
join(channel)
click to toggle source
# File lib/exception_notifier/ikachan_notifier.rb, line 23 def join(channel) dispatch :join, 'channel' => channel end
notice(channel, message)
click to toggle source
# File lib/exception_notifier/ikachan_notifier.rb, line 27 def notice(channel, message) dispatch :notice, 'channel' => channel, 'message' => message end