Class: Janky::ChatService::Flowdock

Inherits:
Object
  • Object
show all
Defined in:
lib/janky-flowdock.rb,
lib/janky-flowdock/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Constructor Details

#initialize(settings) ⇒ Flowdock

Returns a new instance of Flowdock.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/janky-flowdock.rb', line 7

def initialize(settings)
	token = settings["JANKY_CHAT_FLOWDOCK_TOKEN"]
	if token.nil? || token.empty?
		raise Error, "JANKY_CHAT_FLOWDOCK_TOKEN setting is required"
	end

	from_name = settings["JANKY_CHAT_FLOWDOCK_FROM_NAME"] || "CI"
     from_email = settings["JANKY_CHAT_FLOWDOCK_FROM_EMAIL"]
     source = settings["JANKY_CHAT_FLOWDOCK_SOURCE"] || "Janky"

	@client = ::Flowdock::Flow.new(api_token: token, source: source, from: {name: from_name, address: from_email})
end

Instance Method Details

#roomsObject



25
26
27
# File 'lib/janky-flowdock.rb', line 25

def rooms
	[]
end

#speak(message, room_id, options = {}) ⇒ Object



20
21
22
23
# File 'lib/janky-flowdock.rb', line 20

def speak(message, room_id, options = {})
     subject = "CI build status"
	@client.push_to_team_inbox(content: message, subject: subject, tags: ["ci"])
end