Class: NotificationServices::CampfireService

Inherits:
NotificationService
  • Object
show all
Defined in:
app/models/notification_services/campfire_service.rb

Constant Summary collapse

Label =
"campfire"

Instance Method Summary collapse

Instance Method Details

#check_paramsObject


19
20
21
22
23
# File 'app/models/notification_services/campfire_service.rb', line 19

def check_params
  if Fields.detect {|f| self[f[0]].blank? }
    errors.add :base, 'You must specify your Campfire Subdomain, API token and Room ID'
  end
end

#create_notification(problem) ⇒ Object


29
30
31
32
33
34
# File 'app/models/notification_services/campfire_service.rb', line 29

def create_notification(problem)
  # build the campfire client
  campy = Campy::Room.new(:account => subdomain, :token => api_token, :room_id => room_id)
  # post the issue to the campfire room
  campy.speak "[errbit] #{problem.app.name} #{notification_description problem} - #{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s}/problems/#{problem.id.to_s}"
end

#urlObject


25
26
27
# File 'app/models/notification_services/campfire_service.rb', line 25

def url
  "http://#{subdomain}.campfirenow.com/"
end