doc/R509/Middleware/Validity.html in r509-middleware-validity-0.1 vs doc/R509/Middleware/Validity.html in r509-middleware-validity-0.2

- old
+ new

@@ -2,79 +2,107 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> - Module: R509::Middleware::Validity + Class: R509::Middleware::Validity - &mdash; Documentation by YARD 0.7.4 + &mdash; Documentation by YARD 0.8.3 </title> <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" /> <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" /> <script type="text/javascript" charset="utf-8"> - relpath = '../..'; - if (relpath != '') relpath += '/'; + hasFrames = window.top.frames.main ? true : false; + relpath = '../../'; + framesUrl = "../../frames.html#!" + escape(window.location.href); </script> + <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script> <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script> </head> <body> - <script type="text/javascript" charset="utf-8"> - if (window.top.frames.main) document.body.className = 'frames'; - </script> - <div id="header"> <div id="menu"> - <a href="../../_index.html">Index (V)</a> &raquo; + <a href="../../_index.html">Index (V)</a> &raquo; <span class='title'><span class='object_link'><a href="../../R509.html" title="R509 (module)">R509</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Middleware.html" title="R509::Middleware (module)">Middleware</a></span></span> &raquo; <span class="title">Validity</span> - + <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div> </div> <div id="search"> - <a id="class_list_link" href="#">Class List</a> + <a class="full_list_link" id="class_list_link" + href="../../class_list.html"> + Class List + </a> - <a id="method_list_link" href="#">Method List</a> + <a class="full_list_link" id="method_list_link" + href="../../method_list.html"> + Method List + </a> - <a id="file_list_link" href="#">File List</a> + <a class="full_list_link" id="file_list_link" + href="../../file_list.html"> + File List + </a> </div> <div class="clear"></div> </div> - + <iframe id="search_frame"></iframe> - - <div id="content"><h1>Module: R509::Middleware::Validity + + <div id="content"><h1>Class: R509::Middleware::Validity </h1> <dl class="box"> + <dt class="r1">Inherits:</dt> + <dd class="r1"> + <span class="inheritName">Object</span> + + <ul class="fullTree"> + <li>Object</li> + + <li class="next">R509::Middleware::Validity</li> + + </ul> + <a href="#" class="inheritanceTree">show all</a> + + </dd> + + + <dt class="r2">Includes:</dt> + <dd class="r2">Dependo::Mixin</dd> + + <dt class="r1 last">Defined in:</dt> - <dd class="r1 last">lib/r509/Middleware/Validity/Version.rb</dd> + <dd class="r1 last">lib/r509/middleware/validity.rb<span class="defines">,<br /> + lib/r509/middleware/validity/version.rb</span> +</dd> </dl> <div class="clear"></div> @@ -83,26 +111,275 @@ <dl class="constants"> <dt id="VERSION-constant" class="">VERSION = </dt> - <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.1</span><span class='tstring_end'>&quot;</span></span></pre></dd> + <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.2</span><span class='tstring_end'>&quot;</span></span></pre></dd> </dl> + + <h2> + Instance Method Summary + <small>(<a href="#" class="summary_toggle">collapse</a>)</small> + </h2> + + <ul class="summary"> + + <li class="public "> + <span class="summary_signature"> + + <a href="#call-instance_method" title="#call (instance method)">- (Object) <strong>call</strong>(env) </a> + + + + </span> + + + + + + + + + + <span class="summary_desc"><div class='inline'></div></span> + +</li> + + + <li class="public "> + <span class="summary_signature"> + + <a href="#initialize-instance_method" title="#initialize (instance method)">- (Validity) <strong>initialize</strong>(app, redis = nil) </a> + + + + </span> + + + <span class="note title constructor">constructor</span> + + + + + + + + + <span class="summary_desc"><div class='inline'> +<p>A new instance of Validity.</p> +</div></span> + +</li> + + + </ul> + + + + <div id="constructor_details" class="method_details_list"> + <h2>Constructor Details</h2> + + <div class="method_details first"> + <h3 class="signature first" id="initialize-instance_method"> + + - (<tt><span class='object_link'><a href="" title="R509::Middleware::Validity (class)">Validity</a></span></tt>) <strong>initialize</strong>(app, redis = nil) + + + + + +</h3><div class="docstring"> + <div class="discussion"> + +<p>A new instance of Validity</p> + + + </div> </div> +<div class="tags"> + + +</div><table class="source_code"> + <tr> + <td> + <pre class="lines"> + + +10 +11 +12 +13 +14 +15 +16 +17</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/r509/middleware/validity.rb', line 10</span> + +<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_app'>app</span><span class='comma'>,</span><span class='id identifier rubyid_redis'>redis</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span> + <span class='ivar'>@app</span> <span class='op'>=</span> <span class='id identifier rubyid_app'>app</span> + + <span class='kw'>if</span> <span class='id identifier rubyid_redis'>redis</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> + <span class='id identifier rubyid_redis'>redis</span> <span class='op'>=</span> <span class='const'>Redis</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> + <span class='kw'>end</span> + <span class='ivar'>@writer</span> <span class='op'>=</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>Validity</span><span class='op'>::</span><span class='const'>Redis</span><span class='op'>::</span><span class='const'>Writer</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_redis'>redis</span><span class='rparen'>)</span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> +</div> + +</div> + + + <div id="instance_method_details" class="method_details_list"> + <h2>Instance Method Details</h2> + + <div class="method_details first"> + <h3 class="signature first" id="call-instance_method"> + + - (<tt>Object</tt>) <strong>call</strong>(env) + + + + + +</h3><table class="source_code"> + <tr> + <td> + <pre class="lines"> + + +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/r509/middleware/validity.rb', line 19</span> + +<span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span> + <span class='id identifier rubyid_status'>status</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='comma'>,</span> <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='ivar'>@app</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span> + + <span class='comment'># we only want to attempt to record validity if status is 200 and it's a call +</span> <span class='comment'># to the &quot;/1/certificate/issue&quot; path +</span> <span class='kw'>if</span> <span class='kw'>not</span> <span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>PATH_INFO</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^\/1\/certificate\/issue\/?$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>and</span> <span class='id identifier rubyid_status'>status</span> <span class='op'>==</span> <span class='int'>200</span> + <span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span> + <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_part'>part</span><span class='op'>|</span> + <span class='id identifier rubyid_body'>body</span> <span class='op'>+=</span> <span class='id identifier rubyid_part'>part</span> + <span class='kw'>end</span> + <span class='kw'>begin</span> + <span class='id identifier rubyid_cert'>cert</span> <span class='op'>=</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>Cert</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:cert</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span> + <span class='id identifier rubyid_log'>log</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Writing serial: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cert'>cert</span><span class='period'>.</span><span class='id identifier rubyid_serial'>serial</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbrace'>}</span><span class='tstring_content'>, Issuer: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cert'>cert</span><span class='period'>.</span><span class='id identifier rubyid_issuer'>issuer</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> + <span class='ivar'>@writer</span><span class='period'>.</span><span class='id identifier rubyid_issue'>issue</span><span class='lparen'>(</span><span class='id identifier rubyid_cert'>cert</span><span class='period'>.</span><span class='id identifier rubyid_issuer'>issuer</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span><span class='id identifier rubyid_cert'>cert</span><span class='period'>.</span><span class='id identifier rubyid_serial'>serial</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span> + <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span> + <span class='id identifier rubyid_log'>log</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Writing failed</span><span class='tstring_end'>&quot;</span></span> + <span class='id identifier rubyid_log'>log</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span> + <span class='kw'>end</span> + <span class='kw'>elsif</span> <span class='kw'>not</span> <span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>PATH_INFO</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^\/1\/certificate\/revoke\/?$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>and</span> <span class='id identifier rubyid_status'>status</span> <span class='op'>==</span> <span class='int'>200</span> + <span class='kw'>begin</span> + <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_params'>parse_params</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span> + + <span class='id identifier rubyid_issuer'>issuer</span> <span class='op'>=</span> <span class='ivar'>@app</span><span class='period'>.</span><span class='id identifier rubyid_config_pool'>config_pool</span><span class='lbracket'>[</span><span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ca</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_ca_cert'>ca_cert</span><span class='period'>.</span><span class='id identifier rubyid_subject'>subject</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> + <span class='id identifier rubyid_serial'>serial</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>serial</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> + <span class='id identifier rubyid_reason'>reason</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>reason</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>||</span> <span class='int'>0</span> + + <span class='id identifier rubyid_log'>log</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Revoking serial: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_serial'>serial</span><span class='rbrace'>}</span><span class='tstring_content'>, reason: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_reason'>reason</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> + + <span class='ivar'>@writer</span><span class='period'>.</span><span class='id identifier rubyid_revoke'>revoke</span><span class='lparen'>(</span><span class='id identifier rubyid_issuer'>issuer</span><span class='comma'>,</span> <span class='id identifier rubyid_serial'>serial</span><span class='comma'>,</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='comma'>,</span> <span class='id identifier rubyid_reason'>reason</span><span class='rparen'>)</span> + <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span> + <span class='id identifier rubyid_log'>log</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Revoking failed: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_serial'>serial</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> + <span class='id identifier rubyid_log'>log</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span> + <span class='kw'>end</span> + <span class='kw'>elsif</span> <span class='kw'>not</span> <span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>PATH_INFO</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^\/1\/certificate\/unrevoke\/?$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>and</span> <span class='id identifier rubyid_status'>status</span> <span class='op'>==</span> <span class='int'>200</span> + <span class='kw'>begin</span> + <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_params'>parse_params</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span> + + <span class='id identifier rubyid_issuer'>issuer</span> <span class='op'>=</span> <span class='ivar'>@app</span><span class='period'>.</span><span class='id identifier rubyid_config_pool'>config_pool</span><span class='lbracket'>[</span><span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ca</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_ca_cert'>ca_cert</span><span class='period'>.</span><span class='id identifier rubyid_subject'>subject</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> + <span class='id identifier rubyid_serial'>serial</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>serial</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> + + <span class='id identifier rubyid_log'>log</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Unrevoking serial: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_serial'>serial</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> + + <span class='ivar'>@writer</span><span class='period'>.</span><span class='id identifier rubyid_unrevoke'>unrevoke</span><span class='lparen'>(</span><span class='id identifier rubyid_issuer'>issuer</span><span class='comma'>,</span> <span class='id identifier rubyid_serial'>serial</span><span class='rparen'>)</span> + <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span> + <span class='id identifier rubyid_log'>log</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Unrevoking failed: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_serial'>serial</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> + <span class='id identifier rubyid_log'>log</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span> + <span class='kw'>end</span> + <span class='kw'>end</span> + + <span class='lbracket'>[</span><span class='id identifier rubyid_status'>status</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='comma'>,</span> <span class='id identifier rubyid_response'>response</span><span class='rbracket'>]</span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> +</div> + + </div> + +</div> + <div id="footer"> - Generated on Wed Jan 4 14:50:53 2012 by + Generated on Thu Nov 8 14:49:20 2012 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.7.4 (ruby-1.9.3). + 0.8.3 (ruby-1.9.3). </div> </body> </html> \ No newline at end of file