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

- old
+ new

@@ -29,13 +29,13 @@ </div> <p>GET request</p> </div> - <div class="content"><div class='highlight'><pre>get <span class="string">'/sample31'</span> <span class="keyword">do</span> - haml <span class="symbol">:sample31</span> -<span class="keyword">end</span></pre></div></div> + <div class="content"><div class='highlight'><pre>get <span class="hljs-string">'/sample-31-how-to-dynamically-create-signature-form-using-data-from-html-form'</span> <span class="hljs-keyword">do</span> + haml <span class="hljs-symbol">:sample31</span> +<span class="hljs-keyword">end</span></pre></div></div> </li> <li id="section-2"> @@ -46,11 +46,11 @@ </div> <p>POST request</p> </div> - <div class="content"><div class='highlight'><pre>post <span class="string">'/sample31/callback'</span> <span class="keyword">do</span></pre></div></div> + <div class="content"><div class='highlight'><pre>post <span class="hljs-string">'/sample31/callback'</span> <span class="hljs-keyword">do</span></pre></div></div> </li> <li id="section-3"> @@ -61,11 +61,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-4"> @@ -76,16 +76,16 @@ </div> <p>Get callback request</p> </div> - <div class="content"><div class='highlight'><pre> data = <span class="constant">JSON</span>.parse(request.body.read) - <span class="keyword">begin</span> - raise <span class="string">'Empty params!'</span> <span class="keyword">if</span> data.empty? - source_id = <span class="keyword">nil</span> - client_id = <span class="keyword">nil</span> - private_key = <span class="keyword">nil</span></pre></div></div> + <div class="content"><div class='highlight'><pre> data = <span class="hljs-constant">JSON</span>.parse(request.body.read) + <span class="hljs-keyword">begin</span> + raise <span class="hljs-string">'Empty params!'</span> <span class="hljs-keyword">if</span> data.empty? + source_id = <span class="hljs-keyword">nil</span> + client_id = <span class="hljs-keyword">nil</span> + private_key = <span class="hljs-keyword">nil</span></pre></div></div> </li> <li id="section-5"> @@ -96,15 +96,15 @@ </div> <p>Get value of SourceId</p> </div> - <div class="content"><div class='highlight'><pre> data.each <span class="keyword">do</span> |key, value| - <span class="keyword">if</span> key == <span class="string">'SourceId'</span> + <div class="content"><div class='highlight'><pre> data.each <span class="hljs-keyword">do</span> |key, value| + <span class="hljs-keyword">if</span> key == <span class="hljs-string">'SourceId'</span> source_id = value - <span class="keyword">end</span> - <span class="keyword">end</span></pre></div></div> + <span class="hljs-keyword">end</span> + <span class="hljs-keyword">end</span></pre></div></div> </li> <li id="section-6"> @@ -115,16 +115,16 @@ </div> <p>Get private key and client_id from file user_info.txt</p> </div> - <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> <span class="constant">File</span>.exist?(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/user_info.txt"</span>) - contents = <span class="constant">File</span>.read(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/user_info.txt"</span>) - contents = contents.split(<span class="string">' '</span>) + <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-constant">File</span>.exist?(<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>) + contents = <span class="hljs-constant">File</span>.read(<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>) + contents = contents.split(<span class="hljs-string">' '</span>) client_id = contents.first private_key = contents.last - <span class="keyword">end</span></pre></div></div> + <span class="hljs-keyword">end</span></pre></div></div> </li> <li id="section-7"> @@ -135,11 +135,11 @@ </div> <p>Create Job instance</p> </div> - <div class="content"><div class='highlight'><pre> job = <span class="constant">GroupDocs::Job</span>.new({<span class="symbol">:id</span> =&gt; source_id})</pre></div></div> + <div class="content"><div class='highlight'><pre> job = <span class="hljs-constant">GroupDocs::Job</span>.new({<span class="hljs-symbol">:id</span> =&gt; source_id})</pre></div></div> </li> <li id="section-8"> @@ -150,11 +150,11 @@ </div> <p>Get document by job id</p> </div> - <div class="content"><div class='highlight'><pre> documents = job.documents!({<span class="symbol">:client_id</span> =&gt; client_id, <span class="symbol">:private_key</span> =&gt; private_key})</pre></div></div> + <div class="content"><div class='highlight'><pre> documents = job.documents!({<span class="hljs-symbol">:client_id</span> =&gt; client_id, <span class="hljs-symbol">:private_key</span> =&gt; private_key})</pre></div></div> </li> <li id="section-9"> @@ -165,16 +165,16 @@ </div> <p>Download converted file</p> </div> - <div class="content"><div class='highlight'><pre> documents[<span class="symbol">:inputs</span>].first.outputs.first.download!(downloads_path, {<span class="symbol">:client_id</span> =&gt; client_id, <span class="symbol">:private_key</span> =&gt; private_key}) + <div class="content"><div class='highlight'><pre> documents[<span class="hljs-symbol">:inputs</span>].first.outputs.first.download!(downloads_path, {<span class="hljs-symbol">:client_id</span> =&gt; client_id, <span class="hljs-symbol">:private_key</span> =&gt; private_key}) - <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e + <span class="hljs-keyword">rescue</span> <span class="hljs-constant">Exception</span> =&gt; e err = e.message - <span class="keyword">end</span> -<span class="keyword">end</span></pre></div></div> + <span class="hljs-keyword">end</span> +<span class="hljs-keyword">end</span></pre></div></div> </li> <li id="section-10"> @@ -185,11 +185,11 @@ </div> <p>GET request</p> </div> - <div class="content"><div class='highlight'><pre>get <span class="string">'/sample31/check'</span> <span class="keyword">do</span></pre></div></div> + <div class="content"><div class='highlight'><pre>get <span class="hljs-string">'/sample31/check'</span> <span class="hljs-keyword">do</span></pre></div></div> </li> <li id="section-11"> @@ -200,13 +200,13 @@ </div> <p>Check is there download directory</p> </div> - <div class="content"><div class='highlight'><pre> <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> <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-12"> @@ -217,17 +217,17 @@ </div> <p>Get file name from download directory</p> </div> - <div class="content"><div class='highlight'><pre> name = <span class="keyword">nil</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> + <div class="content"><div class='highlight'><pre> name = <span class="hljs-keyword">nil</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> name -<span class="keyword">end</span></pre></div></div> +<span class="hljs-keyword">end</span></pre></div></div> </li> <li id="section-13"> @@ -238,11 +238,11 @@ </div> <p>GET request</p> </div> - <div class="content"><div class='highlight'><pre>get <span class="string">'/sample31/downloads/:filename'</span> <span class="keyword">do</span> |filename|</pre></div></div> + <div class="content"><div class='highlight'><pre>get <span class="hljs-string">'/sample31/downloads/:filename'</span> <span class="hljs-keyword">do</span> |filename|</pre></div></div> </li> <li id="section-14"> @@ -253,12 +253,12 @@ </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-15"> @@ -269,11 +269,11 @@ </div> <p>POST request</p> </div> - <div class="content"><div class='highlight'><pre>post <span class="string">'/sample31'</span> <span class="keyword">do</span></pre></div></div> + <div class="content"><div class='highlight'><pre>post <span class="hljs-string">'/sample-31-how-to-dynamically-create-signature-form-using-data-from-html-form'</span> <span class="hljs-keyword">do</span></pre></div></div> </li> <li id="section-16"> @@ -284,21 +284,21 @@ </div> <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>] - set <span class="symbol">:template_guid</span>, params[<span class="symbol">:templateGuid</span>] - set <span class="symbol">:name</span>, params[<span class="symbol">:name</span>] - set <span class="symbol">:country</span>, params[<span class="symbol">:country</span>] - set <span class="symbol">:city</span>, params[<span class="symbol">:city</span>] - set <span class="symbol">:street</span>, params[<span class="symbol">:street</span>] - set <span class="symbol">:email</span>, params[<span class="symbol">:email</span>] - set <span class="symbol">:callback</span>, params[<span class="symbol">:callback</span>] - set <span class="symbol">:last_name</span>, params[<span class="symbol">:lastName</span>] - set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</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">:template_guid</span>, params[<span class="hljs-symbol">:templateGuid</span>] + set <span class="hljs-symbol">:name</span>, params[<span class="hljs-symbol">:name</span>] + set <span class="hljs-symbol">:country</span>, params[<span class="hljs-symbol">:country</span>] + set <span class="hljs-symbol">:city</span>, params[<span class="hljs-symbol">:city</span>] + set <span class="hljs-symbol">:street</span>, params[<span class="hljs-symbol">:street</span>] + set <span class="hljs-symbol">:email</span>, params[<span class="hljs-symbol">:email</span>] + set <span class="hljs-symbol">:callback</span>, params[<span class="hljs-symbol">:callback</span>] + set <span class="hljs-symbol">:last_name</span>, params[<span class="hljs-symbol">:lastName</span>] + set <span class="hljs-symbol">:base_path</span>, params[<span class="hljs-symbol">:basePath</span>]</pre></div></div> </li> <li id="section-17"> @@ -309,11 +309,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-18"> @@ -324,17 +324,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-19"> @@ -345,11 +345,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?</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?</pre></div></div> </li> <li id="section-20"> @@ -360,17 +360,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-21"> @@ -381,11 +381,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> @@ -398,12 +398,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-23"> @@ -414,12 +414,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[<span class="number">0</span>] - 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[<span class="hljs-number">0</span>] + 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-24"> @@ -430,16 +430,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-25"> @@ -450,11 +450,11 @@ </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.template_guid})</pre></div></div> + <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.template_guid})</pre></div></div> </li> <li id="section-26"> @@ -465,11 +465,11 @@ </div> <p>Raise exception if something went wrong</p> </div> - <div class="content"><div class='highlight'><pre> raise <span class="string">'No such file'</span> <span class="keyword">unless</span> file.is_a?(<span class="constant">GroupDocs::Storage::File</span>)</pre></div></div> + <div class="content"><div class='highlight'><pre> raise <span class="hljs-string">'No such file'</span> <span class="hljs-keyword">unless</span> file.is_a?(<span class="hljs-constant">GroupDocs::Storage::File</span>)</pre></div></div> </li> <li id="section-27"> @@ -495,26 +495,26 @@ </div> <p>Create datasource with fields</p> </div> - <div class="content"><div class='highlight'><pre> datasource = <span class="constant">GroupDocs::DataSource</span>.new</pre></div></div> + <div class="content"><div class='highlight'><pre> datasource = <span class="hljs-constant">GroupDocs::DataSource</span>.new</pre></div></div> </li> <li id="section-29"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-29">&#182;</a> </div> - <p>Get arry of document&#39;s fields</p> + <p>Get arry of document’s fields</p> </div> - <div class="content"><div class='highlight'><pre> enteredData = {<span class="string">"email"</span> =&gt; settings.email, <span class="string">"name"</span> =&gt; settings.name, <span class="string">"country"</span>=&gt; settings.country, <span class="string">"city"</span> =&gt; settings.city, <span class="string">"street"</span> =&gt; settings.street}</pre></div></div> + <div class="content"><div class='highlight'><pre> enteredData = {<span class="hljs-string">"email"</span> =&gt; settings.email, <span class="hljs-string">"name"</span> =&gt; settings.name, <span class="hljs-string">"country"</span>=&gt; settings.country, <span class="hljs-string">"city"</span> =&gt; settings.city, <span class="hljs-string">"street"</span> =&gt; settings.street}</pre></div></div> </li> <li id="section-30"> @@ -525,11 +525,11 @@ </div> <p>Create Field instance and fill the fields</p> </div> - <div class="content"><div class='highlight'><pre> datasource.fields = enteredData.map { |key, value| <span class="constant">GroupDocs::DataSource::Field</span>.new(<span class="symbol">name:</span> key, <span class="symbol">type:</span> <span class="symbol">:text</span>, <span class="symbol">values:</span> <span class="constant">Array</span>.new() &lt;&lt; value) }</pre></div></div> + <div class="content"><div class='highlight'><pre> datasource.fields = enteredData.map { |key, value| <span class="hljs-constant">GroupDocs::DataSource::Field</span>.new(<span class="hljs-symbol">name:</span> key, <span class="hljs-symbol">type:</span> <span class="hljs-symbol">:text</span>, <span class="hljs-symbol">values:</span> <span class="hljs-constant">Array</span>.new() &lt;&lt; value) }</pre></div></div> </li> <li id="section-31"> @@ -555,12 +555,12 @@ </div> <p>Creates new job to merge datasource into document.</p> </div> - <div class="content"><div class='highlight'><pre> job = document.datasource!(datasource, {<span class="symbol">:new_type</span> =&gt; <span class="string">"pdf"</span>}) - sleep <span class="number">10</span> <span class="comment"># wait for merge and convert</span></pre></div></div> + <div class="content"><div class='highlight'><pre> job = document.datasource!(datasource, {<span class="hljs-symbol">:new_type</span> =&gt; <span class="hljs-string">"pdf"</span>}) + sleep <span class="hljs-number">10</span> <span class="hljs-comment"># wait for merge and convert</span></pre></div></div> </li> <li id="section-33"> @@ -586,11 +586,11 @@ </div> <p>Creates new document to envelope</p> </div> - <div class="content"><div class='highlight'><pre> document = jobInfo[<span class="symbol">:inputs</span>][<span class="number">0</span>].outputs[<span class="number">0</span>].to_document</pre></div></div> + <div class="content"><div class='highlight'><pre> document = jobInfo[<span class="hljs-symbol">:inputs</span>][<span class="hljs-number">0</span>].outputs[<span class="hljs-number">0</span>].to_document</pre></div></div> </li> <li id="section-35"> @@ -601,12 +601,12 @@ </div> <p>Creates 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 - envelope.name = jobInfo[<span class="symbol">:inputs</span>][<span class="number">0</span>].outputs[<span class="number">0</span>].name + <div class="content"><div class='highlight'><pre> envelope = <span class="hljs-constant">GroupDocs::Signature::Envelope</span>.new + envelope.name = jobInfo[<span class="hljs-symbol">:inputs</span>][<span class="hljs-number">0</span>].outputs[<span class="hljs-number">0</span>].name envelope.create!({})</pre></div></div> </li> @@ -618,11 +618,11 @@ </div> <p>Adds uploaded document to envelope</p> </div> - <div class="content"><div class='highlight'><pre> envelope.add_document!(document, {<span class="symbol">parseFields:</span> <span class="keyword">true</span>})</pre></div></div> + <div class="content"><div class='highlight'><pre> envelope.add_document!(document, {<span class="hljs-symbol">parseFields:</span> <span class="hljs-keyword">true</span>})</pre></div></div> </li> <li id="section-37"> @@ -633,11 +633,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-38"> @@ -648,15 +648,15 @@ </div> <p>Creates 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 = <span class="string">"lastName"</span> - recipient.role_id = roles.detect { |role| role.name == <span class="string">'Signer'</span> }.id</pre></div></div> + recipient.last_name = <span class="hljs-string">"lastName"</span> + recipient.role_id = roles.detect { |role| role.name == <span class="hljs-string">'Signer'</span> }.id</pre></div></div> </li> <li id="section-39"> @@ -697,11 +697,11 @@ </div> <p>Send envelope</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-42"> @@ -712,11 +712,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">#{recipientGet.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">#{recipientGet.id}</span>"</span></pre></div></div> </li> <li id="section-43"> @@ -727,11 +727,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-44"> @@ -742,18 +742,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-45"> @@ -764,15 +764,15 @@ </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> - <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e + <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-46"> @@ -783,21 +783,21 @@ </div> <p>Set variables for template</p> </div> - <div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample31</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">:callback</span> =&gt; settings.callback, - <span class="symbol">:email</span> =&gt; settings.email, - <span class="symbol">:name</span> =&gt; settings.name, - <span class="symbol">:country</span> =&gt; settings.country, - <span class="symbol">:city</span> =&gt; settings.city, - <span class="symbol">:street</span> =&gt; settings.street, - <span class="symbol">:iframe</span> =&gt; iframe, - <span class="symbol">:templateGuid</span> =&gt; settings.template_guid, - <span class="symbol">:err</span> =&gt; err} -<span class="keyword">end</span></pre></div></div> + <div class="content"><div class='highlight'><pre> haml <span class="hljs-symbol">:sample31</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">:callback</span> =&gt; settings.callback, + <span class="hljs-symbol">:email</span> =&gt; settings.email, + <span class="hljs-symbol">:name</span> =&gt; settings.name, + <span class="hljs-symbol">:country</span> =&gt; settings.country, + <span class="hljs-symbol">:city</span> =&gt; settings.city, + <span class="hljs-symbol">:street</span> =&gt; settings.street, + <span class="hljs-symbol">:iframe</span> =&gt; iframe, + <span class="hljs-symbol">:templateGuid</span> =&gt; settings.template_guid, + <span class="hljs-symbol">:err</span> =&gt; err} +<span class="hljs-keyword">end</span></pre></div></div> </li> </ul> </div>