Class: NotificationServices::FlowdockService

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

Constant Summary collapse

Label =
'flowdock'

Instance Method Summary collapse

Instance Method Details

#check_paramsObject


13
14
15
16
17
# File 'app/models/notification_services/flowdock_service.rb', line 13

def check_params
  if Fields.any? { |f, _| self[f].blank? }
    errors.add :base, 'You must specify your Flowdock(Flow) API token'
  end
end

#create_notification(problem) ⇒ Object


23
24
25
26
27
28
# File 'app/models/notification_services/flowdock_service.rb', line 23

def create_notification(problem)
  flow = Flowdock::Flow.new(:api_token => api_token, :source => "Errbit", :from => {:name => "Errbit", :address => ENV['ERRBIT_EMAIL_FROM'] || '[email protected]'})
  subject = "[#{problem.environment}] #{problem.message.to_s.truncate(100)}"
  url = app_problem_url problem.app, problem
  flow.push_to_team_inbox(:subject => subject, :content => content(problem, url), :project => project_name(problem), :link => url)
end

#urlObject


19
20
21
# File 'app/models/notification_services/flowdock_service.rb', line 19

def url
  'https://www.flowdock.com/session'
end