Class: Kindling::Campfire

Inherits:
Object
  • Object
show all
Defined in:
lib/kindling/campfire.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_token, subdomain, ssl = false) ⇒ Campfire

Returns a new instance of Campfire.



7
8
9
10
11
# File 'lib/kindling/campfire.rb', line 7

def initialize(api_token, subdomain, ssl=false)
  @api_token = api_token
  @subdomain = subdomain            
  @ssl = ssl
end

Instance Attribute Details

#api_tokenObject

Returns the value of attribute api_token.



5
6
7
# File 'lib/kindling/campfire.rb', line 5

def api_token
  @api_token
end

#sslObject

Returns the value of attribute ssl.



5
6
7
# File 'lib/kindling/campfire.rb', line 5

def ssl
  @ssl
end

#subdomainObject

Returns the value of attribute subdomain.



5
6
7
# File 'lib/kindling/campfire.rb', line 5

def subdomain
  @subdomain
end

Instance Method Details

#credentialsObject



25
26
27
# File 'lib/kindling/campfire.rb', line 25

def credentials
  {:username => @api_token, :password => 'x'}
end

#roomsObject



13
14
15
# File 'lib/kindling/campfire.rb', line 13

def rooms
  Kindling::Request.rooms(self)
end

#speak(room, message, type = "Textmessage") ⇒ Object



17
18
19
20
21
22
23
# File 'lib/kindling/campfire.rb', line 17

def speak(room, message, type="Textmessage")
  if is_campfire_id?(room)
    Kindling::Request.speak(message, self, room, type)
  else
    Kindling::Request.speak(message, self, map_room_name(room), type)
  end
end