Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.