aboutsummaryrefslogtreecommitdiff
path: root/libraries/Bridge/examples/Temboo
diff options
context:
space:
mode:
authorFederico Fissore <f.fissore@arduino.cc>2013-07-08 15:09:09 +0200
committerFederico Fissore <f.fissore@arduino.cc>2013-07-08 15:09:09 +0200
commitacf38a634ab0f5530ca5f0b15bc4c474b1091195 (patch)
tree70039a97db754ac391f50ff8048c2d42233170ee /libraries/Bridge/examples/Temboo
parent320116c2867f981b0292cd10f77e2a6a7c604f49 (diff)
updated temboo examples
Diffstat (limited to 'libraries/Bridge/examples/Temboo')
-rw-r--r--libraries/Bridge/examples/Temboo/GetYahooWeatherReport/GetYahooWeatherReport.ino58
-rw-r--r--libraries/Bridge/examples/Temboo/ReadATweet/ReadATweet.ino94
-rw-r--r--libraries/Bridge/examples/Temboo/SendATweet/SendATweet.ino52
-rw-r--r--libraries/Bridge/examples/Temboo/SendAnEmail/SendAnEmail.ino55
-rw-r--r--libraries/Bridge/examples/Temboo/SendAnEmail/TembooAccount.h1
-rw-r--r--libraries/Bridge/examples/Temboo/SendAnSMS/SendAnSMS.ino38
-rw-r--r--libraries/Bridge/examples/Temboo/SendDataToGoogleSpreadsheet/SendDataToGoogleSpreadsheet.ino35
-rw-r--r--libraries/Bridge/examples/Temboo/ToxicFacilitiesSearch/ToxicFacilitiesSearch.ino32
-rw-r--r--libraries/Bridge/examples/Temboo/UpdateFacebookStatus/UpdateFacebookStatus.ino33
-rw-r--r--libraries/Bridge/examples/Temboo/UploadToDropbox/UploadToDropbox.ino63
10 files changed, 175 insertions, 286 deletions
diff --git a/libraries/Bridge/examples/Temboo/GetYahooWeatherReport/GetYahooWeatherReport.ino b/libraries/Bridge/examples/Temboo/GetYahooWeatherReport/GetYahooWeatherReport.ino
index 48c3b11..e198ee6 100644
--- a/libraries/Bridge/examples/Temboo/GetYahooWeatherReport/GetYahooWeatherReport.ino
+++ b/libraries/Bridge/examples/Temboo/GetYahooWeatherReport/GetYahooWeatherReport.ino
@@ -18,10 +18,7 @@
*/
#include <Bridge.h>
-#include <Console.h>
-#include <FileIO.h>
-#include <HttpClient.h>
-#include <Process.h>
+#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information
// as described in the footer comment below
@@ -29,9 +26,10 @@
// the address for which a weather forecast will be retrieved
String ADDRESS_FOR_FORECAST = "104 Franklin St., New York NY 10013";
-int numRuns = 0; // execution count, so that this doesn't run forever
+int numRuns = 1; // execution count, so that this doesn't run forever
int maxRuns = 10; // max number of times the Yahoo WeatherByAddress Choreo should be run
+
void setup() {
Serial.begin(9600);
@@ -39,48 +37,50 @@ void setup() {
delay(4000);
while(!Serial);
Bridge.begin();
+
}
void loop()
{
// while we haven't reached the max number of runs...
- if (numRuns < maxRuns) {
+ if (numRuns <= maxRuns) {
// print status
Serial.println("Running GetWeatherByAddress - Run #" + String(numRuns++) + "...");
- // we need a Process object to send a Choreo request to Temboo
- Process GetWeatherByAddressChoreo;
-
+ // create a TembooChoreo object to send a Choreo request to Temboo
+ TembooChoreo GetWeatherByAddressChoreo;
+
// invoke the Temboo client
- GetWeatherByAddressChoreo.begin("temboo");
-
- // set Temboo account credentials
- GetWeatherByAddressChoreo.addParameter("-a");
- GetWeatherByAddressChoreo.addParameter(TEMBOO_ACCOUNT);
- GetWeatherByAddressChoreo.addParameter("-u");
- GetWeatherByAddressChoreo.addParameter(TEMBOO_APP_KEY_NAME);
- GetWeatherByAddressChoreo.addParameter("-p");
- GetWeatherByAddressChoreo.addParameter(TEMBOO_APP_KEY);
-
- // identify the Temboo Library choreo to run (Yahoo > Weather > GetWeatherByAddress)
- GetWeatherByAddressChoreo.addParameter("-c");
- GetWeatherByAddressChoreo.addParameter("/Library/Yahoo/Weather/GetWeatherByAddress");
-
+ GetWeatherByAddressChoreo.begin();
+
+ // add your temboo account info
+ GetWeatherByAddressChoreo.setAccountName(TEMBOO_ACCOUNT);
+ GetWeatherByAddressChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
+ GetWeatherByAddressChoreo.setAppKey(TEMBOO_APP_KEY);
+
+ // set the name of the choreo we want to run
+ GetWeatherByAddressChoreo.setChoreo("/Library/Yahoo/Weather/GetWeatherByAddress");
+
// set choreo inputs; in this case, the address for which to retrieve weather data
// the Temboo client provides standardized calls to 100+ cloud APIs
- GetWeatherByAddressChoreo.addParameter("-i");
- GetWeatherByAddressChoreo.addParameter("Address:" + ADDRESS_FOR_FORECAST);
-
+ GetWeatherByAddressChoreo.addInput("Address", ADDRESS_FOR_FORECAST);
+
+ // add an output filter to extract the name of the city.
+ GetWeatherByAddressChoreo.addOutputFilter("city", "/rss/channel/yweather:location/@city", "Response");
+
+ // add an output filter to extract the current temperature
+ GetWeatherByAddressChoreo.addOutputFilter("temperature", "/rss/channel/item/yweather:condition/@temp", "Response");
+
+ // add an output filter to extract the date and time of the last report.
+ GetWeatherByAddressChoreo.addOutputFilter("date", "/rss/channel/item/yweather:condition/@date", "Response");
+
// run the choreo
GetWeatherByAddressChoreo.run();
// when the choreo results are available, print them to the serial monitor
while(GetWeatherByAddressChoreo.available()) {
- // note that in this example, we just print the raw XML response from Yahoo
- // see the examples on using Temboo SDK output filters at http://www.temboo.com/arduino
- // for information on how to filter this data
char c = GetWeatherByAddressChoreo.read();
Serial.print(c);
}
diff --git a/libraries/Bridge/examples/Temboo/ReadATweet/ReadATweet.ino b/libraries/Bridge/examples/Temboo/ReadATweet/ReadATweet.ino
index e420e28..b17346c 100644
--- a/libraries/Bridge/examples/Temboo/ReadATweet/ReadATweet.ino
+++ b/libraries/Bridge/examples/Temboo/ReadATweet/ReadATweet.ino
@@ -24,10 +24,7 @@
*/
#include <Bridge.h>
-#include <Console.h>
-#include <FileIO.h>
-#include <HttpClient.h>
-#include <Process.h>
+#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information
// as described in the footer comment below
@@ -40,73 +37,59 @@ const String TWITTER_ACCESS_TOKEN_SECRET = "your-twitter-access-token-secret";
const String TWITTER_CONSUMER_KEY = "your-twitter-consumer-key";
const String TWITTER_CONSUMER_SECRET = "your-twitter-consumer-secret";
-int numRuns = 1; // execution count, so this sketch doesn't run forever
-int maxRuns = 10; // the max number of times the Twitter HomeTimeline Choreo should run
+int numRuns = 1; // execution count, so this doesn't run forever
+int maxRuns = 10; // the max number of times the Twitter HomeTimeline Choreo should run
void setup() {
Serial.begin(9600);
- // for debugging, wait until a serial console is connected
+ // For debugging, wait until a serial console is connected.
delay(4000);
while(!Serial);
Bridge.begin();
}
-
void loop()
{
// while we haven't reached the max number of runs...
if (numRuns <= maxRuns) {
-
- // print status
- Serial.println("Running ReadATweet - Run #" + String(numRuns++) + "...");
-
- // define the Process that will be used to call the "temboo" client
- Process HomeTimelineChoreo;
+ Serial.println("Running ReadATweet - Run #" + String(numRuns++));
- // invoke the Temboo client
- HomeTimelineChoreo.begin("temboo");
+ TembooChoreo HomeTimelineChoreo;
+
+ // invoke the Temboo client.
+ // NOTE that the client must be reinvoked, and repopulated with
+ // appropriate arguments, each time its run() method is called.
+ HomeTimelineChoreo.begin();
// set Temboo account credentials
- HomeTimelineChoreo.addParameter("-a");
- HomeTimelineChoreo.addParameter(TEMBOO_ACCOUNT);
- HomeTimelineChoreo.addParameter("-u");
- HomeTimelineChoreo.addParameter(TEMBOO_APP_KEY_NAME);
- HomeTimelineChoreo.addParameter("-p");
- HomeTimelineChoreo.addParameter(TEMBOO_APP_KEY);
-
- // tell the Temboo client which Choreo to run (Twitter > Timelines > HomeTimeline)
- HomeTimelineChoreo.addParameter("-c");
- HomeTimelineChoreo.addParameter("/Library/Twitter/Timelines/HomeTimeline");
+ HomeTimelineChoreo.setAccountName(TEMBOO_ACCOUNT);
+ HomeTimelineChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
+ HomeTimelineChoreo.setAppKey(TEMBOO_APP_KEY);
+ // tell the Temboo client which Choreo to run (Twitter > Timelines > HomeTimeline)
+ HomeTimelineChoreo.setChoreo("/Library/Twitter/Timelines/HomeTimeline");
+
+
// set the required choreo inputs
// see https://www.temboo.com/library/Library/Twitter/Timelines/HomeTimeline/
// for complete details about the inputs for this Choreo
- HomeTimelineChoreo.addParameter("-i");
- HomeTimelineChoreo.addParameter("Count:1"); // the max number of Tweets to return from each request
-
- // add the Twitter account information
- HomeTimelineChoreo.addParameter("-i");
- HomeTimelineChoreo.addParameter("AccessToken:" + TWITTER_ACCESS_TOKEN);
- HomeTimelineChoreo.addParameter("-i");
- HomeTimelineChoreo.addParameter("AccessTokenSecret:" + TWITTER_ACCESS_TOKEN_SECRET);
- HomeTimelineChoreo.addParameter("-i");
- HomeTimelineChoreo.addParameter("ConsumerSecret:" + TWITTER_CONSUMER_SECRET);
- HomeTimelineChoreo.addParameter("-i");
- HomeTimelineChoreo.addParameter("ConsumerKey:" + TWITTER_CONSUMER_KEY);
-
+ HomeTimelineChoreo.addInput("Count", "1"); // the max number of Tweets to return from each request
+ HomeTimelineChoreo.addInput("AccessToken", TWITTER_ACCESS_TOKEN);
+ HomeTimelineChoreo.addInput("AccessTokenSecret", TWITTER_ACCESS_TOKEN_SECRET);
+ HomeTimelineChoreo.addInput("ConsumerKey", TWITTER_CONSUMER_KEY);
+ HomeTimelineChoreo.addInput("ConsumerSecret", TWITTER_CONSUMER_SECRET);
+
// next, we'll define two output filters that let us specify the
// elements of the response from Twitter that we want to receive.
// see the examples at http://www.temboo.com/arduino
// for more on using output filters
// we want the text of the tweet
- HomeTimelineChoreo.addParameter("-o");
- HomeTimelineChoreo.addParameter("tweet:/[1]/text:Response");
+ HomeTimelineChoreo.addOutputFilter("tweet", "/[1]/text", "Response");
// and the name of the author
- HomeTimelineChoreo.addParameter("-o");
- HomeTimelineChoreo.addParameter("author:/[1]/user/screen_name:Response");
+ HomeTimelineChoreo.addOutputFilter("author", "/[1]/user/screen_name", "Response");
// tell the Process to run and wait for the results. The
@@ -114,7 +97,7 @@ void loop()
// was able to send our request to the Temboo servers
unsigned int returnCode = HomeTimelineChoreo.run();
- // a response code of 0 means success; print the API response
+ // a response code of 0 means success; print the API response
if(returnCode == 0) {
String author; // a String to hold the tweet author's name
@@ -160,30 +143,9 @@ void loop()
}
HomeTimelineChoreo.close();
+
}
Serial.println("Waiting...");
- Serial.println("");
delay(90000); // wait 90 seconds between HomeTimeline calls
}
-
-/*
- IMPORTANT NOTE: TembooAccount.h:
-
- TembooAccount.h is a file referenced by this sketch that contains your Temboo account information.
- You'll need to edit the placeholder version of TembooAccount.h included with this example sketch,
- by inserting your own Temboo account name and app key information. The contents of the file should
- look like:
-
- #define TEMBOO_ACCOUNT "myTembooAccountName" // your Temboo account name
- #define TEMBOO_APP_KEY_NAME "myFirstApp" // your Temboo app key name
- #define TEMBOO_APP_KEY "xxx-xxx-xxx-xx-xxx" // your Temboo app key
-
- You can find your Temboo App Key information on the Temboo website,
- under My Account > Application Keys
-
- The same TembooAccount.h file settings can be used for all Temboo SDK sketches.
-
- Keeping your account information in a separate file means you can save it once,
- then just distribute the main .ino file without worrying that you forgot to delete your credentials.
-*/
diff --git a/libraries/Bridge/examples/Temboo/SendATweet/SendATweet.ino b/libraries/Bridge/examples/Temboo/SendATweet/SendATweet.ino
index 8b200fb..d111723 100644
--- a/libraries/Bridge/examples/Temboo/SendATweet/SendATweet.ino
+++ b/libraries/Bridge/examples/Temboo/SendATweet/SendATweet.ino
@@ -25,10 +25,7 @@
*/
#include <Bridge.h>
-#include <Console.h>
-#include <FileIO.h>
-#include <HttpClient.h>
-#include <Process.h>
+#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information
// as described in the footer comment below
@@ -43,7 +40,7 @@ const String TWITTER_CONSUMER_KEY = "your-twitter-consumer-key";
const String TWITTER_CONSUMER_SECRET = "your-twitter-consumer-secret";
int numRuns = 1; // execution count, so this sketch doesn't run forever
-int maxRuns = 10; // the max number of times the Twitter HomeTimeline Choreo should run
+int maxRuns = 3; // the max number of times the Twitter Update Choreo should run
void setup() {
Serial.begin(9600);
@@ -61,43 +58,38 @@ void loop()
if (numRuns <= maxRuns) {
Serial.println("Running SendATweet - Run #" + String(numRuns++) + "...");
+
+ // define the text of the tweet we want to send
+ String tweetText("My Arduino Yun has been running for " + String(millis()) + " milliseconds.");
+
- // we need a Process object to send a Choreo request to Temboo
- Process StatusesUpdateChoreo;
+ TembooChoreo StatusesUpdateChoreo;
// invoke the Temboo client
- StatusesUpdateChoreo.begin("temboo");
+ // NOTE that the client must be reinvoked, and repopulated with
+ // appropriate arguments, each time its run() method is called.
+ StatusesUpdateChoreo.begin();
// set Temboo account credentials
- StatusesUpdateChoreo.addParameter("-a");
- StatusesUpdateChoreo.addParameter(TEMBOO_ACCOUNT);
- StatusesUpdateChoreo.addParameter("-u");
- StatusesUpdateChoreo.addParameter(TEMBOO_APP_KEY_NAME);
- StatusesUpdateChoreo.addParameter("-p");
- StatusesUpdateChoreo.addParameter(TEMBOO_APP_KEY);
+ StatusesUpdateChoreo.setAccountName(TEMBOO_ACCOUNT);
+ StatusesUpdateChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
+ StatusesUpdateChoreo.setAppKey(TEMBOO_APP_KEY);
// identify the Temboo Library choreo to run (Twitter > Tweets > StatusesUpdate)
- StatusesUpdateChoreo.addParameter("-c");
- StatusesUpdateChoreo.addParameter("/Library/Twitter/Tweets/StatusesUpdate");
+ StatusesUpdateChoreo.setChoreo("/Library/Twitter/Tweets/StatusesUpdate");
// set the required choreo inputs
// see https://www.temboo.com/library/Library/Twitter/Tweets/StatusesUpdate/
// for complete details about the inputs for this Choreo
-
+
// add the Twitter account information
- StatusesUpdateChoreo.addParameter("-i");
- StatusesUpdateChoreo.addParameter("AccessToken:" + TWITTER_ACCESS_TOKEN);
- StatusesUpdateChoreo.addParameter("-i");
- StatusesUpdateChoreo.addParameter("AccessTokenSecret:" + TWITTER_ACCESS_TOKEN_SECRET);
- StatusesUpdateChoreo.addParameter("-i");
- StatusesUpdateChoreo.addParameter("ConsumerSecret:" + TWITTER_CONSUMER_SECRET);
- StatusesUpdateChoreo.addParameter("-i");
- StatusesUpdateChoreo.addParameter("ConsumerKey:" + TWITTER_CONSUMER_KEY);
-
- String tweet("My Arduino Yun has been running for " + String(millis()) + " milliseconds.");
-
- StatusesUpdateChoreo.addParameter("-i");
- StatusesUpdateChoreo.addParameter("StatusUpdate:" + tweet);
+ StatusesUpdateChoreo.addInput("AccessToken", TWITTER_ACCESS_TOKEN);
+ StatusesUpdateChoreo.addInput("AccessTokenSecret", TWITTER_ACCESS_TOKEN_SECRET);
+ StatusesUpdateChoreo.addInput("ConsumerKey", TWITTER_CONSUMER_KEY);
+ StatusesUpdateChoreo.addInput("ConsumerSecret", TWITTER_CONSUMER_SECRET);
+
+ // and the tweet we want to send
+ StatusesUpdateChoreo.addInput("StatusUpdate", tweetText);
// tell the Process to run and wait for the results. The
// return code (returnCode) will tell us whether the Temboo client
diff --git a/libraries/Bridge/examples/Temboo/SendAnEmail/SendAnEmail.ino b/libraries/Bridge/examples/Temboo/SendAnEmail/SendAnEmail.ino
index 1ed95df..a602cc1 100644
--- a/libraries/Bridge/examples/Temboo/SendAnEmail/SendAnEmail.ino
+++ b/libraries/Bridge/examples/Temboo/SendAnEmail/SendAnEmail.ino
@@ -22,10 +22,7 @@
*/
#include <Bridge.h>
-#include <Console.h>
-#include <FileIO.h>
-#include <HttpClient.h>
-#include <Process.h>
+#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information
// as described in the footer comment below
@@ -34,7 +31,7 @@
// Note that for additional security and reusability, you could
// use #define statements to specify these values in a .h file.
-// your Gmail address, eg "bob.smith@gmail.com"
+// your Gmail username, formatted as a complete email address, eg "bob.smith@gmail.com"
const String GMAIL_USER_NAME = "xxxxxxxxxx";
// your Gmail password
@@ -62,50 +59,40 @@ void loop()
if (!success) {
Serial.println("Running SendAnEmail...");
-
- // we need a Process object to send a Choreo request to Temboo
- Process SendEmailChoreo;
+
+ TembooChoreo SendEmailChoreo;
// invoke the Temboo client
- SendEmailChoreo.begin("temboo");
+ // NOTE that the client must be reinvoked, and repopulated with
+ // appropriate arguments, each time its run() method is called.
+ SendEmailChoreo.begin();
// set Temboo account credentials
- SendEmailChoreo.addParameter("-a");
- SendEmailChoreo.addParameter(TEMBOO_ACCOUNT);
- SendEmailChoreo.addParameter("-u");
- SendEmailChoreo.addParameter(TEMBOO_APP_KEY_NAME);
- SendEmailChoreo.addParameter("-p");
- SendEmailChoreo.addParameter(TEMBOO_APP_KEY);
+ SendEmailChoreo.setAccountName(TEMBOO_ACCOUNT);
+ SendEmailChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
+ SendEmailChoreo.setAppKey(TEMBOO_APP_KEY);
// identify the Temboo Library choreo to run (Google > Gmail > SendEmail)
- SendEmailChoreo.addParameter("-c");
- SendEmailChoreo.addParameter("/Library/Google/Gmail/SendEmail");
+ SendEmailChoreo.setChoreo("/Library/Google/Gmail/SendEmail");
+
// set the required choreo inputs
// see https://www.temboo.com/library/Library/Google/Gmail/SendEmail/
// for complete details about the inputs for this Choreo
- // the first input is a your Gmail user name.
- SendEmailChoreo.addParameter("-i");
- SendEmailChoreo.addParameter("Username:" + GMAIL_USER_NAME);
-
+ // the first input is your Gmail email address.
+ SendEmailChoreo.addInput("Username", GMAIL_USER_NAME);
// next is your Gmail password.
- SendEmailChoreo.addParameter("-i");
- SendEmailChoreo.addParameter("Password:" + GMAIL_PASSWORD);
-
+ SendEmailChoreo.addInput("Password", GMAIL_PASSWORD);
// who to send the email to
- SendEmailChoreo.addParameter("-i");
- SendEmailChoreo.addParameter("ToAddress:" + TO_EMAIL_ADDRESS);
-
+ SendEmailChoreo.addInput("ToAddress", TO_EMAIL_ADDRESS);
// then a subject line
- SendEmailChoreo.addParameter("-i");
- SendEmailChoreo.addParameter("Subject:ALERT: Greenhouse Temperature");
-
- // next comes the message body, the main content of the email
- SendEmailChoreo.addParameter("-i");
- SendEmailChoreo.addParameter("MessageBody:Hey! The greenhouse is too cold!");
+ SendEmailChoreo.addInput("Subject", "ALERT: Greenhouse Temperature");
+
+ // next comes the message body, the main content of the email
+ SendEmailChoreo.addInput("MessageBody", "Hey! The greenhouse is too cold!");
- // tell the Process to run and wait for the results. The
+ // tell the Choreo to run and wait for the results. The
// return code (returnCode) will tell us whether the Temboo client
// was able to send our request to the Temboo servers
unsigned int returnCode = SendEmailChoreo.run();
diff --git a/libraries/Bridge/examples/Temboo/SendAnEmail/TembooAccount.h b/libraries/Bridge/examples/Temboo/SendAnEmail/TembooAccount.h
index 8d7dcfb..c58b447 100644
--- a/libraries/Bridge/examples/Temboo/SendAnEmail/TembooAccount.h
+++ b/libraries/Bridge/examples/Temboo/SendAnEmail/TembooAccount.h
@@ -2,4 +2,3 @@
#define TEMBOO_APP_KEY_NAME "myFirstApp" // your Temboo app key name
#define TEMBOO_APP_KEY "xxx-xxx-xxx-xx-xxx" // your Temboo app key
-
diff --git a/libraries/Bridge/examples/Temboo/SendAnSMS/SendAnSMS.ino b/libraries/Bridge/examples/Temboo/SendAnSMS/SendAnSMS.ino
index 565f7fc..9b017e4 100644
--- a/libraries/Bridge/examples/Temboo/SendAnSMS/SendAnSMS.ino
+++ b/libraries/Bridge/examples/Temboo/SendAnSMS/SendAnSMS.ino
@@ -31,10 +31,7 @@
*/
#include <Bridge.h>
-#include <Console.h>
-#include <FileIO.h>
-#include <HttpClient.h>
-#include <Process.h>
+#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information
// as described in the footer comment below
@@ -77,46 +74,39 @@ void loop()
Serial.println("Running SendAnSMS...");
// we need a Process object to send a Choreo request to Temboo
- Process SendSMSChoreo;
+ TembooChoreo SendSMSChoreo;
// invoke the Temboo client
- SendSMSChoreo.begin("temboo");
+ // NOTE that the client must be reinvoked and repopulated with
+ // appropriate arguments each time its run() method is called.
+ SendSMSChoreo.begin();
// set Temboo account credentials
- SendSMSChoreo.addParameter("-a");
- SendSMSChoreo.addParameter(TEMBOO_ACCOUNT);
- SendSMSChoreo.addParameter("-u");
- SendSMSChoreo.addParameter(TEMBOO_APP_KEY_NAME);
- SendSMSChoreo.addParameter("-p");
- SendSMSChoreo.addParameter(TEMBOO_APP_KEY);
+ SendSMSChoreo.setAccountName(TEMBOO_ACCOUNT);
+ SendSMSChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
+ SendSMSChoreo.setAppKey(TEMBOO_APP_KEY);
// identify the Temboo Library choreo to run (Twilio > SMSMessages > SendSMS)
- SendSMSChoreo.addParameter("-c");
- SendSMSChoreo.addParameter("/Library/Twilio/SMSMessages/SendSMS");
+ SendSMSChoreo.setChoreo("/Library/Twilio/SMSMessages/SendSMS");
// set the required choreo inputs
// see https://www.temboo.com/library/Library/Twilio/SMSMessages/SendSMS/
// for complete details about the inputs for this Choreo
// the first input is a your AccountSID
- SendSMSChoreo.addParameter("-i");
- SendSMSChoreo.addParameter("AccountSID:" + TWILIO_ACCOUNT_SID);
+ SendSMSChoreo.addInput("AccountSID", TWILIO_ACCOUNT_SID);
// next is your Auth Token
- SendSMSChoreo.addParameter("-i");
- SendSMSChoreo.addParameter("AuthToken:" + TWILIO_AUTH_TOKEN);
+ SendSMSChoreo.addInput("AuthToken", TWILIO_AUTH_TOKEN);
// next is your Twilio phone number
- SendSMSChoreo.addParameter("-i");
- SendSMSChoreo.addParameter("From:" + TWILIO_NUMBER);
+ SendSMSChoreo.addInput("From", TWILIO_NUMBER);
// next, what number to send the SMS to
- SendSMSChoreo.addParameter("-i");
- SendSMSChoreo.addParameter("To:" + RECIPIENT_NUMBER);
+ SendSMSChoreo.addInput("To", RECIPIENT_NUMBER);
// finally, the text of the message to send
- SendSMSChoreo.addParameter("-i");
- SendSMSChoreo.addParameter("Body:Hey, there! This is a message from your Arduino Yun!");
+ SendSMSChoreo.addInput("Body", "Hey, there! This is a message from your Arduino Yun!");
// tell the Process to run and wait for the results. The
// return code (returnCode) will tell us whether the Temboo client
diff --git a/libraries/Bridge/examples/Temboo/SendDataToGoogleSpreadsheet/SendDataToGoogleSpreadsheet.ino b/libraries/Bridge/examples/Temboo/SendDataToGoogleSpreadsheet/SendDataToGoogleSpreadsheet.ino
index 3c513de..c5fc8c4 100644
--- a/libraries/Bridge/examples/Temboo/SendDataToGoogleSpreadsheet/SendDataToGoogleSpreadsheet.ino
+++ b/libraries/Bridge/examples/Temboo/SendDataToGoogleSpreadsheet/SendDataToGoogleSpreadsheet.ino
@@ -37,10 +37,7 @@
*/
#include <Bridge.h>
-#include <Console.h>
-#include <FileIO.h>
-#include <HttpClient.h>
-#include <Process.h>
+#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information,
// as described in the footer comment below
@@ -97,39 +94,34 @@ void loop()
Serial.println("Appending value to spreadsheet...");
// we need a Process object to send a Choreo request to Temboo
- Process AppendRowChoreo;
+ TembooChoreo AppendRowChoreo;
// invoke the Temboo client
- AppendRowChoreo.begin("temboo");
+ // NOTE that the client must be reinvoked and repopulated with
+ // appropriate arguments each time its run() method is called.
+ AppendRowChoreo.begin();
// set Temboo account credentials
- AppendRowChoreo.addParameter("-a");
- AppendRowChoreo.addParameter(TEMBOO_ACCOUNT);
- AppendRowChoreo.addParameter("-u");
- AppendRowChoreo.addParameter(TEMBOO_APP_KEY_NAME);
- AppendRowChoreo.addParameter("-p");
- AppendRowChoreo.addParameter(TEMBOO_APP_KEY);
+ AppendRowChoreo.setAccountName(TEMBOO_ACCOUNT);
+ AppendRowChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
+ AppendRowChoreo.setAppKey(TEMBOO_APP_KEY);
// identify the Temboo Library choreo to run (Google > Spreadsheets > AppendRow)
- AppendRowChoreo.addParameter("-c");
- AppendRowChoreo.addParameter("/Library/Google/Spreadsheets/AppendRow");
+ AppendRowChoreo.setChoreo("/Library/Google/Spreadsheets/AppendRow");
// set the required Choreo inputs
// see https://www.temboo.com/library/Library/Google/Spreadsheets/AppendRow/
// for complete details about the inputs for this Choreo
// your Google username (usually your email address)
- AppendRowChoreo.addParameter("-i");
- AppendRowChoreo.addParameter("Username:" + GOOGLE_USERNAME);
+ AppendRowChoreo.addInput("Username", GOOGLE_USERNAME);
// your Google account password
- AppendRowChoreo.addParameter("-i");
- AppendRowChoreo.addParameter("Password:" + GOOGLE_PASSWORD);
+ AppendRowChoreo.addInput("Password", GOOGLE_PASSWORD);
// the title of the spreadsheet you want to append to
// NOTE: substitute your own value, retaining the "SpreadsheetTitle:" prefix.
- AppendRowChoreo.addParameter("-i");
- AppendRowChoreo.addParameter("SpreadsheetTitle:" + SPREADSHEET_TITLE);
+ AppendRowChoreo.addInput("SpreadsheetTitle", SPREADSHEET_TITLE);
// convert the time and sensor values to a comma separated string
String rowData(now);
@@ -137,8 +129,7 @@ void loop()
rowData += sensorValue;
// add the RowData input item
- AppendRowChoreo.addParameter("-i");
- AppendRowChoreo.addParameter("RowData:" + rowData);
+ AppendRowChoreo.addInput("RowData", rowData);
// run the Choreo and wait for the results
// The return code (returnCode) will indicate success or failure
diff --git a/libraries/Bridge/examples/Temboo/ToxicFacilitiesSearch/ToxicFacilitiesSearch.ino b/libraries/Bridge/examples/Temboo/ToxicFacilitiesSearch/ToxicFacilitiesSearch.ino
index a99803a..e7d4e5e 100644
--- a/libraries/Bridge/examples/Temboo/ToxicFacilitiesSearch/ToxicFacilitiesSearch.ino
+++ b/libraries/Bridge/examples/Temboo/ToxicFacilitiesSearch/ToxicFacilitiesSearch.ino
@@ -20,10 +20,7 @@
*/
#include <Bridge.h>
-#include <Console.h>
-#include <FileIO.h>
-#include <HttpClient.h>
-#include <Process.h>
+#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information
// as described in the footer comment below
@@ -51,35 +48,30 @@ void loop()
Serial.println("Running ToxicFacilitiesSearch - Run #" + String(numRuns++) + "...");
// we need a Process object to send a Choreo request to Temboo
- Process FacilitiesSearchByZipChoreo;
+ TembooChoreo FacilitiesSearchByZipChoreo;
// invoke the Temboo client
- FacilitiesSearchByZipChoreo.begin("temboo");
+ // NOTE that the client must be reinvoked and repopulated with
+ // appropriate arguments each time its run() method is called.
+ FacilitiesSearchByZipChoreo.begin();
// set Temboo account credentials
- FacilitiesSearchByZipChoreo.addParameter("-a");
- FacilitiesSearchByZipChoreo.addParameter(TEMBOO_ACCOUNT);
- FacilitiesSearchByZipChoreo.addParameter("-u");
- FacilitiesSearchByZipChoreo.addParameter(TEMBOO_APP_KEY_NAME);
- FacilitiesSearchByZipChoreo.addParameter("-p");
- FacilitiesSearchByZipChoreo.addParameter(TEMBOO_APP_KEY);
+ FacilitiesSearchByZipChoreo.setAccountName(TEMBOO_ACCOUNT);
+ FacilitiesSearchByZipChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
+ FacilitiesSearchByZipChoreo.setAppKey(TEMBOO_APP_KEY);
// identify the Temboo Library choreo to run (EnviroFacts > Toxins > FacilitiesSearchByZip)
- FacilitiesSearchByZipChoreo.addParameter("-c");
- FacilitiesSearchByZipChoreo.addParameter("/Library/EnviroFacts/Toxins/FacilitiesSearchByZip");
+ FacilitiesSearchByZipChoreo.setChoreo("/Library/EnviroFacts/Toxins/FacilitiesSearchByZip");
// set choreo inputs; in this case, the US zip code for which to retrieve toxin release data
// the Temboo client provides standardized calls to 100+ cloud APIs
- FacilitiesSearchByZipChoreo.addParameter("-i");
- FacilitiesSearchByZipChoreo.addParameter("Zip:" + US_ZIP_CODE);
+ FacilitiesSearchByZipChoreo.addInput("Zip", US_ZIP_CODE);
// specify two output filters, to help simplify the Envirofacts API results.
// see the tutorials on using Temboo SDK output filters at http://www.temboo.com/arduino
- FacilitiesSearchByZipChoreo.addParameter("-o");
- FacilitiesSearchByZipChoreo.addParameter("fac:FACILITY_NAME:Response");
+ FacilitiesSearchByZipChoreo.addOutputFilter("fac", "FACILITY_NAME", "Response");
- FacilitiesSearchByZipChoreo.addParameter("-o");
- FacilitiesSearchByZipChoreo.addParameter("addr:STREET_ADDRESS:Response");
+ FacilitiesSearchByZipChoreo.addOutputFilter("addr", "STREET_ADDRESS", "Response");
// run the choreo
unsigned int returnCode = FacilitiesSearchByZipChoreo.run();
diff --git a/libraries/Bridge/examples/Temboo/UpdateFacebookStatus/UpdateFacebookStatus.ino b/libraries/Bridge/examples/Temboo/UpdateFacebookStatus/UpdateFacebookStatus.ino
index 9bb1f2f..1a4451d 100644
--- a/libraries/Bridge/examples/Temboo/UpdateFacebookStatus/UpdateFacebookStatus.ino
+++ b/libraries/Bridge/examples/Temboo/UpdateFacebookStatus/UpdateFacebookStatus.ino
@@ -24,10 +24,7 @@
*/
#include <Bridge.h>
-#include <Console.h>
-#include <FileIO.h>
-#include <HttpClient.h>
-#include <Process.h>
+#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information,
// as described in the footer comment below
@@ -40,7 +37,7 @@
const String FACEBOOK_ACCESS_TOKEN = "xxxxxxxxxx";
-int numRuns = 0; // execution count, so this sketch doesn't run forever
+int numRuns = 1; // execution count, so this sketch doesn't run forever
int maxRuns = 10; // the max number of times the Facebook SetStatus Choreo should run
void setup() {
@@ -54,7 +51,7 @@ void setup() {
void loop() {
// while we haven't reached the max number of runs...
- if (numRuns < maxRuns) {
+ if (numRuns <= maxRuns) {
// print status
Serial.println("Running UpdateFacebookStatus - Run #" + String(numRuns++) + "...");
@@ -64,31 +61,27 @@ void loop() {
String statusMsg = "My Arduino Yun has been running for " + String(millis()) + " milliseconds!";
// define the Process that will be used to call the "temboo" client
- Process SetStatusChoreo;
+ TembooChoreo SetStatusChoreo;
// invoke the Temboo client
- SetStatusChoreo.begin("temboo");
+ // NOTE that the client must be reinvoked and repopulated with
+ // appropriate arguments each time its run() method is called.
+ SetStatusChoreo.begin();
// set Temboo account credentials
- SetStatusChoreo.addParameter("-a");
- SetStatusChoreo.addParameter(TEMBOO_ACCOUNT);
- SetStatusChoreo.addParameter("-u");
- SetStatusChoreo.addParameter(TEMBOO_APP_KEY_NAME);
- SetStatusChoreo.addParameter("-p");
- SetStatusChoreo.addParameter(TEMBOO_APP_KEY);
+ SetStatusChoreo.setAccountName(TEMBOO_ACCOUNT);
+ SetStatusChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
+ SetStatusChoreo.setAppKey(TEMBOO_APP_KEY);
// tell the Temboo client which Choreo to run (Facebook > Publishing > SetStatus)
- SetStatusChoreo.addParameter("-c");
- SetStatusChoreo.addParameter("/Library/Facebook/Publishing/SetStatus");
+ SetStatusChoreo.setChoreo("/Library/Facebook/Publishing/SetStatus");
// set the required choreo inputs
// see https://www.temboo.com/library/Library/Facebook/Publishing/SetStatus/
// for complete details about the inputs for this Choreo
- SetStatusChoreo.addParameter("-i");
- SetStatusChoreo.addParameter("AccessToken:" + FACEBOOK_ACCESS_TOKEN);
- SetStatusChoreo.addParameter("-i");
- SetStatusChoreo.addParameter("Message:" + statusMsg);
+ SetStatusChoreo.addInput("AccessToken", FACEBOOK_ACCESS_TOKEN);
+ SetStatusChoreo.addInput("Message", statusMsg);
// tell the Process to run and wait for the results. The
diff --git a/libraries/Bridge/examples/Temboo/UploadToDropbox/UploadToDropbox.ino b/libraries/Bridge/examples/Temboo/UploadToDropbox/UploadToDropbox.ino
index 5d9e936..78025aa 100644
--- a/libraries/Bridge/examples/Temboo/UploadToDropbox/UploadToDropbox.ino
+++ b/libraries/Bridge/examples/Temboo/UploadToDropbox/UploadToDropbox.ino
@@ -25,10 +25,7 @@
*/
#include <Bridge.h>
-#include <Console.h>
-#include <FileIO.h>
-#include <HttpClient.h>
-#include <Process.h>
+#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information
// as described in the footer comment below
@@ -76,49 +73,40 @@ void loop()
Serial.println("Uploading data to Dropbox...");
// we need a Process object to send a Choreo request to Temboo
- Process UploadFileChoreo;
+ TembooChoreo UploadFileChoreo;
// invoke the Temboo client
- UploadFileChoreo.begin("temboo");
+ // NOTE that the client must be reinvoked and repopulated with
+ // appropriate arguments each time its run() method is called.
+ UploadFileChoreo.begin();
// set Temboo account credentials
- UploadFileChoreo.addParameter("-a");
- UploadFileChoreo.addParameter(TEMBOO_ACCOUNT);
- UploadFileChoreo.addParameter("-u");
- UploadFileChoreo.addParameter(TEMBOO_APP_KEY_NAME);
- UploadFileChoreo.addParameter("-p");
- UploadFileChoreo.addParameter(TEMBOO_APP_KEY);
+ UploadFileChoreo.setAccountName(TEMBOO_ACCOUNT);
+ UploadFileChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
+ UploadFileChoreo.setAppKey(TEMBOO_APP_KEY);
// identify the Temboo Library choreo to run (Dropbox > FilesAndMetadata > UploadFile)
- UploadFileChoreo.addParameter("-c");
- UploadFileChoreo.addParameter("/Library/Dropbox/FilesAndMetadata/UploadFile");
+ UploadFileChoreo.setChoreo("/Library/Dropbox/FilesAndMetadata/UploadFile");
// set the required choreo inputs
// see https://www.temboo.com/library/Library/Dropbox/FilesAndMetadata/UploadFile/
// for complete details about the inputs for this Choreo
// first specify the name of the file to create/update on Dropbox
- UploadFileChoreo.addParameter("-i");
- UploadFileChoreo.addParameter("FileName:ArduinoTest.txt");
+ UploadFileChoreo.addInput("FileName", "ArduinoTest.txt");
// next, the root folder on Dropbox relative to which the file path is specified.
// unless you're using an in-production Dropbox app, this should be left as "sandbox"
- UploadFileChoreo.addParameter("-i");
- UploadFileChoreo.addParameter("Root:sandbox");
+ UploadFileChoreo.addInput("Root","sandbox");
// next, the Base64 encoded file data to upload
- UploadFileChoreo.addParameter("-i");
- UploadFileChoreo.addParameter("FileContents:" + base64EncodedData);
+ UploadFileChoreo.addInput("FileContents", base64EncodedData);
// finally, the Dropbox OAuth credentials defined above
- UploadFileChoreo.addParameter("-i");
- UploadFileChoreo.addParameter("AppSecret:" + DROPBOX_APP_SECRET);
- UploadFileChoreo.addParameter("-i");
- UploadFileChoreo.addParameter("AccessToken:" + DROPBOX_ACCESS_TOKEN);
- UploadFileChoreo.addParameter("-i");
- UploadFileChoreo.addParameter("AccessTokenSecret:" + DROPBOX_ACCESS_TOKEN_SECRET);
- UploadFileChoreo.addParameter("-i");
- UploadFileChoreo.addParameter("AppKey:" + DROPBOX_APP_KEY);
+ UploadFileChoreo.addInput("AppSecret", DROPBOX_APP_SECRET);
+ UploadFileChoreo.addInput("AccessToken", DROPBOX_ACCESS_TOKEN);
+ UploadFileChoreo.addInput("AccessTokenSecret", DROPBOX_ACCESS_TOKEN_SECRET);
+ UploadFileChoreo.addInput("AppKey", DROPBOX_APP_KEY);
// tell the Process to run and wait for the results. The
// return code (returnCode) will tell us whether the Temboo client
@@ -156,26 +144,21 @@ void loop()
String base64Encode(String toEncode) {
// we need a Process object to send a Choreo request to Temboo
- Process Base64EncodeChoreo;
+ TembooChoreo Base64EncodeChoreo;
// invoke the Temboo client
- Base64EncodeChoreo.begin("temboo");
+ Base64EncodeChoreo.begin();
// set Temboo account credentials
- Base64EncodeChoreo.addParameter("-a");
- Base64EncodeChoreo.addParameter(TEMBOO_ACCOUNT);
- Base64EncodeChoreo.addParameter("-u");
- Base64EncodeChoreo.addParameter(TEMBOO_APP_KEY_NAME);
- Base64EncodeChoreo.addParameter("-p");
- Base64EncodeChoreo.addParameter(TEMBOO_APP_KEY);
+ Base64EncodeChoreo.setAccountName(TEMBOO_ACCOUNT);
+ Base64EncodeChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
+ Base64EncodeChoreo.setAppKey(TEMBOO_APP_KEY);
// identify the Temboo Library choreo to run (Utilities > Encoding > Base64Encode)
- Base64EncodeChoreo.addParameter("-c");
- Base64EncodeChoreo.addParameter("/Library/Utilities/Encoding/Base64Encode");
+ Base64EncodeChoreo.setChoreo("/Library/Utilities/Encoding/Base64Encode");
// set choreo inputs
- Base64EncodeChoreo.addParameter("-i");
- Base64EncodeChoreo.addParameter("Text:" + toEncode);
+ Base64EncodeChoreo.addInput("Text", toEncode);
// run the choreo
Base64EncodeChoreo.run();