Skip to content

Instantly share code, notes, and snippets.

@toothrot
Created June 2, 2010 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toothrot/422884 to your computer and use it in GitHub Desktop.
Save toothrot/422884 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'growl'
require 'zendesk-api'
require 'tinder'
@z = Zendesk::Main.new("", "", "", :format => "json")
def count_for_rule(rule)
ticket_count = 0
page = 1
begin
list = @z.make_request("rules/#{rule}", :list => {:page => page})
tickets = JSON.parse(list.body)
ticket_count += tickets.size
page += 1
putc "."
STDOUT.flush
end while(!tickets.empty?)
ticket_count
end
urgent_ruleset = ""
unassigned_proddev = ""
urgent_count = count_for_rule(urgent_ruleset)
unassigned_count = count_for_rule(unassigned_proddev)
notification_message = ["#{unassigned_count} Unassigned ProdDev tickets", "#{urgent_count} Urgent Issues in Zendesk"]
Growl.notify(notification_message.first, :title => notification_message.last, :icon => "/Users/alexrakoczy/Downloads/cathead.jpg")
hosts = [""]
hosts.each do |host|
Growl.notify(notification_message.first, :title => notification_message.last, :host => "", :password => "", :icon => "/Users/alexrakoczy/Downloads/cathead.jpg")
end
puts ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment