Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Like this? Share it with your network

Share

Order pizza from Boxee

on

  • 877 views

 

Statistics

Views

Total Views
877
Views on SlideShare
870
Embed Views
7

Actions

Likes
0
Downloads
2
Comments
0

2 Embeds 7

http://easierbycode.com 6
http://www.tumblr.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Order pizza from Boxee Presentation Transcript

  • 1. ORDER PIZZA
    ROB – GONZEE.TV
  • 2. HI
  • 3. I’M ROB! (yet again)
  • 4. USEFULNESS OF SOFTWARE
  • 5. PIZZA POWER
  • 6. /pizza
    >
  • 7. WEB STANDARDS FTW!
    >
  • 8. I H8 ATT
    >
  • 9. :(
  • 10. ORDER PIZZA
    (totally demoing theapp)
  • 11. ORDER PIZZA
    Resources
    Onclick events
    Intro to TwiML
    CODE
    easy buddy
  • 12. 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/
  • 13. HOW IT WORKS
  • 14. SUPER SMASH!
  • 15. YELP CODE
    results = 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)
  • 16. EVENT
    n = 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.")
  • 17. 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);
  • 18. 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']
    ));
  • 19. 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>
  • 20. DONE
  • 21. QUESTIONS?
  • 22. 10001110111
    Downloadhttp://dir.gonzee.tv/download/tv.gonzee.orderpizza.zip
    Checkoutsvn checkout http://twilio-boxee-hackathon.googlecode.com/svn/trunk/orderpizza/twilio-boxee-hackathon-read-only
  • 23. KTHX