Created
June 2, 2010 19:48
-
-
Save toothrot/422884 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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