Class: NotificationServices::PushoverService

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

Constant Summary collapse

Label =
"pushover"

Instance Method Summary collapse

Instance Method Details

#check_paramsObject


14
15
16
17
18
# File 'app/models/notification_services/pushover_service.rb', line 14

def check_params
  if Fields.detect {|f| self[f[0]].blank? }
    errors.add :base, 'You must specify your User Key and Application API Token.'
  end
end

#create_notification(problem) ⇒ Object


24
25
26
27
28
29
30
31
# File 'app/models/notification_services/pushover_service.rb', line 24

def create_notification(problem)
  # build the hoi client
  notification = Rushover::Client.new(subdomain)

  # send push notification to pushover
  notification.notify(api_token, "#{notification_description problem}", :priority => 1, :title => "Errbit Notification", :url => "#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s}", :url_title => "Link to error")

end

#urlObject


20
21
22
# File 'app/models/notification_services/pushover_service.rb', line 20

def url
  "https://pushover.net/login"
end