Permalink
Browse files

Update Rdoc for 0.2.2

  • Loading branch information...
1 parent f95bedb commit 5de5cd8a9f0192c5478393ebff255bb1c6900bac @ambethia committed Sep 15, 2009
View
@@ -11,7 +11,7 @@
<body>
<a href="http://github.com/ambethia/recaptcha"><img style="position: absolute; top: 0; right: 0; border: 0;" src="forkme_right_dark_red_660000.png" alt="Fork me on GitHub" /></a>
-
+
<div id="container">
<div class="download">
@@ -20,7 +20,7 @@
<a href="http://github.com/ambethia/recaptcha/tarball/master">
<img border="0" width="90" src="http://github.com/images/modules/download/tar.png"></a>
</div>
-
+
<h1><a href="http://github.com/ambethia/recaptcha">recaptcha</a></h1>
<div class="description">
@@ -30,13 +30,15 @@
<p>This plugin adds helpers for the <a href="http://recaptcha.net" title="reCAPTCHA: Stop Spam, Read Books">ReCAPTCHA API</a>. In your views you can use the recaptcha_tags method to embed the needed javascript, and you can validate in your controllers with verify_recaptcha.</p>
<p>See the <a href="rdoc/index.html">RDOC documentation</a> for more information on usage.</p>
-
+
<h2>Dependencies</h2>
-
- <p>Rails &amp; Builder</p>
-
+
+ <ul>
+ <li>Ruby on Rails</li>
+ </ul>
+
<p>I'm looking to remove all external dependencies soon, and make it framework agnostic.</p>
-
+
<h2>License</h2>
<pre>Copyright (c) 2007 Jason L Perry
@@ -81,6 +83,7 @@
<li><a href="http://github.com/chris" title="chris @ GitHub">Chris Bailey</a></li>
<li><a href="http://github.com/yalcin" title="yalcin @ GitHub">Mustafa Yalcin</a></li>
<li><a href="http://github.com/mwhuss" title="mwhuss @ GitHub">Marshall Huss</a></li>
+ <li><a href="http://github.com/chrisfinne" title="chrisfinne @ GitHub">Chris Finne</a></li>
</ul>
<p>If your name is missing from this list, fork the <a href="http://github.com/ambethia/recaptcha/tree/gh-pages" title="ambethia's recaptcha at gh-pages - GitHub">gh-pages</a> branch of the repo, add your self, and send me a pull request.</p>
@@ -93,22 +96,22 @@
</p>
<h2>Download</h2>
-
+
<p>
You can download this project in either
<a href="http://github.com/ambethia/recaptcha/zipball/master">zip</a> or
<a href="http://github.com/ambethia/recaptcha/tarball/master">tar</a> formats.
</p>
-
+
<p>You can also clone the project with <a href="http://git-scm.com">Git</a>
by running:
<pre>$ git clone git://github.com/ambethia/recaptcha</pre>
</p>
-
+
<div class="footer">
get the source code on GitHub : <a href="http://github.com/ambethia/recaptcha">ambethia/recaptcha</a>
</div>
-
+
</div>
<script type="text/javascript">
@@ -1,174 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Module: Ambethia::ReCaptcha::Controller</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
- <script type="text/javascript">
- // <![CDATA[
-
- function popupCode( url ) {
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
- }
-
- function toggleCode( id ) {
- if ( document.getElementById )
- elem = document.getElementById( id );
- else if ( document.all )
- elem = eval( "document.all." + id );
- else
- return false;
-
- elemStyle = elem.style;
-
- if ( elemStyle.display != "block" ) {
- elemStyle.display = "block"
- } else {
- elemStyle.display = "none"
- }
-
- return true;
- }
-
- // Make codeblocks hidden by default
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
-
- // ]]>
- </script>
-
-</head>
-<body>
-
-
-
- <div id="classHeader">
- <table class="header-table">
- <tr class="top-aligned-row">
- <td><strong>Module</strong></td>
- <td class="class-name-in-header">Ambethia::ReCaptcha::Controller</td>
- </tr>
- <tr class="top-aligned-row">
- <td><strong>In:</strong></td>
- <td>
- <a href="../../../files/lib/recaptcha/recaptcha_rb.html">
- lib/recaptcha/recaptcha.rb
- </a>
- <br />
- </td>
- </tr>
-
- </table>
- </div>
- <!-- banner header -->
-
- <div id="bodyContent">
-
-
-
- <div id="contextContent">
-
-
-
- </div>
-
- <div id="method-list">
- <h3 class="section-bar">Methods</h3>
-
- <div class="name-list">
- <a href="#M000001">verify_recaptcha</a>&nbsp;&nbsp;
- </div>
- </div>
-
- </div>
-
-
- <!-- if includes -->
-
- <div id="section">
-
-
-
-
-
-
-
-
- <!-- if method_list -->
- <div id="methods">
- <h3 class="section-bar">Public Instance methods</h3>
-
- <div id="method-M000001" class="method-detail">
- <a name="M000001"></a>
-
- <div class="method-heading">
- <a href="#M000001" class="method-signature">
- <span class="method-name">verify_recaptcha</span><span class="method-args">(options = {})</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Your private API can be specified in the <tt>options</tt> hash or
-preferably the environment variable <tt>RECAPTCHA_PUBLIC_KEY</tt>.
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000001-source">
-<pre>
- <span class="ruby-comment cmt"># File lib/recaptcha/recaptcha.rb, line 52</span>
-52: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">verify_recaptcha</span>(<span class="ruby-identifier">options</span> = {})
-53: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">SKIP_VERIFY_ENV</span>.<span class="ruby-identifier">include?</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'RAILS_ENV'</span>]
-54: <span class="ruby-identifier">model</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)<span class="ruby-operator">?</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:model</span>] <span class="ruby-operator">:</span> <span class="ruby-identifier">options</span>
-55: <span class="ruby-identifier">private_key</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:private_key</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
-56: <span class="ruby-identifier">private_key</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'RECAPTCHA_PRIVATE_KEY'</span>]
-57: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ReCaptchaError</span>, <span class="ruby-value str">&quot;No private key specified.&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">private_key</span>
-58: <span class="ruby-keyword kw">begin</span>
-59: <span class="ruby-identifier">recaptcha</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">post_form</span> <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-node">&quot;http://#{RECAPTCHA_VERIFY_SERVER}/verify&quot;</span>), {
-60: <span class="ruby-value str">&quot;privatekey&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">private_key</span>,
-61: <span class="ruby-value str">&quot;remoteip&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">remote_ip</span>,
-62: <span class="ruby-value str">&quot;challenge&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:recaptcha_challenge_field</span>],
-63: <span class="ruby-value str">&quot;response&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:recaptcha_response_field</span>]
-64: }
-65: <span class="ruby-identifier">answer</span>, <span class="ruby-identifier">error</span> = <span class="ruby-identifier">recaptcha</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">split</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">chomp</span> }
-66: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">answer</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'true'</span>
-67: <span class="ruby-identifier">session</span>[<span class="ruby-identifier">:recaptcha_error</span>] = <span class="ruby-identifier">error</span>
-68: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">model</span>
-69: <span class="ruby-identifier">model</span>.<span class="ruby-identifier">valid?</span>
-70: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Rails</span><span class="ruby-operator">::</span><span class="ruby-constant">VERSION</span><span class="ruby-operator">::</span><span class="ruby-constant">MAJOR</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> <span class="ruby-keyword kw">and</span> <span class="ruby-constant">Rails</span><span class="ruby-operator">::</span><span class="ruby-constant">VERSION</span><span class="ruby-operator">::</span><span class="ruby-constant">MINOR</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">2</span>
-71: <span class="ruby-identifier">model</span>.<span class="ruby-identifier">errors</span>.<span class="ruby-identifier">add</span> <span class="ruby-identifier">:base</span>, <span class="ruby-constant">I18n</span>.<span class="ruby-identifier">translate</span>(<span class="ruby-node">&quot;#{model.class.name.underscore}.captcha&quot;</span>, <span class="ruby-identifier">:scope</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">%w(errors models)</span>, <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:message</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;Captcha response is incorrect, please try again.&quot;</span>))
-72: <span class="ruby-keyword kw">else</span>
-73: <span class="ruby-identifier">model</span>.<span class="ruby-identifier">errors</span>.<span class="ruby-identifier">add</span> <span class="ruby-identifier">:base</span>, <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:message</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;Captcha response is incorrect, please try again.&quot;</span>
-74: <span class="ruby-keyword kw">end</span>
-75: <span class="ruby-keyword kw">end</span>
-76: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
-77: <span class="ruby-keyword kw">else</span>
-78: <span class="ruby-identifier">session</span>[<span class="ruby-identifier">:recaptcha_error</span>] = <span class="ruby-keyword kw">nil</span>
-79: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
-80: <span class="ruby-keyword kw">end</span>
-81: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
-82: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ReCaptchaError</span>, <span class="ruby-identifier">e</span>
-83: <span class="ruby-keyword kw">end</span>
-84: <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
-
- </div>
-
-
- </div>
-
-
-<div id="validator-badges">
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
-</div>
-
-</body>
-</html>
Oops, something went wrong. Retry.

0 comments on commit 5de5cd8

Please sign in to comment.