Class: Envoy::Campfire

Inherits:
Transport show all
Defined in:
lib/envoy/transport.rb

Instance Attribute Summary collapse

Attributes inherited from Transport

#errors

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Campfire

Returns a new instance of Campfire.



40
41
42
43
44
45
# File 'lib/envoy/transport.rb', line 40

def initialize(options = {})
  self. = options[:account]
  self.room = options[:room]
  self.token = options[:token]
  self.use_ssl = options[:use_ssl]
end

Instance Attribute Details

#accountObject

Returns the value of attribute account.



38
39
40
# File 'lib/envoy/transport.rb', line 38

def 
  @account
end

#roomObject

Returns the value of attribute room.



38
39
40
# File 'lib/envoy/transport.rb', line 38

def room
  @room
end

#tokenObject

Returns the value of attribute token.



38
39
40
# File 'lib/envoy/transport.rb', line 38

def token
  @token
end

#use_sslObject

Returns the value of attribute use_ssl.



38
39
40
# File 'lib/envoy/transport.rb', line 38

def use_ssl
  @use_ssl
end

Instance Method Details

#send_message(message) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/envoy/transport.rb', line 47

def send_message(message)
  Broach.settings = { 'account' => @account, 'token' => @token, 'use_ssl' => @use_ssl }
  Broach.speak(self.room, message.body || message.subject)

  return true

  rescue Broach::APIError => error
    self.errors << SendError.new(error, Time.now)
    return false
end