Examples
Wondering what you can do with the Gumband API? Here are a few quick examples to get your wheels turning.
Example 1: Calculate the tip on a restaurant bill.
What is it?
A simple tip calculator. Text TIP and the amount of your bill to 25252. For example, try: TIP 45.67, and you will receive the amount to tip for 15% and 20% of the bill.
How does it work?
This is a simple call and response. We parse out the amount that you send in, calculate the proper percentages and send it back.
Show me the code
This example was written in Ruby on Rails. View the code for the main controller here.
Example 2: Get upcoming events in your city.
What is it?
A simple method of finding out what's going on in a particular city. Text UPCOMING and the name of a city to 25252. For example, try: UPCOMING Las Vegas, and you will receive the name and location of an event happening today in Las Vegas.
How does it work?
We parse out the city that is sent in and then use the Upcoming API to find a corresponding metro area. Once we have the metro area, we again use the Upcoming API to request events going on in that area today. Finally, when we have a list of events, we pick one at random and send it back to the user.
Show me the code
This example was written in PHP. View the code here. You will need to register your own Yahoo API if you want to try it out on your own.
Example 3: Give me something to talk about.
What is it?
Get a strange news headline and lead text, perfect for starting conversations to fill awkward silence. Text DISCUSS to 25252.
How does it work?
We grab the topix RSS feed for Weird News, pick a random news item and send it back.
Show me the code
This example was written in PHP. View the code here.
