Using APIs and writing to files with Sinatra