23
ORDER PIZZA ROB – GONZEE.TV

ORDER PIZZA

  • Upload
    radha

  • View
    75

  • Download
    0

Embed Size (px)

DESCRIPTION

ORDER PIZZA. ROB – GONZEE.TV. HI. I’M ROB ! (yet again). USEFULNESS OF SOFTWARE. PIZZA POWER. /pizza. >. WEB STANDARDS FTW!. >. I H8 ATT. >. :(. ORDER PIZZA. (totally demoing theapp ). ORDER PIZZA. Resources Onclick events Intro to TwiML CODE. easy buddy. - PowerPoint PPT Presentation

Citation preview

Page 1: ORDER PIZZA

ORDER PIZZAROB – GONZEE.TV

Page 2: ORDER PIZZA

HI

Page 3: ORDER PIZZA

I’M ROB! (yet again)

Page 4: ORDER PIZZA

USEFULNESS OF SOFTWARE

Page 5: ORDER PIZZA

PIZZA POWER

Page 6: ORDER PIZZA

/pizza

>

Page 7: ORDER PIZZA

WEB STANDARDS FTW!

>

Page 8: ORDER PIZZA

I H8 ATT

>

Page 9: ORDER PIZZA

:(

Page 10: ORDER PIZZA

ORDER PIZZA

(totally demoing theapp)

Page 11: ORDER PIZZA

ORDER PIZZA

ResourcesOnclick eventsIntro to TwiMLCODE easy

buddy

Page 12: ORDER PIZZA

GET MACGUYVER ON IT Onclick events -

http://developer.boxee.tv/Python_API#Examples

Twilio PHP library - http://www.twilio.com/docs/libraries/

Yelp Python module - http://code.google.com/p/yelp-python-client/

Page 13: ORDER PIZZA

HOW IT WORKS

Page 14: ORDER PIZZA

SUPER SMASH!

Page 15: ORDER PIZZA

YELP CODEresults = yelp.ReviewSearchApi(client_key="e482aAygGs2SeCGxlwQg3w", output="json").by_location(zipcode, term="pizza", radius="1")rows = results["businesses"]

container = mc.ListItems()for row in rows:

newitem = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN)newitem.SetLabel( str(row["name"]) )newitem.SetThumbnail( str(row["rating_img_url"]) )newitem.SetProperty("address1", str(row["address1"]) )newitem.SetProperty("city", str(row["city"]) )newitem.SetProperty("state", str(row["state"]) )newitem.SetProperty("avg_rating", str(row["avg_rating"]))business_phone = "(" + str(row["phone"][0:3]) + ")" + str(row["phone"][3:6]) + "-"

+ str(row["phone"][6:10])newitem.SetProperty("phone", business_phone)newitem.SetProperty("int_phone", str(row["phone"]))newitem.SetPath(str(row["name"]))if row["is_closed"] == True:

newitem.SetProperty("closed", "No")else:

newitem.SetProperty("closed", "Yes")container.append(newitem)

list = mc.GetWindow(14000).GetList(111).SetItems(container)

Page 16: ORDER PIZZA

EVENTn = mc.GetWindow(14000).GetList(111).GetFocusedItem()listitem = mc.GetWindow(14000).GetList(111).GetItem(n)pizza_number = listitem.GetProperty("int_phone")

url = "http://apps.gonzee.tv/orderpizza/makecall.php"values = {'called' : telephone, 'outgoing' : pizza_number}data = urllib.urlencode(values)req = urllib2.Request(url, data)response = urllib2.urlopen(req)mc.ShowDialogOk("Calling...", "We are calling this pizza place on your behalf. Expect a call shortly.")

Page 17: ORDER PIZZA

SERVER-SIDE – TWILIO LIBRARY

require "twilio.php";

/* Twilio REST API version */$ApiVersion = "2008-08-01";

/* Set our AccountSid and AuthToken */$AccountSid = “INSERTACCOUNTSID";$AuthToken = “INSERTAUTHTOKEN";

/* Outgoing Caller ID you have previously validated with Twilio */$number = ‘INSERTPHONENUMBER';

/* Outgoing Number you wish to call */if (!isset($_REQUEST['outgoing'])) {

$err = urlencode("Must specify outgoing phone number."); header("Location: index.php?msg=$err"); die;}

/* Instantiate a new Twilio Rest Client */$client = new TwilioRestClient($AccountSid, $AuthToken);

Page 18: ORDER PIZZA

MAKING THE CALL/* make Twilio REST request to initiate outgoing call

*/$response =

$client->request("/$ApiVersion/Accounts/$AccountSid/Calls",

"POST", array( "Caller" => $number, "Called" => $_REQUEST['called'], "Url" => $url . 'callback.php?number=' .

$_REQUEST['outgoing'] ));

Page 19: ORDER PIZZA

CONNECTING TO PIZZA<?php header("content-type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\

n";?><Response> <Say>Connecting you to pizza - please hold.</Say> <Dial><?php echo $_REQUEST['number']?></Dial></Response>

Page 20: ORDER PIZZA

DONE

Page 21: ORDER PIZZA

QUESTIONS?

Page 23: ORDER PIZZA

KTHX