Skip to content

Instantly share code, notes, and snippets.

@dingeuwen
Created April 14, 2013 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dingeuwen/5384283 to your computer and use it in GitHub Desktop.
Save dingeuwen/5384283 to your computer and use it in GitHub Desktop.
require 'open-uri'
class Googleproductssearch
def initialize(query)
@query = query
end
def search
# NOTE THAT I HAD TO REMOVE THE URI ESCAPE STUFF BECAUSE WAS GETTING GSUB ERROR AND COULDN'T FIX THAT BUG.
file = open("https://www.googleapis.com/shopping/search/v1/public/products?key=AIzaSyBtm1EPiT8NUSsgTJhBb5dxlhGAi8FvLu4&country=US&q=#{URI.escape(@q)}", :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE)
JSON.load(file.read)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment