# sometimes it's really hard to debug library that use Net::HTTP when they do # not expose the 'debug_output' it supports interally since that option *must* # be set *before* starting a connection. dropping this little snippet into # any code that uses Net::HTTP will make it dump debug output to stderr # regardless of how the wrapper library is using it. this example uses # basecamp, but the approach is the same for all libraries. # # monkey-patch # require 'net/http' class Net::HTTP alias_method '__initialize__', 'initialize' def initialize(*args,&block) __initialize__(*args, &block) ensure @debug_output = $stderr end end # now this call will dump connection info to STDERR # require 'basecamp.rb' token = ARGV.shift Basecamp.establish_connection!('dojo4.basecamphq.com', token, 'X', use_ssl=true) Basecamp::Project.find(:all)