<?xml version="1.0" encoding="UTF-8"?>
<app>
  <actioncardurl>http://appresource.s3.amazonaws.com/appdir/a16x42/TwitterOAuth.crd</actioncardurl>
  <active type="boolean">true</active>
  <appid>a16x42</appid>
  <author>Phil Windley</author>
  <created-at type="datetime">2010-01-07T23:07:18Z</created-at>
  <description>A test ruleset for using OAuth and Twitter in KRL     </description>
  <hasactioncard type="boolean">true</hasactioncard>
  <hasbookmarklet type="boolean">true</hasbookmarklet>
  <hassource type="boolean">true</hassource>
  <id type="integer">25</id>
  <imageurl>http://appresource.s3.amazonaws.com/appdir/a16x42/appimage.jpg</imageurl>
  <name>TwitterOAuth</name>
  <source>ruleset a16x42 {
    meta {
        name "TwitterOAuth"
        author "Phil Windley"
        description &lt;&lt;
A test ruleset for using OAuth and Twitter in KRL             &gt;&gt;
        logging on        key twitter {
            "consumer_key" : "put your consumer key here",
            "consumer_secret" : "put your consumer secret here"
            }
    }
    dispatch {
        domain "phil.windley.org"
    }
    global {
        tweets = twitter:authorized() =&gt; twitter:friends_timeline({"count" : 8}) | [];    }
    rule authorize is active {
        select using ".*" setting ()

        pre {
            msg = &lt;&lt; 
A custom message  
 &gt;&gt;;
        }
        if nottwitter:authorized()
        then
            twitter:authorize(msg)
            with
                    opacity = 1 and
                    sticky = true;
        
        fired {
            last;
        }
    }
    rule init_tweetdom is active {
        select using ".*" setting ()

        pre {
            init_div = &lt;&lt; 
&lt;div id="tweet_list"&gt;  &lt;/div&gt;  
 &gt;&gt;;
        }
                    notify("Friends Tweets", init_div)
            with
                    sticky = true and
                    opacity = 1;
    }
    rule populate_tweetdom is active {
        select using ".*" setting ()
            foreach tweets setting (tweet)

        pre {
            text = tweet.pick("$..text");
            div = "&lt;div style='background-color:#666;margin:2px'&gt;" + text + "&lt;/div&gt;";
        }
                    append("#tweet_list", div);
    }

}
</source>
  <updated-at type="datetime">2010-01-09T03:08:17Z</updated-at>
</app>
