examples/api-samples/public/docs/sample37.html in groupdocs-1.6.0 vs examples/api-samples/public/docs/sample37.html in groupdocs-1.7.0

- old
+ new

@@ -25,17 +25,17 @@ <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-1">&#182;</a> </div> - <p>Route the handler url &quot;/sample37&quot;</p> + <p>Route the handler url “/sample37”</p> </div> - <div class="content"><div class='highlight'><pre>get <span class="string">'/sample37'</span> <span class="keyword">do</span> - haml <span class="symbol">:sample37</span> -<span class="keyword">end</span></pre></div></div> + <div class="content"><div class='highlight'><pre>get <span class="hljs-string">'/sample-37-how-to-create-envelop-and-download-signed-document-when-envelop-was-signed-using-callback'</span> <span class="hljs-keyword">do</span> + haml <span class="hljs-symbol">:sample37</span> +<span class="hljs-keyword">end</span></pre></div></div> </li> <li id="section-2"> @@ -55,18 +55,18 @@ <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-3">&#182;</a> </div> - <p>Route the handler url &quot;/sample37/signature_callback&quot;. The block function for callback with server</p> + <p>Route the handler url “/sample37/signature_callback”. The block function for callback with server</p> </div> - <div class="content"><div class='highlight'><pre>post <span class="string">'/sample37/signature_callback'</span> <span class="keyword">do</span> - <span class="keyword">unless</span> <span class="constant">File</span>.directory?(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/downloads"</span>) - <span class="keyword">return</span> <span class="string">'Directory was not found.'</span> - <span class="keyword">end</span></pre></div></div> + <div class="content"><div class='highlight'><pre>post <span class="hljs-string">'/sample37/signature_callback'</span> <span class="hljs-keyword">do</span> + <span class="hljs-keyword">unless</span> <span class="hljs-constant">File</span>.directory?(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/downloads"</span>) + <span class="hljs-keyword">return</span> <span class="hljs-string">'Directory was not found.'</span> + <span class="hljs-keyword">end</span></pre></div></div> </li> <li id="section-4"> @@ -77,13 +77,13 @@ </div> <p>Get file name from download directory</p> </div> - <div class="content"><div class='highlight'><pre> name = <span class="keyword">nil</span> + <div class="content"><div class='highlight'><pre> name = <span class="hljs-keyword">nil</span> - i = <span class="number">0</span></pre></div></div> + i = <span class="hljs-number">0</span></pre></div></div> </li> <li id="section-5"> @@ -94,36 +94,36 @@ </div> <p>Checking, if file exist</p> </div> - <div class="content"><div class='highlight'><pre> <span class="keyword">while</span> i&lt;<span class="number">10</span> <span class="keyword">do</span> - sleep(<span class="number">5</span>) - <span class="constant">Dir</span>.entries(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/downloads"</span>).each <span class="keyword">do</span> |file| - name = file <span class="keyword">if</span> file != <span class="string">'.'</span> &amp;&amp; file != <span class="string">'..'</span> - <span class="keyword">end</span> - <span class="keyword">break</span> <span class="keyword">if</span> name - i += <span class="number">1</span> - <span class="keyword">end</span> + <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">while</span> i&lt;<span class="hljs-number">10</span> <span class="hljs-keyword">do</span> + sleep(<span class="hljs-number">5</span>) + <span class="hljs-constant">Dir</span>.entries(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/downloads"</span>).each <span class="hljs-keyword">do</span> |file| + name = file <span class="hljs-keyword">if</span> file != <span class="hljs-string">'.'</span> &amp;&amp; file != <span class="hljs-string">'..'</span> + <span class="hljs-keyword">end</span> + <span class="hljs-keyword">break</span> <span class="hljs-keyword">if</span> name + i += <span class="hljs-number">1</span> + <span class="hljs-keyword">end</span> name -<span class="keyword">end</span></pre></div></div> +<span class="hljs-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>Route the handler url &quot;/sample37/downloads&quot;</p> + <p>Route the handler url “/sample37/downloads”</p> </div> - <div class="content"><div class='highlight'><pre>get <span class="string">'/sample37/downloads/:filename'</span> <span class="keyword">do</span> |filename|</pre></div></div> + <div class="content"><div class='highlight'><pre>get <span class="hljs-string">'/sample37/downloads/:filename'</span> <span class="hljs-keyword">do</span> |filename|</pre></div></div> </li> <li id="section-7"> @@ -134,27 +134,27 @@ </div> <p>Send file with header to download it</p> </div> - <div class="content"><div class='highlight'><pre> send_file <span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/downloads/<span class="subst">#{filename}</span>"</span>, <span class="symbol">:filename</span> =&gt; filename, <span class="symbol">:type</span> =&gt; <span class="string">'Application/octet-stream'</span> -<span class="keyword">end</span></pre></div></div> + <div class="content"><div class='highlight'><pre> send_file <span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/downloads/<span class="hljs-subst">#{filename}</span>"</span>, <span class="hljs-symbol">:filename</span> =&gt; filename, <span class="hljs-symbol">:type</span> =&gt; <span class="hljs-string">'Application/octet-stream'</span> +<span class="hljs-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>Route the handler url &quot;/sample37&quot;. The function block creates new envelope</p> + <p>Route the handler url “/sample37”. The function block creates new envelope</p> </div> - <div class="content"><div class='highlight'><pre>post <span class="string">'/sample37'</span> <span class="keyword">do</span></pre></div></div> + <div class="content"><div class='highlight'><pre>post <span class="hljs-string">'/sample-37-how-to-create-envelop-and-download-signed-document-when-envelop-was-signed-using-callback'</span> <span class="hljs-keyword">do</span></pre></div></div> </li> <li id="section-9"> @@ -165,20 +165,20 @@ </div> <p>Set variables from form</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>] - set <span class="symbol">:email</span>, params[<span class="symbol">:email</span>] - set <span class="symbol">:name</span>, params[<span class="symbol">:name</span>] - set <span class="symbol">:lastName</span>, params[<span class="symbol">:lastName</span>] - set <span class="symbol">:fileId</span>, params[<span class="symbol">:fileId</span>] - set <span class="symbol">:callback</span>, params[<span class="symbol">:callback</span>] - set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>] - set <span class="symbol">:url</span>, params[<span class="symbol">:url</span>] - set <span class="symbol">:source</span>, params[<span class="symbol">:source</span>]</pre></div></div> + <div class="content"><div class='highlight'><pre> set <span class="hljs-symbol">:client_id</span>, params[<span class="hljs-symbol">:clientId</span>] + set <span class="hljs-symbol">:private_key</span>, params[<span class="hljs-symbol">:privateKey</span>] + set <span class="hljs-symbol">:email</span>, params[<span class="hljs-symbol">:email</span>] + set <span class="hljs-symbol">:name</span>, params[<span class="hljs-symbol">:name</span>] + set <span class="hljs-symbol">:lastName</span>, params[<span class="hljs-symbol">:lastName</span>] + set <span class="hljs-symbol">:fileId</span>, params[<span class="hljs-symbol">:fileId</span>] + set <span class="hljs-symbol">:callback</span>, params[<span class="hljs-symbol">:callback</span>] + set <span class="hljs-symbol">:base_path</span>, params[<span class="hljs-symbol">:basePath</span>] + set <span class="hljs-symbol">:url</span>, params[<span class="hljs-symbol">:url</span>] + set <span class="hljs-symbol">:source</span>, params[<span class="hljs-symbol">:source</span>]</pre></div></div> </li> <li id="section-10"> @@ -189,11 +189,11 @@ </div> <p>Set download path</p> </div> - <div class="content"><div class='highlight'><pre> downloads_path = <span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/downloads"</span></pre></div></div> + <div class="content"><div class='highlight'><pre> downloads_path = <span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/downloads"</span></pre></div></div> </li> <li id="section-11"> @@ -204,17 +204,17 @@ </div> <p>Remove all files from download directory or create folder if it not there</p> </div> - <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> <span class="constant">File</span>.directory?(downloads_path) - <span class="constant">Dir</span>.foreach(downloads_path) { |f| fn = <span class="constant">File</span>.join(downloads_path, f); <span class="constant">File</span>.delete(fn) <span class="keyword">if</span> f != <span class="string">'.'</span> &amp;&amp; f != <span class="string">'..'</span> } - <span class="keyword">else</span> - <span class="constant">Dir::</span>mkdir(downloads_path) - <span class="keyword">end</span> + <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-constant">File</span>.directory?(downloads_path) + <span class="hljs-constant">Dir</span>.foreach(downloads_path) { |f| fn = <span class="hljs-constant">File</span>.join(downloads_path, f); <span class="hljs-constant">File</span>.delete(fn) <span class="hljs-keyword">if</span> f != <span class="hljs-string">'.'</span> &amp;&amp; f != <span class="hljs-string">'..'</span> } + <span class="hljs-keyword">else</span> + <span class="hljs-constant">Dir::</span>mkdir(downloads_path) + <span class="hljs-keyword">end</span> - <span class="keyword">begin</span></pre></div></div> + <span class="hljs-keyword">begin</span></pre></div></div> </li> <li id="section-12"> @@ -225,11 +225,11 @@ </div> <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.email.empty? <span class="keyword">or</span> settings.name.empty? <span class="keyword">or</span> settings.lastName.empty?</pre></div></div> + <div class="content"><div class='highlight'><pre> raise <span class="hljs-string">'Please enter all required parameters'</span> <span class="hljs-keyword">if</span> settings.client_id.empty? <span class="hljs-keyword">or</span> settings.private_key.empty? <span class="hljs-keyword">or</span> settings.email.empty? <span class="hljs-keyword">or</span> settings.name.empty? <span class="hljs-keyword">or</span> settings.lastName.empty?</pre></div></div> </li> <li id="section-13"> @@ -240,17 +240,17 @@ </div> <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> + <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> settings.base_path.empty? + base_path = <span class="hljs-string">'https://api.groupdocs.com'</span> + <span class="hljs-keyword">elsif</span> settings.base_path.match(<span class="hljs-string">'/v2.0'</span>) + base_path = settings.base_path.split(<span class="hljs-string">'/v2.0'</span>)[<span class="hljs-number">0</span>] + <span class="hljs-keyword">else</span> base_path = settings.base_path - <span class="keyword">end</span></pre></div></div> + <span class="hljs-keyword">end</span></pre></div></div> </li> <li id="section-14"> @@ -261,11 +261,11 @@ </div> <p>Configure your access to API server</p> </div> - <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs| + <div class="content"><div class='highlight'><pre> <span class="hljs-constant">GroupDocs</span>.configure <span class="hljs-keyword">do</span> |groupdocs| groupdocs.client_id = settings.client_id groupdocs.private_key = settings.private_key</pre></div></div> </li> @@ -278,12 +278,12 @@ </div> <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> + <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="hljs-comment"># default is 'https://api.groupdocs.com'</span> + <span class="hljs-keyword">end</span></pre></div></div> </li> <li id="section-16"> @@ -294,12 +294,12 @@ </div> <p>Write client and private key to the file for callback job</p> </div> - <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.callback - out_file = <span class="constant">File</span>.new(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/user_info.txt"</span>, <span class="string">'w'</span>)</pre></div></div> + <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> settings.callback + out_file = <span class="hljs-constant">File</span>.new(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/user_info.txt"</span>, <span class="hljs-string">'w'</span>)</pre></div></div> </li> <li id="section-17"> @@ -310,16 +310,16 @@ </div> <p>White space is required</p> </div> - <div class="content"><div class='highlight'><pre> out_file.write(<span class="string">"<span class="subst">#{settings.client_id}</span> "</span>) - out_file.write(<span class="string">"<span class="subst">#{settings.private_key}</span>"</span>) + <div class="content"><div class='highlight'><pre> out_file.write(<span class="hljs-string">"<span class="hljs-subst">#{settings.client_id}</span> "</span>) + out_file.write(<span class="hljs-string">"<span class="hljs-subst">#{settings.private_key}</span>"</span>) out_file.close - <span class="keyword">end</span> + <span class="hljs-keyword">end</span> - file = <span class="keyword">nil</span></pre></div></div> + file = <span class="hljs-keyword">nil</span></pre></div></div> </li> <li id="section-18"> @@ -330,12 +330,12 @@ </div> <p>Get document by file GUID</p> </div> - <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.source - <span class="keyword">when</span> <span class="string">'guid'</span></pre></div></div> + <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">case</span> settings.source + <span class="hljs-keyword">when</span> <span class="hljs-string">'guid'</span></pre></div></div> </li> <li id="section-19"> @@ -346,13 +346,13 @@ </div> <p>Create instance of File</p> </div> - <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.new({<span class="symbol">:guid</span> =&gt; settings.fileId}).to_document.metadata!() + <div class="content"><div class='highlight'><pre> file = <span class="hljs-constant">GroupDocs::Storage::File</span>.new({<span class="hljs-symbol">:guid</span> =&gt; settings.fileId}).to_document.metadata!() file = file.last_view.document.file.to_document - <span class="keyword">when</span> <span class="string">'local'</span></pre></div></div> + <span class="hljs-keyword">when</span> <span class="hljs-string">'local'</span></pre></div></div> </li> <li id="section-20"> @@ -363,11 +363,11 @@ </div> <p>Construct path</p> </div> - <div class="content"><div class='highlight'><pre> file_path = <span class="string">"<span class="subst">#{<span class="constant">Dir</span>.tmpdir}</span>/<span class="subst">#{params[<span class="symbol">:file</span>][<span class="symbol">:filename</span>]}</span>"</span></pre></div></div> + <div class="content"><div class='highlight'><pre> file_path = <span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">Dir</span>.tmpdir}</span>/<span class="hljs-subst">#{params[<span class="hljs-symbol">:file</span>][<span class="hljs-symbol">:filename</span>]}</span>"</span></pre></div></div> </li> <li id="section-21"> @@ -378,11 +378,11 @@ </div> <p>Open file</p> </div> - <div class="content"><div class='highlight'><pre> <span class="constant">File</span>.open(file_path, <span class="string">'wb'</span>) { |f| f.write(params[<span class="symbol">:file</span>][<span class="symbol">:tempfile</span>].read) }</pre></div></div> + <div class="content"><div class='highlight'><pre> <span class="hljs-constant">File</span>.open(file_path, <span class="hljs-string">'wb'</span>) { |f| f.write(params[<span class="hljs-symbol">:file</span>][<span class="hljs-symbol">:tempfile</span>].read) }</pre></div></div> </li> <li id="section-22"> @@ -393,13 +393,13 @@ </div> <p>Make a request to API using client_id and private_key</p> </div> - <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload!(file_path).to_document + <div class="content"><div class='highlight'><pre> file = <span class="hljs-constant">GroupDocs::Storage::File</span>.upload!(file_path).to_document - <span class="keyword">when</span> <span class="string">'url'</span></pre></div></div> + <span class="hljs-keyword">when</span> <span class="hljs-string">'url'</span></pre></div></div> </li> <li id="section-23"> @@ -410,14 +410,14 @@ </div> <p>Upload file from defined url</p> </div> - <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload_web!(settings.url).to_document - <span class="keyword">else</span> - raise <span class="string">'Wrong GUID source.'</span> - <span class="keyword">end</span> + <div class="content"><div class='highlight'><pre> file = <span class="hljs-constant">GroupDocs::Storage::File</span>.upload_web!(settings.url).to_document + <span class="hljs-keyword">else</span> + raise <span class="hljs-string">'Wrong GUID source.'</span> + <span class="hljs-keyword">end</span> name = file.name</pre></div></div> </li> @@ -430,13 +430,13 @@ </div> <p>Create envelope using user id and entered by user name</p> </div> - <div class="content"><div class='highlight'><pre> envelope = <span class="constant">GroupDocs::Signature::Envelope</span>.new + <div class="content"><div class='highlight'><pre> envelope = <span class="hljs-constant">GroupDocs::Signature::Envelope</span>.new envelope.name = file.name - envelope.email_subject = <span class="string">'Sing this!'</span> + envelope.email_subject = <span class="hljs-string">'Sing this!'</span> envelope.create!({})</pre></div></div> </li> @@ -463,11 +463,11 @@ </div> <p>Get role list for current user</p> </div> - <div class="content"><div class='highlight'><pre> roles = <span class="constant">GroupDocs::Signature::Role</span>.get!({})</pre></div></div> + <div class="content"><div class='highlight'><pre> roles = <span class="hljs-constant">GroupDocs::Signature::Role</span>.get!({})</pre></div></div> </li> <li id="section-27"> @@ -478,15 +478,15 @@ </div> <p>Create new recipient</p> </div> - <div class="content"><div class='highlight'><pre> recipient = <span class="constant">GroupDocs::Signature::Recipient</span>.new + <div class="content"><div class='highlight'><pre> recipient = <span class="hljs-constant">GroupDocs::Signature::Recipient</span>.new recipient.email = settings.email recipient.first_name = settings.name recipient.last_name = settings.lastName - recipient.role_id = roles.detect { |role| role.name == <span class="string">'Signer'</span> }.id</pre></div></div> + recipient.role_id = roles.detect { |role| role.name == <span class="hljs-string">'Signer'</span> }.id</pre></div></div> </li> <li id="section-28"> @@ -527,13 +527,13 @@ </div> <p>Get field and add the location to field</p> </div> - <div class="content"><div class='highlight'><pre> field = <span class="constant">GroupDocs::Signature::Field</span>.get!.detect { |f| f.type == <span class="symbol">:signature</span> } - field.location = {<span class="symbol">:location_x</span> =&gt; <span class="number">0</span>.<span class="number">15</span>, <span class="symbol">:location_y</span> =&gt; <span class="number">0</span>.<span class="number">73</span>, <span class="symbol">:location_w</span> =&gt; <span class="number">150</span>, <span class="symbol">:location_h</span> =&gt; <span class="number">50</span>, <span class="symbol">:page</span> =&gt; <span class="number">1</span>} - field.name = <span class="string">'EMPLOYEE SIGNATURE'</span></pre></div></div> + <div class="content"><div class='highlight'><pre> field = <span class="hljs-constant">GroupDocs::Signature::Field</span>.get!.detect { |f| f.type == <span class="hljs-symbol">:signature</span> } + field.location = {<span class="hljs-symbol">:location_x</span> =&gt; <span class="hljs-number">0</span>.<span class="hljs-number">15</span>, <span class="hljs-symbol">:location_y</span> =&gt; <span class="hljs-number">0</span>.<span class="hljs-number">73</span>, <span class="hljs-symbol">:location_w</span> =&gt; <span class="hljs-number">150</span>, <span class="hljs-symbol">:location_h</span> =&gt; <span class="hljs-number">50</span>, <span class="hljs-symbol">:page</span> =&gt; <span class="hljs-number">1</span>} + field.name = <span class="hljs-string">'EMPLOYEE SIGNATURE'</span></pre></div></div> </li> <li id="section-31"> @@ -544,11 +544,11 @@ </div> <p>Add field to envelope</p> </div> - <div class="content"><div class='highlight'><pre> envelope.add_field!(field, document[<span class="number">0</span>], recipient)</pre></div></div> + <div class="content"><div class='highlight'><pre> envelope.add_field!(field, document[<span class="hljs-number">0</span>], recipient)</pre></div></div> </li> <li id="section-32"> @@ -559,11 +559,11 @@ </div> <p>Send envelop</p> </div> - <div class="content"><div class='highlight'><pre> envelope.send!({<span class="symbol">:callbackUrl</span> =&gt; settings.callback})</pre></div></div> + <div class="content"><div class='highlight'><pre> envelope.send!({<span class="hljs-symbol">:callbackUrl</span> =&gt; settings.callback})</pre></div></div> </li> <li id="section-33"> @@ -574,12 +574,12 @@ </div> <p>Write client and private key to the file for callback job</p> </div> - <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.callback - out_file = <span class="constant">File</span>.new(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/user_info.txt"</span>, <span class="string">'w'</span>)</pre></div></div> + <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> settings.callback + out_file = <span class="hljs-constant">File</span>.new(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/user_info.txt"</span>, <span class="hljs-string">'w'</span>)</pre></div></div> </li> <li id="section-34"> @@ -590,15 +590,15 @@ </div> <p>White space is required</p> </div> - <div class="content"><div class='highlight'><pre> out_file.write(<span class="string">"<span class="subst">#{settings.client_id}</span> "</span>) - out_file.write(<span class="string">"<span class="subst">#{settings.private_key}</span>"</span>) - out_file.write(<span class="string">"<span class="subst">#{envelope.id}</span>"</span>) + <div class="content"><div class='highlight'><pre> out_file.write(<span class="hljs-string">"<span class="hljs-subst">#{settings.client_id}</span> "</span>) + out_file.write(<span class="hljs-string">"<span class="hljs-subst">#{settings.private_key}</span>"</span>) + out_file.write(<span class="hljs-string">"<span class="hljs-subst">#{envelope.id}</span>"</span>) out_file.close - <span class="keyword">end</span></pre></div></div> + <span class="hljs-keyword">end</span></pre></div></div> </li> <li id="section-35"> @@ -609,11 +609,11 @@ </div> <p>Prepare to sign url</p> </div> - <div class="content"><div class='highlight'><pre> iframe = <span class="string">"/signature2/signembed/<span class="subst">#{envelope.id}</span>/<span class="subst">#{recipient.id}</span>"</span></pre></div></div> + <div class="content"><div class='highlight'><pre> iframe = <span class="hljs-string">"/signature2/signembed/<span class="hljs-subst">#{envelope.id}</span>/<span class="hljs-subst">#{recipient.id}</span>"</span></pre></div></div> </li> <li id="section-36"> @@ -624,11 +624,11 @@ </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> =&gt; iframe).prepare_and_sign_url</pre></div></div> + <div class="content"><div class='highlight'><pre> url = <span class="hljs-constant">GroupDocs::Api::Request</span>.new(<span class="hljs-symbol">:path</span> =&gt; iframe).prepare_and_sign_url</pre></div></div> </li> <li id="section-37"> @@ -639,18 +639,18 @@ </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> + <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">case</span> base_path + <span class="hljs-keyword">when</span> <span class="hljs-string">'https://stage-api-groupdocs.dynabic.com'</span> + iframe = <span class="hljs-string">"https://stage-api-groupdocs.dynabic.com<span class="hljs-subst">#{url}</span>"</span> + <span class="hljs-keyword">when</span> <span class="hljs-string">'https://dev-api-groupdocs.dynabic.com'</span> + iframe = <span class="hljs-string">"https://dev-apps.groupdocs.com<span class="hljs-subst">#{url}</span>"</span> + <span class="hljs-keyword">else</span> + iframe = <span class="hljs-string">"https://apps.groupdocs.com<span class="hljs-subst">#{url}</span>"</span> + <span class="hljs-keyword">end</span></pre></div></div> </li> <li id="section-38"> @@ -661,16 +661,16 @@ </div> <p>Make iframe</p> </div> - <div class="content"><div class='highlight'><pre> iframe = <span class="string">"&lt;iframe id='downloadframe' src='<span class="subst">#{iframe}</span>' width='800' height='1000'&gt;&lt;/iframe&gt;"</span> + <div class="content"><div class='highlight'><pre> iframe = <span class="hljs-string">"&lt;iframe id='downloadframe' src='<span class="hljs-subst">#{iframe}</span>' width='800' height='1000'&gt;&lt;/iframe&gt;"</span> - message = <span class="string">"&lt;p&gt;File was uploaded to GroupDocs. Here you can see your &lt;strong&gt;<span class="subst">#{name}</span>&lt;/strong&gt; file in the GroupDocs Embedded Viewer.&lt;/p&gt;"</span> - <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e + message = <span class="hljs-string">"&lt;p&gt;File was uploaded to GroupDocs. Here you can see your &lt;strong&gt;<span class="hljs-subst">#{name}</span>&lt;/strong&gt; file in the GroupDocs Embedded Viewer.&lt;/p&gt;"</span> + <span class="hljs-keyword">rescue</span> <span class="hljs-constant">Exception</span> =&gt; e err = e.message - <span class="keyword">end</span></pre></div></div> + <span class="hljs-keyword">end</span></pre></div></div> </li> <li id="section-39"> @@ -681,11 +681,11 @@ </div> <p>Set variables for template</p> </div> - <div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample37</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">:email</span> =&gt; settings.email, <span class="symbol">:name</span> =&gt; settings.name, <span class="symbol">:lastName</span> =&gt; settings.lastName, <span class="symbol">:iframe</span> =&gt; iframe, <span class="symbol">:massage</span> =&gt; message, <span class="symbol">:err</span> =&gt; err, <span class="symbol">:callback</span> =&gt; settings.callback,} -<span class="keyword">end</span></pre></div></div> + <div class="content"><div class='highlight'><pre> haml <span class="hljs-symbol">:sample37</span>, <span class="hljs-symbol">:locals</span> =&gt; {<span class="hljs-symbol">:userId</span> =&gt; settings.client_id, <span class="hljs-symbol">:privateKey</span> =&gt; settings.private_key, <span class="hljs-symbol">:email</span> =&gt; settings.email, <span class="hljs-symbol">:name</span> =&gt; settings.name, <span class="hljs-symbol">:lastName</span> =&gt; settings.lastName, <span class="hljs-symbol">:iframe</span> =&gt; iframe, <span class="hljs-symbol">:massage</span> =&gt; message, <span class="hljs-symbol">:err</span> =&gt; err, <span class="hljs-symbol">:callback</span> =&gt; settings.callback,} +<span class="hljs-keyword">end</span></pre></div></div> </li> </ul> </div>