examples/api-samples/public/docs/sample20.html in groupdocs-1.5.8 vs examples/api-samples/public/docs/sample20.html in groupdocs-1.5.9

- old
+ new

@@ -57,11 +57,11 @@ <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-3">&#182;</a> </div> - <p>set variables</p> + <p>Set variables</p> </div> <div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:clientId</span>] set <span class="symbol">:private_key</span>, params[<span class="symbol">:privateKey</span>] @@ -77,96 +77,114 @@ <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-4">&#182;</a> </div> - <p>check required variables</p> + <p>Check required variables</p> </div> - <div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.client_id.empty? <span class="keyword">or</span> settings.private_key.empty? <span class="keyword">or</span> settings.resultFileId.empty? - - <span class="keyword">if</span> settings.base_path.empty? <span class="keyword">then</span> settings.base_path = <span class="string">'https://api.groupdocs.com'</span> <span class="keyword">end</span></pre></div></div> + <div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.client_id.empty? <span class="keyword">or</span> settings.private_key.empty? <span class="keyword">or</span> settings.resultFileId.empty?</pre></div></div> </li> <li id="section-5"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-5">&#182;</a> </div> - <p>Configure your access to API server</p> + <p>Prepare base path</p> </div> - <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs| - groupdocs.client_id = settings.client_id - groupdocs.private_key = settings.private_key</pre></div></div> + <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.base_path.empty? + base_path = <span class="string">'https://api.groupdocs.com'</span> + <span class="keyword">elsif</span> settings.base_path.match(<span class="string">'/v2.0'</span>) + base_path = settings.base_path.split(<span class="string">'/v2.0'</span>)[<span class="number">0</span>] + <span class="keyword">else</span> + base_path = settings.base_path + <span class="keyword">end</span></pre></div></div> </li> <li id="section-6"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-6">&#182;</a> </div> - <p>Optionally specify API server and version</p> + <p>Configure your access to API server</p> </div> - <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span> - <span class="keyword">end</span></pre></div></div> + <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs| + groupdocs.client_id = settings.client_id + groupdocs.private_key = settings.private_key</pre></div></div> </li> <li id="section-7"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-7">&#182;</a> </div> - <p>construct new storage file</p> + <p>Optionally specify API server and version</p> </div> - <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.new(<span class="symbol">guid:</span> settings.resultFileId)</pre></div></div> + <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="comment"># default is 'https://api.groupdocs.com'</span> + <span class="keyword">end</span></pre></div></div> </li> <li id="section-8"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-8">&#182;</a> </div> - <p>construct new document</p> + <p>Construct new storage file</p> </div> - <div class="content"><div class='highlight'><pre> document = <span class="constant">GroupDocs::Document</span>.new(<span class="symbol">file:</span> file)</pre></div></div> + <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.new(<span class="symbol">guid:</span> settings.resultFileId)</pre></div></div> </li> <li id="section-9"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-9">&#182;</a> </div> - <p>get compare changes</p> + <p>Construct new document</p> </div> - <div class="content"><div class='highlight'><pre> changes = document.changes!() + <div class="content"><div class='highlight'><pre> document = <span class="constant">GroupDocs::Document</span>.new(<span class="symbol">file:</span> file)</pre></div></div> + + </li> + + + <li id="section-10"> + <div class="annotation"> + + <div class="pilwrap "> + <a class="pilcrow" href="#section-10">&#182;</a> + </div> + <p>Get compare changes</p> + </div> + + <div class="content"><div class='highlight'><pre> changes = document.changes!() result = <span class="string">''</span> result += <span class="string">"&lt;table class='border'&gt;"</span> result += <span class="string">"&lt;tr&gt;&lt;td&gt;&lt;font color='green'&gt;Change Name&lt;/font&gt;&lt;/td&gt;&lt;td&gt;&lt;font color='green'&gt;Change&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;"</span> changes.each <span class="keyword">do</span> |change| result += <span class="string">"&lt;tr&gt;&lt;td&gt;id&lt;/td&gt;&lt;td&gt;<span class="subst">#{change.id}</span>&lt;/td&gt;&lt;/tr&gt;"</span> @@ -189,16 +207,16 @@ <span class="keyword">end</span></pre></div></div> </li> - <li id="section-10"> + <li id="section-11"> <div class="annotation"> <div class="pilwrap "> - <a class="pilcrow" href="#section-10">&#182;</a> + <a class="pilcrow" href="#section-11">&#182;</a> </div> - <p>set variables for template</p> + <p>Set variables for template</p> </div> <div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample20</span>, <span class="symbol">:locals</span> =&gt; {<span class="symbol">:userId</span> =&gt; settings.client_id, <span class="symbol">:privateKey</span> =&gt; settings.private_key, <span class="symbol">:resultFileId</span> =&gt; settings.resultFileId, <span class="symbol">:result</span> =&gt; result, <span class="symbol">:err</span> =&gt; err} <span class="keyword">end</span></pre></div></div>