groupdocs 1.2.8 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/api-samples/README.md +17 -6
- data/examples/api-samples/app.rb +0 -2
- data/examples/api-samples/public/GroupDocs_Signature_Demo.pdf +0 -0
- data/examples/api-samples/public/docs/docco.css +192 -0
- data/examples/api-samples/public/docs/envelope-sample.html +132 -0
- data/examples/api-samples/public/docs/sample1.html +26 -0
- data/examples/api-samples/public/docs/sample10.html +49 -0
- data/examples/api-samples/public/docs/sample11.html +87 -0
- data/examples/api-samples/public/docs/sample12.html +40 -0
- data/examples/api-samples/public/docs/sample13.html +41 -0
- data/examples/api-samples/public/docs/sample14.html +30 -0
- data/examples/api-samples/public/docs/sample15.html +27 -0
- data/examples/api-samples/public/docs/sample16.html +25 -0
- data/examples/api-samples/public/docs/sample17.html +37 -0
- data/examples/api-samples/public/docs/sample18.html +62 -0
- data/examples/api-samples/public/docs/sample2.html +30 -0
- data/examples/api-samples/public/docs/sample3.html +34 -0
- data/examples/api-samples/public/docs/sample4.html +41 -0
- data/examples/api-samples/public/docs/sample5.html +56 -0
- data/examples/api-samples/public/docs/sample6.html +48 -0
- data/examples/api-samples/public/docs/sample7.html +43 -0
- data/examples/api-samples/public/docs/sample8.html +54 -0
- data/examples/api-samples/public/docs/sample9.html +31 -0
- data/examples/api-samples/samples/envelope-sample.rb +132 -0
- data/examples/api-samples/samples/sample1.rb +10 -2
- data/examples/api-samples/samples/sample10.rb +17 -5
- data/examples/api-samples/samples/sample11.rb +86 -0
- data/examples/api-samples/samples/sample12.rb +39 -0
- data/examples/api-samples/samples/sample13.rb +40 -0
- data/examples/api-samples/samples/sample14.rb +29 -0
- data/examples/api-samples/samples/sample15.rb +26 -0
- data/examples/api-samples/samples/sample16.rb +24 -0
- data/examples/api-samples/samples/sample17.rb +36 -0
- data/examples/api-samples/samples/sample18.rb +61 -0
- data/examples/api-samples/samples/sample2.rb +14 -4
- data/examples/api-samples/samples/sample3.rb +14 -4
- data/examples/api-samples/samples/sample4.rb +12 -3
- data/examples/api-samples/samples/sample5.rb +13 -2
- data/examples/api-samples/samples/sample6.rb +18 -6
- data/examples/api-samples/samples/sample7.rb +9 -0
- data/examples/api-samples/samples/sample8.rb +17 -4
- data/examples/api-samples/samples/sample9.rb +10 -2
- data/examples/api-samples/views/envelope_sample.haml +73 -0
- data/examples/api-samples/views/index.haml +18 -0
- data/examples/api-samples/views/sample1.haml +21 -0
- data/examples/api-samples/views/sample10.haml +21 -0
- data/examples/api-samples/views/sample11.haml +141 -0
- data/examples/api-samples/views/sample12.haml +94 -0
- data/examples/api-samples/views/sample13.haml +90 -0
- data/examples/api-samples/views/sample14.haml +86 -0
- data/examples/api-samples/views/sample15.haml +75 -0
- data/examples/api-samples/views/sample16.haml +68 -0
- data/examples/api-samples/views/sample17.haml +80 -0
- data/examples/api-samples/views/sample18.haml +87 -0
- data/examples/api-samples/views/sample2.haml +21 -0
- data/examples/api-samples/views/sample3.haml +23 -2
- data/examples/api-samples/views/sample4.haml +21 -0
- data/examples/api-samples/views/sample5.haml +21 -0
- data/examples/api-samples/views/sample6.haml +22 -1
- data/examples/api-samples/views/sample7.haml +21 -0
- data/examples/api-samples/views/sample8.haml +22 -1
- data/examples/api-samples/views/sample9.haml +21 -0
- data/lib/groupdocs/job.rb +5 -3
- data/lib/groupdocs/user.rb +33 -0
- data/lib/groupdocs/version.rb +1 -1
- data/spec/groupdocs/job_spec.rb +5 -0
- data/spec/groupdocs/user_spec.rb +22 -0
- data/spec/support/json/update_account.json +10 -0
- metadata +45 -4
@@ -0,0 +1,30 @@
|
|
1
|
+
<!DOCTYPE html> <html> <head> <title>sample2.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample2.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/sample2'</span> <span class="k">do</span>
|
2
|
+
<span class="n">haml</span> <span class="ss">:sample2</span>
|
3
|
+
<span class="k">end</span>
|
4
|
+
|
5
|
+
|
6
|
+
<span class="n">post</span> <span class="s1">'/sample2'</span> <span class="k">do</span>
|
7
|
+
|
8
|
+
<span class="n">set</span> <span class="ss">:client_id</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:client_id</span><span class="o">]</span>
|
9
|
+
<span class="n">set</span> <span class="ss">:private_key</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:private_key</span><span class="o">]</span>
|
10
|
+
|
11
|
+
<span class="k">begin</span>
|
12
|
+
|
13
|
+
<span class="k">raise</span> <span class="s2">"Please enter all required parameters"</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="o">.</span><span class="n">empty?</span>
|
14
|
+
|
15
|
+
|
16
|
+
<span class="n">files_list</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">Folder</span><span class="o">.</span><span class="n">list!</span><span class="p">(</span><span class="s1">'/'</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span> <span class="p">})</span>
|
17
|
+
|
18
|
+
|
19
|
+
<span class="n">filelist</span> <span class="o">=</span> <span class="s1">''</span>
|
20
|
+
<span class="n">files_list</span><span class="o">.</span><span class="n">each</span> <span class="p">{</span><span class="o">|</span><span class="n">element</span><span class="o">|</span> <span class="n">filelist</span> <span class="o"><<</span> <span class="s2">"</span><span class="si">#{</span><span class="n">element</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2"><br />"</span><span class="p">}</span>
|
21
|
+
|
22
|
+
<span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=></span> <span class="n">e</span>
|
23
|
+
<span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
|
24
|
+
<span class="k">end</span>
|
25
|
+
|
26
|
+
|
27
|
+
<span class="n">haml</span> <span class="ss">:sample2</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:filelist</span> <span class="o">=></span> <span class="n">filelist</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=></span> <span class="n">err</span> <span class="p">}</span>
|
28
|
+
<span class="k">end</span>
|
29
|
+
|
30
|
+
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<!DOCTYPE html> <html> <head> <title>sample3.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample3.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/sample3'</span> <span class="k">do</span>
|
2
|
+
<span class="n">haml</span> <span class="ss">:sample3</span>
|
3
|
+
<span class="k">end</span>
|
4
|
+
|
5
|
+
|
6
|
+
<span class="n">post</span> <span class="s1">'/sample3'</span> <span class="k">do</span>
|
7
|
+
|
8
|
+
<span class="n">set</span> <span class="ss">:client_id</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:client_id</span><span class="o">]</span>
|
9
|
+
<span class="n">set</span> <span class="ss">:private_key</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:private_key</span><span class="o">]</span>
|
10
|
+
|
11
|
+
<span class="k">begin</span>
|
12
|
+
|
13
|
+
<span class="k">raise</span> <span class="s2">"Please enter all required parameters"</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="o">.</span><span class="n">empty?</span>
|
14
|
+
|
15
|
+
|
16
|
+
<span class="n">filepath</span> <span class="o">=</span> <span class="s2">"</span><span class="si">#{</span><span class="no">Dir</span><span class="o">.</span><span class="n">tmpdir</span><span class="si">}</span><span class="s2">/</span><span class="si">#{</span><span class="n">params</span><span class="o">[</span><span class="ss">:file</span><span class="o">][</span><span class="ss">:filename</span><span class="o">]</span><span class="si">}</span><span class="s2">"</span>
|
17
|
+
|
18
|
+
<span class="no">File</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">filepath</span><span class="p">,</span> <span class="s1">'wb'</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">f</span><span class="o">|</span> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">params</span><span class="o">[</span><span class="ss">:file</span><span class="o">][</span><span class="ss">:tempfile</span><span class="o">].</span><span class="n">read</span><span class="p">)</span> <span class="p">}</span>
|
19
|
+
|
20
|
+
<span class="n">file</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">File</span><span class="o">.</span><span class="n">upload!</span><span class="p">(</span><span class="n">filepath</span><span class="p">,</span> <span class="p">{},</span> <span class="n">client_id</span><span class="p">:</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="n">private_key</span><span class="p">:</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">)</span>
|
21
|
+
|
22
|
+
|
23
|
+
<span class="n">massage</span> <span class="o">=</span> <span class="s2">"<p>File was uploaded to GroupDocs. Here you can see your <strong></span><span class="si">#{</span><span class="n">params</span><span class="o">[</span><span class="ss">:file</span><span class="o">][</span><span class="ss">:filename</span><span class="o">]</span><span class="si">}</span><span class="s2"></strong> file in the GroupDocs Embedded Viewer.</p>"</span>
|
24
|
+
<span class="n">iframe</span> <span class="o">=</span> <span class="s2">"<iframe src='https://apps.groupdocs.com/document-viewer/Embed/</span><span class="si">#{</span><span class="n">file</span><span class="o">.</span><span class="n">guid</span><span class="si">}</span><span class="s2">' frameborder='0' width='720' height='600'></iframe>"</span>
|
25
|
+
|
26
|
+
<span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=></span> <span class="n">e</span>
|
27
|
+
<span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
|
28
|
+
<span class="k">end</span>
|
29
|
+
|
30
|
+
|
31
|
+
<span class="n">haml</span> <span class="ss">:sample3</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:iframe</span><span class="o">=></span><span class="n">iframe</span><span class="p">,</span> <span class="ss">:massage</span> <span class="o">=></span> <span class="n">massage</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=></span> <span class="n">err</span> <span class="p">}</span>
|
32
|
+
<span class="k">end</span>
|
33
|
+
|
34
|
+
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<!DOCTYPE html> <html> <head> <title>sample4.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample4.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/sample4'</span> <span class="k">do</span>
|
2
|
+
<span class="n">haml</span> <span class="ss">:sample4</span>
|
3
|
+
<span class="k">end</span>
|
4
|
+
|
5
|
+
|
6
|
+
<span class="n">post</span> <span class="s1">'/sample4'</span> <span class="k">do</span>
|
7
|
+
|
8
|
+
<span class="n">set</span> <span class="ss">:client_id</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:client_id</span><span class="o">]</span>
|
9
|
+
<span class="n">set</span> <span class="ss">:private_key</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:private_key</span><span class="o">]</span>
|
10
|
+
<span class="n">set</span> <span class="ss">:file_id</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:file_id</span><span class="o">]</span>
|
11
|
+
|
12
|
+
<span class="k">begin</span>
|
13
|
+
|
14
|
+
<span class="k">raise</span> <span class="s2">"Please enter all required parameters"</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">file_id</span><span class="o">.</span><span class="n">empty?</span>
|
15
|
+
|
16
|
+
|
17
|
+
<span class="n">files_list</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">Folder</span><span class="o">.</span><span class="n">list!</span><span class="p">(</span><span class="s1">'/'</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
|
18
|
+
<span class="n">dowload_file</span> <span class="o">=</span> <span class="s1">''</span>
|
19
|
+
|
20
|
+
|
21
|
+
<span class="n">files_list</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">element</span><span class="o">|</span>
|
22
|
+
<span class="k">if</span> <span class="n">element</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="nb">Integer</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">file_id</span><span class="p">)</span>
|
23
|
+
<span class="n">dowload_file</span> <span class="o">=</span> <span class="n">element</span>
|
24
|
+
<span class="k">end</span>
|
25
|
+
<span class="k">end</span>
|
26
|
+
|
27
|
+
|
28
|
+
<span class="n">dowloaded_file</span> <span class="o">=</span> <span class="n">dowload_file</span><span class="o">.</span><span class="n">download!</span><span class="p">(</span><span class="no">File</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="bp">__FILE__</span><span class="p">),</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
|
29
|
+
<span class="k">unless</span> <span class="n">dowloaded_file</span><span class="o">.</span><span class="n">empty?</span>
|
30
|
+
<span class="n">massage</span> <span class="o">=</span> <span class="s2">"<font color='green'>File was downloaded to the <font color='blue'></span><span class="si">#{</span><span class="n">dowloaded_file</span><span class="si">}</span><span class="s2"></font> folder</font> <br />"</span>
|
31
|
+
<span class="k">end</span>
|
32
|
+
|
33
|
+
<span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=></span> <span class="n">e</span>
|
34
|
+
<span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
|
35
|
+
<span class="k">end</span>
|
36
|
+
|
37
|
+
|
38
|
+
<span class="n">haml</span> <span class="ss">:sample4</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:file_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">file_id</span><span class="p">,</span> <span class="ss">:massage</span> <span class="o">=></span> <span class="n">massage</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=></span> <span class="n">err</span> <span class="p">}</span>
|
39
|
+
<span class="k">end</span>
|
40
|
+
|
41
|
+
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<!DOCTYPE html> <html> <head> <title>sample5.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample5.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/sample5'</span> <span class="k">do</span>
|
2
|
+
<span class="n">haml</span> <span class="ss">:sample5</span>
|
3
|
+
<span class="k">end</span>
|
4
|
+
|
5
|
+
|
6
|
+
<span class="n">post</span> <span class="s1">'/sample5'</span> <span class="k">do</span>
|
7
|
+
|
8
|
+
<span class="n">set</span> <span class="ss">:client_id</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:client_id</span><span class="o">]</span>
|
9
|
+
<span class="n">set</span> <span class="ss">:private_key</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:private_key</span><span class="o">]</span>
|
10
|
+
<span class="n">set</span> <span class="ss">:file_id</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:file_id</span><span class="o">]</span>
|
11
|
+
<span class="n">set</span> <span class="ss">:copy</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:copy</span><span class="o">]</span>
|
12
|
+
<span class="n">set</span> <span class="ss">:move</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:move</span><span class="o">]</span>
|
13
|
+
<span class="n">set</span> <span class="ss">:dest_path</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:dest_path</span><span class="o">]</span>
|
14
|
+
|
15
|
+
<span class="k">begin</span>
|
16
|
+
|
17
|
+
<span class="k">raise</span> <span class="s2">"Please enter all required parameters"</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">file_id</span><span class="o">.</span><span class="n">empty?</span>
|
18
|
+
|
19
|
+
|
20
|
+
<span class="n">files_list</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">Folder</span><span class="o">.</span><span class="n">list!</span><span class="p">(</span><span class="s1">'/'</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
|
21
|
+
|
22
|
+
|
23
|
+
<span class="n">manipulate_file</span> <span class="o">=</span> <span class="kp">nil</span>
|
24
|
+
<span class="n">files_list</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">element</span><span class="o">|</span>
|
25
|
+
<span class="k">if</span> <span class="n">element</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="nb">Integer</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">file_id</span><span class="p">)</span>
|
26
|
+
<span class="n">manipulate_file</span> <span class="o">=</span> <span class="n">element</span>
|
27
|
+
<span class="k">end</span>
|
28
|
+
<span class="k">end</span>
|
29
|
+
<span class="k">raise</span> <span class="s2">"No file with such FileID"</span> <span class="k">if</span> <span class="n">manipulate_file</span><span class="o">.</span><span class="n">nil?</span>
|
30
|
+
|
31
|
+
|
32
|
+
<span class="k">unless</span> <span class="n">settings</span><span class="o">.</span><span class="n">copy</span><span class="o">.</span><span class="n">nil?</span>
|
33
|
+
<span class="n">file</span> <span class="o">=</span> <span class="n">manipulate_file</span><span class="o">.</span><span class="n">copy!</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">dest_path</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
|
34
|
+
<span class="n">button</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">copy</span>
|
35
|
+
<span class="k">end</span>
|
36
|
+
|
37
|
+
|
38
|
+
<span class="k">unless</span> <span class="n">settings</span><span class="o">.</span><span class="n">move</span><span class="o">.</span><span class="n">nil?</span>
|
39
|
+
<span class="n">file</span> <span class="o">=</span> <span class="n">manipulate_file</span><span class="o">.</span><span class="n">move!</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">dest_path</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
|
40
|
+
<span class="n">button</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">move</span>
|
41
|
+
<span class="k">end</span>
|
42
|
+
|
43
|
+
|
44
|
+
<span class="k">if</span> <span class="n">file</span>
|
45
|
+
<span class="n">massage</span> <span class="o">=</span> <span class="s2">"File was </span><span class="si">#{</span><span class="n">button</span><span class="si">}</span><span class="s2">'ed to the </span><span class="si">#{</span><span class="n">settings</span><span class="o">.</span><span class="n">dest_path</span><span class="si">}</span><span class="s2"> folder"</span>
|
46
|
+
<span class="k">end</span>
|
47
|
+
|
48
|
+
<span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=></span> <span class="n">e</span>
|
49
|
+
<span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
|
50
|
+
<span class="k">end</span>
|
51
|
+
|
52
|
+
|
53
|
+
<span class="n">haml</span> <span class="ss">:sample5</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:file_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">file_id</span><span class="p">,</span> <span class="ss">:dest_path</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">dest_path</span><span class="p">,</span> <span class="ss">:massage</span> <span class="o">=></span> <span class="n">massage</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=></span> <span class="n">err</span> <span class="p">}</span>
|
54
|
+
<span class="k">end</span>
|
55
|
+
|
56
|
+
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<!DOCTYPE html> <html> <head> <title>sample6.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample6.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/sample6'</span> <span class="k">do</span>
|
2
|
+
<span class="n">haml</span> <span class="ss">:sample6</span>
|
3
|
+
<span class="k">end</span>
|
4
|
+
|
5
|
+
|
6
|
+
<span class="n">post</span> <span class="s1">'/sample6'</span> <span class="k">do</span>
|
7
|
+
|
8
|
+
<span class="n">set</span> <span class="ss">:client_id</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:client_id</span><span class="o">]</span>
|
9
|
+
<span class="n">set</span> <span class="ss">:private_key</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:private_key</span><span class="o">]</span>
|
10
|
+
|
11
|
+
<span class="k">begin</span>
|
12
|
+
|
13
|
+
<span class="k">raise</span> <span class="s2">"Please enter all required parameters"</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="o">.</span><span class="n">empty?</span>
|
14
|
+
|
15
|
+
|
16
|
+
<span class="n">file_one_path</span> <span class="o">=</span> <span class="s2">"</span><span class="si">#{</span><span class="no">Dir</span><span class="o">.</span><span class="n">tmpdir</span><span class="si">}</span><span class="s2">/</span><span class="si">#{</span><span class="n">params</span><span class="o">[</span><span class="ss">:document</span><span class="o">][</span><span class="ss">:filename</span><span class="o">]</span><span class="si">}</span><span class="s2">"</span>
|
17
|
+
<span class="no">File</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">file_one_path</span><span class="p">,</span> <span class="s1">'wb'</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">f</span><span class="o">|</span> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">params</span><span class="o">[</span><span class="ss">:document</span><span class="o">][</span><span class="ss">:tempfile</span><span class="o">].</span><span class="n">read</span><span class="p">)</span> <span class="p">}</span>
|
18
|
+
|
19
|
+
|
20
|
+
<span class="n">file_one</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">File</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="nb">name</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="ss">:document</span><span class="o">][</span><span class="ss">:filename</span><span class="o">]</span><span class="p">,</span> <span class="n">local_path</span><span class="p">:</span> <span class="n">file_one_path</span><span class="p">)</span>
|
21
|
+
<span class="n">document_one</span> <span class="o">=</span> <span class="n">file_one</span><span class="o">.</span><span class="n">to_document</span>
|
22
|
+
|
23
|
+
|
24
|
+
<span class="n">signature_one_path</span> <span class="o">=</span> <span class="s2">"</span><span class="si">#{</span><span class="no">Dir</span><span class="o">.</span><span class="n">tmpdir</span><span class="si">}</span><span class="s2">/</span><span class="si">#{</span><span class="n">params</span><span class="o">[</span><span class="ss">:signature</span><span class="o">][</span><span class="ss">:filename</span><span class="o">]</span><span class="si">}</span><span class="s2">"</span>
|
25
|
+
<span class="no">File</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">signature_one_path</span><span class="p">,</span> <span class="s1">'wb'</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">f</span><span class="o">|</span> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">params</span><span class="o">[</span><span class="ss">:signature</span><span class="o">][</span><span class="ss">:tempfile</span><span class="o">].</span><span class="n">read</span><span class="p">)</span> <span class="p">}</span>
|
26
|
+
|
27
|
+
|
28
|
+
<span class="n">signature_one</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Signature</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="nb">name</span><span class="p">:</span> <span class="s1">'Test'</span><span class="p">,</span> <span class="n">image_path</span><span class="p">:</span> <span class="n">signature_one_path</span><span class="p">)</span>
|
29
|
+
<span class="n">signature_one</span><span class="o">.</span><span class="n">position</span> <span class="o">=</span> <span class="p">{</span> <span class="ss">top</span><span class="p">:</span> <span class="mi">0</span><span class="o">.</span><span class="mi">1</span><span class="p">,</span> <span class="ss">left</span><span class="p">:</span> <span class="mi">0</span><span class="o">.</span><span class="mo">07</span><span class="p">,</span> <span class="ss">width</span><span class="p">:</span> <span class="mi">50</span><span class="p">,</span> <span class="ss">height</span><span class="p">:</span> <span class="mi">50</span><span class="p">}</span>
|
30
|
+
|
31
|
+
|
32
|
+
<span class="n">signed_documents</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Document</span><span class="o">.</span><span class="n">sign_documents!</span><span class="p">(</span><span class="o">[</span><span class="n">document_one</span><span class="o">]</span><span class="p">,</span> <span class="o">[</span><span class="n">signature_one</span><span class="o">]</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span> <span class="p">})</span>
|
33
|
+
<span class="n">guid</span> <span class="o">=</span> <span class="n">signed_documents</span><span class="o">.</span><span class="n">first</span><span class="o">.</span><span class="n">file</span><span class="o">.</span><span class="n">guid</span>
|
34
|
+
|
35
|
+
|
36
|
+
<span class="k">if</span> <span class="n">signed_documents</span>
|
37
|
+
<span class="n">iframe</span> <span class="o">=</span> <span class="s2">"<iframe src='https://apps.groupdocs.com/document-viewer/Embed/</span><span class="si">#{</span><span class="n">guid</span><span class="si">}</span><span class="s2">' frameborder='0' width='720' height='600'></iframe>"</span>
|
38
|
+
<span class="k">end</span>
|
39
|
+
|
40
|
+
<span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=></span> <span class="n">e</span>
|
41
|
+
<span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
|
42
|
+
<span class="k">end</span>
|
43
|
+
|
44
|
+
|
45
|
+
<span class="n">haml</span> <span class="ss">:sample6</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:iframe</span> <span class="o">=></span> <span class="n">iframe</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=></span> <span class="n">err</span> <span class="p">}</span>
|
46
|
+
<span class="k">end</span>
|
47
|
+
|
48
|
+
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<!DOCTYPE html> <html> <head> <title>sample7.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample7.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/sample7'</span> <span class="k">do</span>
|
2
|
+
<span class="n">haml</span> <span class="ss">:sample7</span>
|
3
|
+
<span class="k">end</span>
|
4
|
+
|
5
|
+
|
6
|
+
<span class="n">post</span> <span class="s1">'/sample7'</span> <span class="k">do</span>
|
7
|
+
|
8
|
+
<span class="n">set</span> <span class="ss">:client_id</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:client_id</span><span class="o">]</span>
|
9
|
+
<span class="n">set</span> <span class="ss">:private_key</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:private_key</span><span class="o">]</span>
|
10
|
+
|
11
|
+
<span class="k">begin</span>
|
12
|
+
|
13
|
+
<span class="k">raise</span> <span class="s2">"Please enter all required parameters"</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="o">.</span><span class="n">empty?</span>
|
14
|
+
|
15
|
+
|
16
|
+
<span class="n">files_list</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">Folder</span><span class="o">.</span><span class="n">list!</span><span class="p">(</span><span class="s1">'/'</span><span class="p">,</span> <span class="p">{</span><span class="ss">:extended</span> <span class="o">=></span> <span class="kp">true</span><span class="p">},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
|
17
|
+
|
18
|
+
|
19
|
+
<span class="n">thumbnails</span> <span class="o">=</span> <span class="s1">''</span>
|
20
|
+
<span class="n">files_list</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">element</span><span class="o">|</span>
|
21
|
+
<span class="k">if</span> <span class="n">element</span><span class="o">.</span><span class="n">class</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">'::'</span><span class="p">)</span><span class="o">.</span><span class="n">last</span> <span class="o">==</span> <span class="s1">'Folder'</span>
|
22
|
+
<span class="k">next</span>
|
23
|
+
<span class="k">end</span>
|
24
|
+
|
25
|
+
<span class="k">if</span> <span class="n">element</span><span class="o">.</span><span class="n">thumbnail</span>
|
26
|
+
<span class="nb">name</span> <span class="o">=</span> <span class="n">element</span><span class="o">.</span><span class="n">name</span>
|
27
|
+
<span class="n">thumbnails</span> <span class="o">+=</span> <span class="s2">"<p><img src='data:image/png;base64,</span><span class="si">#{</span><span class="n">element</span><span class="o">.</span><span class="n">thumbnail</span><span class="si">}</span><span class="s2">', width='40px', height='40px'> </span><span class="si">#{</span><span class="nb">name</span><span class="si">}</span><span class="s2"></p>"</span>
|
28
|
+
<span class="k">end</span>
|
29
|
+
<span class="k">end</span>
|
30
|
+
|
31
|
+
<span class="k">unless</span> <span class="n">thumbnails</span><span class="o">.</span><span class="n">empty?</span>
|
32
|
+
<span class="n">set</span> <span class="ss">:thumbnails</span><span class="p">,</span> <span class="n">thumbnails</span>
|
33
|
+
<span class="k">end</span>
|
34
|
+
|
35
|
+
<span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=></span> <span class="n">e</span>
|
36
|
+
<span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
|
37
|
+
<span class="k">end</span>
|
38
|
+
|
39
|
+
|
40
|
+
<span class="n">haml</span> <span class="ss">:sample7</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:thumbnailList</span> <span class="o">=></span> <span class="n">thumbnails</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=></span> <span class="n">err</span> <span class="p">}</span>
|
41
|
+
<span class="k">end</span>
|
42
|
+
|
43
|
+
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<!DOCTYPE html> <html> <head> <title>sample8.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample8.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/sample8'</span> <span class="k">do</span>
|
2
|
+
<span class="n">haml</span> <span class="ss">:sample8</span>
|
3
|
+
<span class="k">end</span>
|
4
|
+
|
5
|
+
|
6
|
+
<span class="n">post</span> <span class="s1">'/sample8'</span> <span class="k">do</span>
|
7
|
+
|
8
|
+
<span class="n">set</span> <span class="ss">:client_id</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:client_id</span><span class="o">]</span>
|
9
|
+
<span class="n">set</span> <span class="ss">:private_key</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:private_key</span><span class="o">]</span>
|
10
|
+
<span class="n">set</span> <span class="ss">:guid</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:guid</span><span class="o">]</span>
|
11
|
+
<span class="n">set</span> <span class="ss">:page_number</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:page_number</span><span class="o">]</span>
|
12
|
+
|
13
|
+
|
14
|
+
document = file.to<em>document
|
15
|
+
document.page</em>images! 1024, 768, first<em>page: 0, page</em>count: 1 </p> </td> <td class="code"> <div class="highlight"><pre>
|
16
|
+
|
17
|
+
<span class="k">begin</span>
|
18
|
+
|
19
|
+
<span class="k">raise</span> <span class="s2">"Please enter all required parameters"</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="o">.</span><span class="n">empty?</span>
|
20
|
+
|
21
|
+
|
22
|
+
<span class="n">files_list</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">Folder</span><span class="o">.</span><span class="n">list!</span><span class="p">(</span><span class="s1">'/'</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
|
23
|
+
|
24
|
+
<span class="n">doc</span> <span class="o">=</span> <span class="kp">nil</span>
|
25
|
+
<span class="n">metadata</span> <span class="o">=</span> <span class="kp">nil</span>
|
26
|
+
<span class="n">files_list</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">element</span><span class="o">|</span>
|
27
|
+
<span class="k">if</span> <span class="n">element</span><span class="o">.</span><span class="n">class</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">'::'</span><span class="p">)</span><span class="o">.</span><span class="n">last</span> <span class="o">==</span> <span class="s1">'Folder'</span>
|
28
|
+
<span class="k">next</span>
|
29
|
+
<span class="k">end</span>
|
30
|
+
|
31
|
+
|
32
|
+
<span class="k">if</span> <span class="n">element</span><span class="o">.</span><span class="n">guid</span> <span class="o">==</span> <span class="n">settings</span><span class="o">.</span><span class="n">guid</span>
|
33
|
+
<span class="n">metadata</span> <span class="o">=</span> <span class="n">element</span><span class="o">.</span><span class="n">to_document</span><span class="o">.</span><span class="n">metadata!</span><span class="p">({</span> <span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
|
34
|
+
<span class="n">doc</span> <span class="o">=</span> <span class="n">element</span><span class="o">.</span><span class="n">to_document</span>
|
35
|
+
<span class="k">end</span>
|
36
|
+
<span class="k">end</span>
|
37
|
+
|
38
|
+
|
39
|
+
<span class="n">images</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">page_images!</span><span class="p">(</span><span class="mi">800</span><span class="p">,</span> <span class="mi">400</span><span class="p">,</span> <span class="p">{</span><span class="ss">:first_page</span> <span class="o">=></span> <span class="mi">0</span><span class="p">,</span> <span class="ss">:page_count</span> <span class="o">=></span> <span class="n">metadata</span><span class="o">.</span><span class="n">page_count</span><span class="p">},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
|
40
|
+
|
41
|
+
|
42
|
+
<span class="k">unless</span> <span class="n">images</span><span class="o">.</span><span class="n">empty?</span>
|
43
|
+
<span class="n">image</span> <span class="o">=</span> <span class="n">images</span><span class="o">[</span><span class="nb">Integer</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">page_number</span><span class="p">)</span><span class="o">]</span>
|
44
|
+
<span class="k">end</span>
|
45
|
+
|
46
|
+
<span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=></span> <span class="n">e</span>
|
47
|
+
<span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
|
48
|
+
<span class="k">end</span>
|
49
|
+
|
50
|
+
|
51
|
+
<span class="n">haml</span> <span class="ss">:sample8</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:guid</span> <span class="o">=></span><span class="n">settings</span><span class="o">.</span><span class="n">guid</span> <span class="p">,</span> <span class="ss">:page_number</span><span class="o">=></span><span class="n">settings</span><span class="o">.</span><span class="n">page_number</span><span class="p">,</span> <span class="ss">:image</span><span class="o">=></span><span class="n">image</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=></span> <span class="n">err</span> <span class="p">}</span>
|
52
|
+
<span class="k">end</span>
|
53
|
+
|
54
|
+
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<!DOCTYPE html> <html> <head> <title>sample9.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample9.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/sample9'</span> <span class="k">do</span>
|
2
|
+
<span class="n">haml</span> <span class="ss">:sample9</span>
|
3
|
+
<span class="k">end</span>
|
4
|
+
|
5
|
+
|
6
|
+
<span class="n">post</span> <span class="s1">'/sample9'</span> <span class="k">do</span>
|
7
|
+
|
8
|
+
<span class="n">set</span> <span class="ss">:guid</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:guid</span><span class="o">]</span>
|
9
|
+
<span class="n">set</span> <span class="ss">:width</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:width</span><span class="o">]</span>
|
10
|
+
<span class="n">set</span> <span class="ss">:height</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:height</span><span class="o">]</span>
|
11
|
+
|
12
|
+
<span class="k">begin</span>
|
13
|
+
|
14
|
+
<span class="k">raise</span> <span class="s2">"Please enter all required parameters"</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">guid</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">width</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">height</span><span class="o">.</span><span class="n">empty?</span>
|
15
|
+
|
16
|
+
|
17
|
+
<span class="n">v_url</span> <span class="o">=</span> <span class="s2">"https://apps.groupdocs.com/document-viewer/embed/</span><span class="si">#{</span><span class="n">settings</span><span class="o">.</span><span class="n">guid</span><span class="si">}</span><span class="s2">?frameborder='0' width='</span><span class="si">#{</span><span class="n">settings</span><span class="o">.</span><span class="n">width</span><span class="si">}</span><span class="s2">' height='</span><span class="si">#{</span><span class="n">settings</span><span class="o">.</span><span class="n">height</span><span class="si">}</span><span class="s2">'"</span>
|
18
|
+
|
19
|
+
<span class="k">if</span> <span class="n">v_url</span>
|
20
|
+
<span class="n">v_url</span> <span class="o">=</span> <span class="n">v_url</span>
|
21
|
+
<span class="k">end</span>
|
22
|
+
|
23
|
+
<span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=></span> <span class="n">e</span>
|
24
|
+
<span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
|
25
|
+
<span class="k">end</span>
|
26
|
+
|
27
|
+
|
28
|
+
<span class="n">haml</span> <span class="ss">:sample9</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span> <span class="ss">:guid</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">guid</span><span class="p">,</span> <span class="ss">:width</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">width</span><span class="p">,</span> <span class="ss">:height</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">height</span><span class="p">,</span> <span class="ss">:v_url</span><span class="o">=></span><span class="n">v_url</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=></span> <span class="n">err</span> <span class="p">}</span>
|
29
|
+
<span class="k">end</span>
|
30
|
+
|
31
|
+
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
|