Created
April 14, 2013 21:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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