examples/api-samples/public/docs/sample16.html in groupdocs-1.5.7 vs examples/api-samples/public/docs/sample16.html in groupdocs-1.5.8
- old
+ new
@@ -57,15 +57,16 @@
<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">:fileId</span>, params[<span class="symbol">:fileId</span>]
+ set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]
<span class="keyword">begin</span></pre></div></div>
</li>
@@ -74,42 +75,115 @@
<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.fileId.empty?</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.fileId.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>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">¶</a>
</div>
- <p>construct result iframe</p>
+ <p>Configure your access to API server</p>
</div>
- <div class="content"><div class='highlight'><pre> iframe = <span class="string">"<iframe src='https://apps.groupdocs.com/assembly2/questionnaire-assembly/<span class="subst">#{settings.fileId}</span>' frameborder='0' width='100%' height='600'></iframe>"</span>
+ <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-6">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-6">¶</a>
+ </div>
+ <p>Optionally specify API server and version</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>
+
+ </li>
+
+
+ <li id="section-7">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-7">¶</a>
+ </div>
+ <p>Get url from request</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.base_path
+
+ <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
+ url = <span class="string">"http://stage-apps-groupdocs.dynabic.com/assembly2/questionnaire-assembly/<span class="subst">#{settings.fileId}</span>"</span>
+ <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
+ url = <span class="string">"http://dev-apps-groupdocs.dynabic.com/assembly2/questionnaire-assembly/<span class="subst">#{settings.fileId}</span>"</span>
+ <span class="keyword">else</span>
+ url = <span class="string">"https://apps.groupdocs.com/assembly2/questionnaire-assembly/<span class="subst">#{settings.fileId}</span>"</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>Add the signature to the url request</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> iframe = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> => url).prepare_and_sign_url</pre></div></div>
+
+ </li>
+
+
+ <li id="section-9">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-9">¶</a>
+ </div>
+ <p>Construct result iframe</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> iframe = <span class="string">"<iframe src='<span class="subst">#{iframe}</span>' frameborder='0' width='100%' height='600'></iframe>"</span>
+
<span class="keyword">rescue</span> <span class="constant">Exception</span> => e
err = e.message
<span class="keyword">end</span></pre></div></div>
</li>
- <li id="section-6">
+ <li id="section-10">
<div class="annotation">
<div class="pilwrap ">
- <a class="pilcrow" href="#section-6">¶</a>
+ <a class="pilcrow" href="#section-10">¶</a>
</div>
<p>set variables for template</p>
</div>