/examples/google.rb

http://github.com/jnunemaker/httparty · Ruby · 16 lines · 10 code · 4 blank · 2 comment · 0 complexity · 586c4910e6a7a107bcfd1ac5ac8e997a MD5 · raw file

  1. dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
  2. require File.join(dir, 'httparty')
  3. require 'pp'
  4. class Google
  5. include HTTParty
  6. format :html
  7. end
  8. # google.com redirects to www.google.com so this is live test for redirection
  9. pp Google.get('http://google.com')
  10. puts '', '*' * 70, ''
  11. # check that ssl is requesting right
  12. pp Google.get('https://www.google.com')