#!/usr/bin/env ruby

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

require 'browshot'

browshot = Browshot.new('my_api_key')

# You must request HTML when creating the screenshot
screenshot = browshot.screenshot_create('http://mobilio.net/', { 'instance_id' => 24, 'screen_width' => 1280, 'screen_height' => 1024, 'html' => 1 })
sleep(60)

screenshot = browshot.screenshot_info(screenshot['id'])
if (screenshot['status'] == 'finished')
  html = browshot.screenshot_html(screenshot['id'])
  if (html.length > 0)
    puts "HTML is available\n"
#    puts html
  end
end