#!/usr/bin/env ruby

#######################
# WARNING
# Running this code sample will cost you Browshot credits
#######################

require 'browshot'

browshot = Browshot.new('my_api_key')

info = browshot.simple_file('google-640.png', { 'url' => 'http://www.google.com/', 'width' => 640, 'height' => 480 })

if (info[:file] == '' || info[:code].to_i != 200)
  puts "Screenshot failed\n"
else
  puts "Thumbnail saved at #{info[:file]}\n"
end
