Permalink
Browse files

[api test doc] Started snapshots. Completed `jitsu apps list` with ap…

…propriate table formating / coloring. Added tests for table utils. Updated docco docs.
  • Loading branch information...
1 parent cd6b8fd commit f94720dbb6ff4b3e1878f6bbcc0ecb250ac5a201 @indexzero indexzero committed Mar 5, 2011
View
Oops, something went wrong.
View
@@ -0,0 +1,60 @@
+<!DOCTYPE html> <html> <head> <title>apps.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="../../docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="../..//jitsu/api/apps.html"> jitsu/api/apps.html </a> <a class="source" href="../..//jitsu/api/client.html"> jitsu/api/client.html </a> <a class="source" href="../..//jitsu/api/snapshots.html"> jitsu/api/snapshots.html </a> <a class="source" href="../..//jitsu/api/users.html"> jitsu/api/users.html </a> <a class="source" href="../..//jitsu/commands/apps.html"> jitsu/commands/apps.html </a> <a class="source" href="../..//jitsu/commands/config.html"> jitsu/commands/config.html </a> <a class="source" href="../..//jitsu/commands/snapshots.html"> jitsu/commands/snapshots.html </a> <a class="source" href="../..//jitsu/commands.html"> jitsu/commands.html </a> <a class="source" href="../..//jitsu/config.html"> jitsu/config.html </a> <a class="source" href="../..//jitsu/log.html"> jitsu/log.html </a> <a class="source" href="../..//jitsu/prompt.html"> jitsu/prompt.html </a> <a class="source" href="../..//jitsu/utils/base64.html"> jitsu/utils/base64.html </a> <a class="source" href="../..//jitsu/utils/index.html"> jitsu/utils/index.html </a> <a class="source" href="../..//jitsu.html"> jitsu.html </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> apps.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> </td> <td class="code"> <div class="highlight"><pre><span class="cm">/*</span>
+<span class="cm"> * app.js: Client for the Nodejitsu apps API.</span>
+<span class="cm"> *</span>
+<span class="cm"> * (C) 2010, Nodejitsu Inc.</span>
+<span class="cm"> *</span>
+<span class="cm"> */</span>
+
+<span class="kd">var</span> <span class="nx">util</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;util&#39;</span><span class="p">),</span>
+ <span class="nx">winston</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;winston&#39;</span><span class="p">),</span>
+ <span class="nx">jitsu</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;jitsu&#39;</span><span class="p">);</span></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <h3>function Apps (options)</h3>
+
+<h4>@options {Object} Options for this instance</h4>
+
+<p>Constructor function for the Apps resource responsible
+with Nodejitsu's Apps API</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">var</span> <span class="nx">Apps</span> <span class="o">=</span> <span class="nx">exports</span><span class="p">.</span><span class="nx">Apps</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">options</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">jitsu</span><span class="p">.</span><span class="nx">api</span><span class="p">.</span><span class="nx">Client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">options</span><span class="p">);</span>
+<span class="p">};</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>Inherit from Client base object</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">util</span><span class="p">.</span><span class="nx">inherits</span><span class="p">(</span><span class="nx">Apps</span><span class="p">,</span> <span class="nx">jitsu</span><span class="p">.</span><span class="nx">api</span><span class="p">.</span><span class="nx">Client</span><span class="p">);</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <h3>function list (callback)</h3>
+
+<h4>@callback {function} Continuation to pass control to when complete</h4>
+
+<p>Lists all applications for the authenticated user</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Apps</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">list</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">winston</span><span class="p">.</span><span class="nx">info</span><span class="p">(</span><span class="s1">&#39;Listing apps&#39;</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">_request</span><span class="p">(</span><span class="s1">&#39;GET&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;apps&#39;</span><span class="p">,</span> <span class="nx">jitsu</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">username</span><span class="p">],</span> <span class="nx">callback</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">res</span><span class="p">,</span> <span class="nx">result</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">callback</span><span class="p">(</span><span class="kc">null</span><span class="p">,</span> <span class="nx">result</span><span class="p">.</span><span class="nx">apps</span><span class="p">);</span>
+ <span class="p">});</span>
+<span class="p">};</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">&#182;</a> </div> <h3>function create (app, callback)</h3>
+
+<h4>@app {Object} Package.json manifest for the application.</h4>
+
+<h4>@callback {function} Continuation to pass control to when complete</h4>
+
+<p>Creates an application with the specified package.json manifest in <code>app</code>. </p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Apps</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">create</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">app</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">_request</span><span class="p">(</span><span class="s1">&#39;POST&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;apps&#39;</span><span class="p">,</span> <span class="nx">app</span><span class="p">.</span><span class="nx">name</span><span class="p">],</span> <span class="nx">app</span><span class="p">,</span> <span class="nx">callback</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">res</span><span class="p">,</span> <span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
+
+ <span class="p">});</span>
+<span class="p">};</span></pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">&#182;</a> </div> <h3>function update (name, attrs, callback)</h3>
+
+<h4>@name {string} Name of the application to update</h4>
+
+<h4>@attrs {Object} Attributes to update for this application.</h4>
+
+<h4>@callback {function} Continuation to pass control to when complete</h4>
+
+<p>Updates the application with <code>name</code> with the specified attributes in <code>attrs</code></p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Apps</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">update</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">attrs</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">_request</span><span class="p">(</span><span class="s1">&#39;PUT&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;apps&#39;</span><span class="p">,</span> <span class="nx">name</span><span class="p">],</span> <span class="nx">attrs</span><span class="p">,</span> <span class="nx">callback</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">res</span><span class="p">,</span> <span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
+
+ <span class="p">});</span>
+<span class="p">};</span></pre></div> </td> </tr> <tr id="section-7"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-7">&#182;</a> </div> <h3>function destroy (name, callback)</h3>
+
+<h4>@name {string} Name of the application to destroy</h4>
+
+<h4>@callback {function} Continuation to pass control to when complete</h4>
+
+<p>Destroys the application with <code>name</code> for the authenticated user. </p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Apps</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">destory</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">_request</span><span class="p">(</span><span class="s1">&#39;DELETE&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;apps&#39;</span><span class="p">,</span> <span class="nx">name</span><span class="p">],</span> <span class="nx">callback</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">res</span><span class="p">,</span> <span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
+
+ <span class="p">});</span>
+<span class="p">};</span>
+
+</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
Oops, something went wrong.

0 comments on commit f94720d

Please sign in to comment.