Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (23 sloc) 0.589 kb
$:.unshift "sinatra/lib"
require 'rubygems'
require 'sinatra'
require 'open-uri'
require 'json'
require 'cgi'
require 'ebay-private'
before do
# set UTF-8
header "Content-Type" => "text/html; charset=utf-8"
# set css body id
@body_id = "home"
end
get "/" do
erb :index
end
get "/search" do
url = "http://open.api.ebay.com/shopping?appid=#{EBAY_APP_ID}&version=517&siteid=0&callname=FindItems&QueryKeywords=#{CGI.escape(params["q"])}&responseencoding=JSON"
json_response = open(url).read
result = JSON.parse(json_response)
@items = result["Item"]
erb :search
end
Jump to Line
Something went wrong with that request. Please try again.