examples/api-samples/public/docs/sample28.html in groupdocs-1.5.8 vs examples/api-samples/public/docs/sample28.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">:client_id</span>]
set <span class="symbol">:private_key</span>, params[<span class="symbol">:private_key</span>]
@@ -76,11 +76,11 @@
<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.file_id.empty?</pre></div></div>
@@ -91,45 +91,98 @@
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">¶</a>
</div>
+<<<<<<< HEAD
<p>Configure your access to API server.</p>
+=======
+ <p>Prepare base path</p>
</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>Configure your access to API server</p>
+>>>>>>> samples-dev
+
+ </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
<span class="keyword">end</span></pre></div></div>
</li>
- <li id="section-6">
+ <li id="section-7">
<div class="annotation">
<div class="pilwrap ">
- <a class="pilcrow" href="#section-6">¶</a>
+ <a class="pilcrow" href="#section-7">¶</a>
</div>
+<<<<<<< HEAD
<p>make a request to API using client_id and private_key</p>
+=======
+ <p>Optionally specify API server and version</p>
</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>Make a request to API using client_id and private_key</p>
+>>>>>>> samples-dev
+
+ </div>
+
<div class="content"><div class='highlight'><pre> files_list = <span class="constant">GroupDocs::Storage::Folder</span>.list!(<span class="string">'/'</span>, {})
document = <span class="string">''</span></pre></div></div>
</li>
+<<<<<<< HEAD
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">¶</a>
+=======
+ <li id="section-9">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-9">¶</a>
+>>>>>>> samples-dev
</div>
- <p>get document by file ID</p>
+ <p>Get document by file ID</p>
</div>
<div class="content"><div class='highlight'><pre> files_list.each <span class="keyword">do</span> |element|
<span class="keyword">if</span> element.respond_to?(<span class="string">'guid'</span>) == <span class="keyword">true</span> <span class="keyword">and</span> element.guid == settings.file_id
@@ -141,38 +194,126 @@
<span class="keyword">unless</span> document.instance_of? <span class="constant">String</span></pre></div></div>
</li>
+<<<<<<< HEAD
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">¶</a>
+=======
+ <li id="section-10">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-10">¶</a>
+>>>>>>> samples-dev
</div>
- <p>get list of annotations</p>
+ <p>Get list of annotations</p>
</div>
<div class="content"><div class='highlight'><pre> annotations = document.to_document.annotations!(<span class="symbol">:client_id</span> => settings.client_id, <span class="symbol">:private_key</span> => settings.private_key)</pre></div></div>
</li>
+<<<<<<< HEAD
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">¶</a>
+=======
+ <li id="section-11">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-11">¶</a>
+>>>>>>> samples-dev
</div>
- <p>delete all annotations from document</p>
+ <p>Delete all annotations from document</p>
</div>
<div class="content"><div class='highlight'><pre> annotations.each <span class="keyword">do</span> |annotation|
+<<<<<<< HEAD
annotation.remove!(<span class="symbol">:client_id</span> => settings.client_id, <span class="symbol">:private_key</span> => settings.private_key)
<span class="keyword">end</span>
+=======
+ annotation.remove!()
+ <span class="keyword">end</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-12">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-12">¶</a>
+ </div>
+ <p>Prepare to sign url</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> iframe = <span class="string">"/document-viewer/embed/<span class="subst">#{settings.file_id}</span>"</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-13">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-13">¶</a>
+ </div>
+ <p>Construct result string</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> url = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> => iframe).prepare_and_sign_url</pre></div></div>
+
+ </li>
+
+
+ <li id="section-14">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-14">¶</a>
+ </div>
+ <p>Generate iframe URL</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> base_path
+ <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
+ iframe = <span class="string">"https://stage-api-groupdocs.dynabic.com<span class="subst">#{url}</span>"</span>
+ <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
+ iframe = <span class="string">"https://dev-apps.groupdocs.com<span class="subst">#{url}</span>"</span>
+ <span class="keyword">else</span>
+ iframe = <span class="string">"https://apps.groupdocs.com<span class="subst">#{url}</span>"</span>
+ <span class="keyword">end</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-15">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-15">¶</a>
+ </div>
+ <p>Make iframe</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> iframe = <span class="string">"<iframe id='downloadframe' src='<span class="subst">#{iframe}</span>' width='800' height='1000'></iframe>"</span>
+>>>>>>> samples-dev
message = <span class="string">'Annotations was deleted from document'</span>
<span class="keyword">end</span>
<span class="keyword">rescue</span> <span class="constant">Exception</span> => e
@@ -180,20 +321,28 @@
<span class="keyword">end</span></pre></div></div>
</li>
+<<<<<<< HEAD
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">¶</a>
+=======
+ <li id="section-16">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-16">¶</a>
+>>>>>>> samples-dev
</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">:sample28</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">:messages</span> => message, <span class="symbol">:fileId</span> => settings.file_id, <span class="symbol">:err</span> => err}
+ <div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample28</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">:messages</span> => message, <span class="symbol">:iframe</span> => iframe, <span class="symbol">:fileId</span> => settings.file_id, <span class="symbol">:err</span> => err}
<span class="keyword">end</span></pre></div></div>
</li>
</ul>