<p>The following is a simple example of wrapping Twitter's API for posting updates.</p>
<pre><code>class Twitter
include HTTParty
base_uri 'twitter.com'
basic_auth 'username', 'password'
end
Twitter.post('/statuses/update.json', :query => {:status => "It's an HTTParty and everyone is invited!"})</code></pre>
<p>That is really it! The object returned is a ruby hash that is decoded from Twitter's json response. JSON parsing is used because of the .json extension in the path of the request. You can also explicitly set a format (see the examples). </p>
<p>That works and all but what if you don't want to embed your username and password in the class? Below is an example to fix that:</p>
Twitter.new('username', 'password').post("It's an HTTParty and everyone is invited!")</code></pre>
<p><strong>More Examples:</strong> There are <ahref="http://github.com/jnunemaker/httparty/tree/master/examples/">several examples in the gem itself</a>.</p>
<h2>Support</h2>
<p>Conversations welcome in the <ahref="http://groups.google.com/group/httparty-gem">google group</a> and bugs/features over at <ahref="http://jnunemaker.lighthouseapp.com/projects/14842-httparty/overview">Lightouse</a>.</p>
</div>
<divid="footer">
<p>Created by <ahref="http://addictedtonew.com/about/">John Nunemaker</a></p>