Twitter

Twitter

The following specification sends a tweet to twitter everytime you put a tag on the reader.This example illustrates the use of one of our more complex blocks, being the http-client

<?xml version="1.0" encoding="UTF-8"?>
<specification xmlns="http://www.touchatag.com/schema/configurator/specification-1.0">
    <application>
        <command id="default" name="Send a tweet"/>
    </application>
    <blueprint>
        <superblock id="tweeter">
            <property name="statusMessage">
                <text>Tweeting using custom blueprint</text>
            </property>
            <property name="twitterUsername"><text>user</text></property>
            <property name="twitterPassword"><text>pass</text></property>
            <breakdown>
                <block id="method" ref="urn:touchatag:block:text-source">
                    <property name="Value"><text>POST</text></property>
                </block>
                <block id="uri" ref="urn:touchatag:block:uri-source">
                    <property name="Value">
                        <uri>http://twitter.com/statuses/update.xml</uri>
                    </property>
                </block>
                <block id="statusParam" ref="urn:touchatag:block:text-source">
                    <property name="Value"><text>status</text></property>
                </block>
                <block id="statusValue" ref="urn:touchatag:block:text-source">
                    <property name="Value"><delegate as="statusMessage"/></property>
                </block>
                <block id="sourceParam" ref="urn:touchatag:block:text-source">
                    <property name="Value"><text>source</text></property>
                </block>
                <block id="sourceValue" ref="urn:touchatag:block:text-source">
                    <property name="Value"><text>touchatag</text></property>
                </block>
                <block id="username" ref="urn:touchatag:block:text-source">
                    <property name="Value"><delegate as="twitterUsername"/></property>
                </block>
                <block id="password" ref="urn:touchatag:block:text-source">
                    <property name="Value"><delegate as="twitterPassword"/></property>
                </block>
                <block id="basicAuth" ref="urn:touchatag:block:text-source">
                    <property name="Value"><text>BASIC</text></property>
                </block>
                <block id="noMime" ref="urn:touchatag:block:empty-text"/>
                <block id="noContent" ref="urn:touchatag:block:empty-text"/>
                <block id="t2l" ref="urn:touchatag:block:text-to-logintype"/>
                <block id="auth" ref="urn:touchatag:block:credential-basic-login"/>
                <block id="emptyParamsMap" ref="urn:touchatag:block:empty-text2text"/>
                <block id="addStatus" ref="urn:touchatag:block:add-text2text"/>
                <block id="addSource" ref="urn:touchatag:block:add-text2text"/>
                <block id="t2hm" ref="urn:touchatag:block:text-to-http-method"/>
                <block id="reqBuilder" ref="urn:touchatag:block:http-request-builder"/>
                <block id="client" ref="urn:touchatag:block:http-client"/>
                <block id="respProc" ref="urn:touchatag:block:http-response-processor"/>
                <block id="statusHelper" ref="urn:touchatag:block:http-status-helper"/>
                <block id="message" ref="urn:touchatag:block:message"/>
            </breakdown>
            <wiringscheme>
                <wire from="method:out" to="t2hm:in"/>            
                <wire from="t2hm:out" to="reqBuilder:httpmethod-in"/>
                
                <wire from="uri:out" to="reqBuilder:uri-in"/>
                 
                <wire from="emptyParamsMap:out" to="addStatus:map-in"/>
                <wire from="statusParam:out" to="addStatus:key-in"/>
                <wire from="statusValue:out" to="addStatus:value-in"/>
                <wire from="addStatus:out" to="addSource:map-in"/>
                <wire from="sourceParam:out" to="addSource:key-in"/>
                <wire from="sourceValue:out" to="addSource:value-in"/>
                <wire from="addSource:out" to="reqBuilder:params-in"/>
                
                <wire from="username:out" to="auth:username-in"/>
                <wire from="password:out" to="auth:pass-in"/>
                <wire from="basicAuth:out" to="t2l:in"/>
                <wire from="t2l:out" to="auth:logintype-in"/>
                <wire from="auth:out" to="reqBuilder:credentials-in"/>
                
                <wire from="noMime:out" to="reqBuilder:mimetype-in"/>
                
                <wire from="noContent:out" to="reqBuilder:content-in"/>
                
                <wire from="reqBuilder:out" to="client:in"/>
                <wire from="client:out" to="respProc:in"/>
                <wire from="respProc:status-out" to="statusHelper:in"/>
                <wire from="statusHelper:status-message-out" to="message:in"/>
                <shunt from="message:out" to="action-out"/>
            </wiringscheme>
        </superblock>
    </blueprint>
</specification>

This example uses the following blocks :