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">¶</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">¶</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">¶</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">¶</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">¶</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">¶</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">¶</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">¶</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">"<table class='border'>"</span>
result += <span class="string">"<tr><td><font color='green'>Change Name</font></td><td><font color='green'>Change</font></td></tr>"</span>
changes.each <span class="keyword">do</span> |change|
result += <span class="string">"<tr><td>id</td><td><span class="subst">#{change.id}</span></td></tr>"</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">¶</a>
+ <a class="pilcrow" href="#section-11">¶</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> => {<span class="symbol">:userId</span> => settings.client_id, <span class="symbol">:privateKey</span> => settings.private_key, <span class="symbol">:resultFileId</span> => settings.resultFileId, <span class="symbol">:result</span> => result, <span class="symbol">:err</span> => err}
<span class="keyword">end</span></pre></div></div>