doc/BigBench/Fragment.html in bigbench-0.0.1 vs doc/BigBench/Fragment.html in bigbench-0.0.2

- old
+ new

@@ -105,10 +105,12 @@ <li><a href="../BigBench/Benchmark.html">BigBench::Benchmark</a> <li><a href="../BigBench/Benchmark/Benchmark.html">BigBench::Benchmark::Benchmark</a> + <li><a href="../BigBench/Benchmark/Looper.html">BigBench::Benchmark::Looper</a> + <li><a href="../BigBench/Bot.html">BigBench::Bot</a> <li><a href="../BigBench/Configuration.html">BigBench::Configuration</a> <li><a href="../BigBench/Configuration/Config.html">BigBench::Configuration::Config</a> @@ -133,18 +135,18 @@ <li><a href="../BigBench/Tracker.html">BigBench::Tracker</a> <li><a href="../BigBench/Tracker/Tracker.html">BigBench::Tracker::Tracker</a> + <li><a href="../EventMachineLoop.html">EventMachineLoop</a> + <li><a href="../Float.html">Float</a> <li><a href="../Helpers.html">Helpers</a> <li><a href="../Object.html">Object</a> - <li><a href="../TestWebServer.html">TestWebServer</a> - </ul> </nav> </div> </nav> @@ -165,15 +167,33 @@ <p>Possible fragment types are the HTTP verbs, like GET, POST, PUT and DELETE. They look like this:</p> <pre class="ruby"><span class="ruby-identifier">get</span> <span class="ruby-string">&quot;/&quot;</span> -<span class="ruby-identifier">post</span> <span class="ruby-string">&quot;/login/new&quot;</span>, { :<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;a name&quot;</span>, :<span class="ruby-identifier">password</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;secret&quot;</span> } -<span class="ruby-identifier">put</span> <span class="ruby-string">&quot;/books&quot;</span>, { :<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;A Book title&quot;</span>, :<span class="ruby-identifier">rating</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">30.4</span> } -<span class="ruby-identifier">delete</span> <span class="ruby-string">&quot;/books/5&quot;</span> +<span class="ruby-identifier">post</span> <span class="ruby-string">&quot;/login/new&quot;</span> +<span class="ruby-identifier">put</span> <span class="ruby-string">&quot;/books&quot;</span> +<span class="ruby-identifier">delete</span> <span class="ruby-string">&quot;/books/5&quot;</span>, :<span class="ruby-identifier">params</span> =<span class="ruby-operator">&gt;</span> { :<span class="ruby-identifier">token</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'87bas67dfjgbrjbbgbi6ica7s0b3t0'</span> } +<span class="ruby-identifier">get</span> <span class="ruby-string">&quot;/admin&quot;</span>, :<span class="ruby-identifier">basic_auth</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-string">'username'</span>, <span class="ruby-string">'password'</span>] </pre> +<p>After any fragment an options hash can be appended. Possible options are:</p> +<dl class="rdoc-list label-list"><dt>:basic_auth +<dd> +<p>Supply a basic auth user and password for the request. The request then +looks like this:</p> + +<pre class="ruby"><span class="ruby-identifier">get</span> <span class="ruby-string">&quot;/&quot;</span>, :<span class="ruby-identifier">basic_auth</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-string">'username'</span>, <span class="ruby-string">'password'</span>] +</pre> +</dd><dt>:params +<dd> +<p>Supply params for the request body, like e.g. form data:</p> + +<pre class="ruby"><span class="ruby-identifier">post</span> <span class="ruby-string">&quot;/books/new&quot;</span>, :<span class="ruby-identifier">params</span> =<span class="ruby-operator">&gt;</span> { :<span class="ruby-identifier">book</span> =<span class="ruby-operator">&gt;</span> { :<span class="ruby-identifier">title</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;Metaprogramming Ruby&quot;</span>, :<span class="ruby-identifier">publisher</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;O'Reilly&quot;</span> } } +<span class="ruby-identifier">post</span> <span class="ruby-string">&quot;/trackings/add&quot;</span>, :<span class="ruby-identifier">params</span> =<span class="ruby-operator">&gt;</span> { :<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;Tommy&quot;</span> } +</pre> +</dd></dl> + </div><!-- description --> @@ -194,28 +214,27 @@ <div id="method-c-delete" class="method-detail "> <div class="method-heading"> <span class="method-name">delete</span><span - class="method-args">(path, params = {})</span> + class="method-args">(path, options = {})</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Performs a DELETE request to the given url, e.g.</p> -<pre class="ruby"><span class="ruby-identifier">delete</span> <span class="ruby-string">&quot;/books/5&quot;</span>, { :<span class="ruby-identifier">user</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;some@sample.com&quot;</span>, :<span class="ruby-identifier">password</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;secret&quot;</span> } -</pre> +<pre>delete &quot;/books/5&quot;</pre> <div class="method-source-code" id="delete-source"> - <pre><span class="ruby-comment"># File lib/bigbench/fragment.rb, line 99</span> -<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">params</span> = {}) - <span class="ruby-ivar">@fragments</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Fragment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@benchmark</span>, <span class="ruby-identifier">path</span>, <span class="ruby-value">:delete</span>, <span class="ruby-identifier">params</span>) + <pre><span class="ruby-comment"># File lib/bigbench/fragment.rb, line 112</span> +<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span> = {}) + <span class="ruby-ivar">@fragments</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Fragment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@benchmark</span>, <span class="ruby-identifier">path</span>, <span class="ruby-value">:delete</span>, <span class="ruby-identifier">options</span>) <span class="ruby-keyword">end</span></pre> </div><!-- delete-source --> </div> @@ -227,11 +246,11 @@ <div id="method-c-get" class="method-detail "> <div class="method-heading"> <span class="method-name">get</span><span - class="method-args">(path)</span> + class="method-args">(path, options = {})</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> @@ -241,13 +260,13 @@ <pre>get &quot;/some/page&quot;</pre> <div class="method-source-code" id="get-source"> - <pre><span class="ruby-comment"># File lib/bigbench/fragment.rb, line 75</span> -<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">path</span>) - <span class="ruby-ivar">@fragments</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Fragment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@benchmark</span>, <span class="ruby-identifier">path</span>, <span class="ruby-value">:get</span>, {}) + <pre><span class="ruby-comment"># File lib/bigbench/fragment.rb, line 88</span> +<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span> = {}) + <span class="ruby-ivar">@fragments</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Fragment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@benchmark</span>, <span class="ruby-identifier">path</span>, <span class="ruby-value">:get</span>, <span class="ruby-identifier">options</span>) <span class="ruby-keyword">end</span></pre> </div><!-- get-source --> </div> @@ -272,11 +291,11 @@ fully configured fragments for it</p> <div class="method-source-code" id="parse-source"> - <pre><span class="ruby-comment"># File lib/bigbench/fragment.rb, line 104</span> + <pre><span class="ruby-comment"># File lib/bigbench/fragment.rb, line 117</span> <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">benchmark</span>, &amp;<span class="ruby-identifier">block</span>) <span class="ruby-identifier">reset!</span> <span class="ruby-keyword">return</span> [] <span class="ruby-keyword">if</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-ivar">@benchmark</span> = <span class="ruby-identifier">benchmark</span> <span class="ruby-identifier">module_exec</span>(&amp;<span class="ruby-identifier">block</span>) @@ -294,28 +313,27 @@ <div id="method-c-post" class="method-detail "> <div class="method-heading"> <span class="method-name">post</span><span - class="method-args">(path, params = {})</span> + class="method-args">(path, options = {})</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Performs a POST request to the given url, e.g.</p> -<pre class="ruby"><span class="ruby-identifier">post</span> <span class="ruby-string">&quot;/login&quot;</span>, { :<span class="ruby-identifier">user</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;some@sample.com&quot;</span>, :<span class="ruby-identifier">password</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;secret&quot;</span> } -</pre> +<pre>post &quot;/login&quot;</pre> <div class="method-source-code" id="post-source"> - <pre><span class="ruby-comment"># File lib/bigbench/fragment.rb, line 83</span> -<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">params</span> = {}) - <span class="ruby-ivar">@fragments</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Fragment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@benchmark</span>, <span class="ruby-identifier">path</span>, <span class="ruby-value">:post</span>, <span class="ruby-identifier">params</span>) + <pre><span class="ruby-comment"># File lib/bigbench/fragment.rb, line 96</span> +<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span> = {}) + <span class="ruby-ivar">@fragments</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Fragment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@benchmark</span>, <span class="ruby-identifier">path</span>, <span class="ruby-value">:post</span>, <span class="ruby-identifier">options</span>) <span class="ruby-keyword">end</span></pre> </div><!-- post-source --> </div> @@ -327,28 +345,27 @@ <div id="method-c-put" class="method-detail "> <div class="method-heading"> <span class="method-name">put</span><span - class="method-args">(path, params = {})</span> + class="method-args">(path, options = {})</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Performs a PUT request to the given url, e.g.</p> -<pre class="ruby"><span class="ruby-identifier">put</span> <span class="ruby-string">&quot;/books&quot;</span>, { :<span class="ruby-identifier">book</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;Some book content&quot;</span> } -</pre> +<pre>put &quot;/books&quot;</pre> <div class="method-source-code" id="put-source"> - <pre><span class="ruby-comment"># File lib/bigbench/fragment.rb, line 91</span> -<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">put</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">params</span> = {}) - <span class="ruby-ivar">@fragments</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Fragment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@benchmark</span>, <span class="ruby-identifier">path</span>, <span class="ruby-value">:put</span>, <span class="ruby-identifier">params</span>) + <pre><span class="ruby-comment"># File lib/bigbench/fragment.rb, line 104</span> +<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">put</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span> = {}) + <span class="ruby-ivar">@fragments</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Fragment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@benchmark</span>, <span class="ruby-identifier">path</span>, <span class="ruby-value">:put</span>, <span class="ruby-identifier">options</span>) <span class="ruby-keyword">end</span></pre> </div><!-- put-source --> </div> @@ -372,10 +389,10 @@ <p>Reset all fragments</p> <div class="method-source-code" id="reset-21-source"> - <pre><span class="ruby-comment"># File lib/bigbench/fragment.rb, line 113</span> + <pre><span class="ruby-comment"># File lib/bigbench/fragment.rb, line 126</span> <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">reset!</span> <span class="ruby-ivar">@benchmark</span> = <span class="ruby-keyword">nil</span> <span class="ruby-ivar">@fragments</span> = [] <span class="ruby-keyword">end</span></pre> </div><!-- reset-21-source -->