moved api code into api dir and renamed test.rb to api.rb