Fixing test suit and some clean up

The tests were assuming the old API address.
I also extracted the API stub into a separate class.
This also fixes load problems under Ruby 1.9
That should probably have been separate commits, but I hope it's fine anyway.