<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body>



<ul id="index">
  <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
  <li><a href="#DESCRIPTION">DESCRIPTION</a></li>
  <li><a href="#METHODS">METHODS</a>
    <ul>
      <li><a href="#new-token_pass-api_key">new(token_pass =&gt; $api_key)</a></li>
      <li><a href="#current_user">current_user</a></li>
      <li><a href="#rooms">rooms</a></li>
      <li><a href="#room_id-room_name">room_id($room_name)</a></li>
      <li><a href="#room_users-room_id">room_users($room_id)</a></li>
      <li><a href="#send_message-text-room_id">send_message($text, $room_id)</a></li>
      <li><a href="#messages-room_id-limit_number">messages($room_id, $limit_number)</a></li>
    </ul>
  </li>
  <li><a href="#SEE-ALSO">SEE ALSO</a></li>
</ul>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<pre><code>        use WebService::Gitter;
        
        my $client = WebService::Gitter-&gt;new(token_pass =&gt; &#39;my_api_or_token_key&#39;);
        
        $client-&gt;current_user;
        $client-&gt;rooms;
        $client-&gt;room_id(&#39;gitterHQ/nodejs&#39;);
        $client-&gt;room_users(&#39;the_user_id&#39;);
        $client-&gt;send_message(&#39;my_text&#39;, &#39;room_id&#39;);
        $client-&gt;nessages(&#39;room_id&#39;, limit_messages_in_number);</code></pre>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>An interface to Gitter REST API (v1). The methods will return a parsed <a>JSON</a> into hash.. That is up to your freedom on specifically accessing each element in the hash.</p>

<p>To access specific element in the JSON hash, for example:</p>

<pre><code>        $client-&gt;current_user-&gt;{&#39;id&#39;};</code></pre>

<p><i><b>NOTE</b></i>You need to include &#39;<i><b>use Data::Dumper</b></i>&#39; in your script to print the whole hash map.</p>

<h1 id="METHODS">METHODS</h1>

<h2 id="new-token_pass-api_key">new(token_pass =&gt; $api_key)</h2>

<p>You need to be registered at Gitter to get an api key. Take a look at <a href="https://developer.gitter.im/login">https://developer.gitter.im/login</a> for further information.</p>

<h2 id="current_user">current_user</h2>

<p>This will return the authenticated user (you) info in decoded JSON. To see the response data, you can:</p>

<pre><code>    print Dumper $obj-&gt;current_user
    </code></pre>

<p>and it will print the returned HASH map.</p>

<h2 id="rooms">rooms</h2>

<p>This will return the joined rooms by authenticated user (you) info in JSON through HASH. To see the response data, you can:</p>

<pre><code>    print Dumper $obj-&gt;rooms;</code></pre>

<p>and it will print the returned HASH map.</p>

<h2 id="room_id-room_name">room_id($room_name)</h2>

<p><i>$room_name</i> arguments is the room name, eg <i><b>FreecodeCamp/FreeCodeCamp</b></i>.</p>

<p>This method will return the room ID of the specified room name in JSON through HASH. To see the response data, you can:</p>

<pre><code>    print Dumper $obj-&gt;room_id($room_uri);
    </code></pre>

<p>and it will print the returned HASH map.</p>

<h2 id="room_users-room_id">room_users($room_id)</h2>

<p><i>$room_id</i> is the room ID. You can get this by running the <a href="#room_id-room_uri">&quot;room_id($room_uri)&quot;</a> method.</p>

<p>This method will return the users in the specified room in JSON through HASH. To see the response data, you can:</p>

<pre><code>    print Dumper $obj-&gt;room_users($room_id);
    </code></pre>

<p>and it will print the returned HASH map.</p>

<h2 id="send_message-text-room_id">send_message($text, $room_id)</h2>

<p><i>$text</i> is your text message, eg <i><b>&#39;HI!&#39;</b></i>. <i>$room_id</i> is the room ID you want to send message to. You can get the room ID by running:</p>

<pre><code>    print Dumper $obj-&gt;room_id($room_name/uri);</code></pre>

<p>This method will send the message to the specified room through the room ID. To see the response data, you can:</p>

<pre><code>    print Dumper $obj-&gt;send_message($text, $room_id);
    </code></pre>

<p>and it will print the returned HASH map.</p>

<h2 id="messages-room_id-limit_number">messages($room_id, $limit_number)</h2>

<p><i>$room_id</i> is your room targeted room ID. To find the room ID, you can run:</p>

<pre><code>    print Dumper $obj-&gt;room_id($room_name);
    </code></pre>

<p>The <i>$limit_number</i> is your total messages to be retrieved.</p>

<p>This method will retrieve messages from targeted room. To see the respose data, you can run:</p>

<pre><code>    print Dumper $obj-&gt;messages($room_id, $limit_number);</code></pre>

<h1 id="SEE-ALSO">SEE ALSO</h1>

<p><a>LWP::UserAgent</a></p>

<p><a>Data::Dumper</a></p>

<p><a>JSON::MaybeXS</a></p>

<p><a href="https://developer.gitter.im/docs/welcome">Gitter API Wiki for developer page</a></p>


</body>

</html>


