Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 18th, 2012  |  syntax: None  |  size: 0.27 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. get '/answer' do
  2.   code, body = http_get( 'http://some.data.from.google.analytics.api' )
  3.   if 200 == code
  4.     data_points = parse_xml( body )
  5.     answer = calc_answer( data_points )
  6.     # render a view with the answer
  7.   else
  8.     # render a view with the error code
  9.   end
  10. end