Resolve all errors in Hoptoad for free

Apparently one needs a paid account to resolve all errors in Hoptoad. Fortunately there’s an API for the rest of us cheap bastards. Bellow is the Rake task that saves me $5 per month. Note that API doesn’t have bulk-resolve operation as I’ve expected, so time of execution depends directly on the number of unresolved errors.

require 'httparty'

namespace :hoptoad do
  task :resolve_all do
    
    # your credentials
    subdomain = 'killerapp'
    auth_token = 'ca140f0d8076e0f4e09237d0f45c70d0f4fc56e3'

    url = "http://#{subdomain}.hoptoadapp.com/errors.xml?auth_token=#{auth_token}"
    while errors = HTTParty.get(url)['groups'] do
      errors.each do |e|
        HTTParty.put(url.gsub('.xml', "/#{e['id']}"), :headers => {"Content-length" => "0"}, :query => {:group => {:resolved => true}})
      end
    end
  end
end