groupdocs 1.2.8 → 1.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/examples/api-samples/README.md +17 -6
  2. data/examples/api-samples/app.rb +0 -2
  3. data/examples/api-samples/public/GroupDocs_Signature_Demo.pdf +0 -0
  4. data/examples/api-samples/public/docs/docco.css +192 -0
  5. data/examples/api-samples/public/docs/envelope-sample.html +132 -0
  6. data/examples/api-samples/public/docs/sample1.html +26 -0
  7. data/examples/api-samples/public/docs/sample10.html +49 -0
  8. data/examples/api-samples/public/docs/sample11.html +87 -0
  9. data/examples/api-samples/public/docs/sample12.html +40 -0
  10. data/examples/api-samples/public/docs/sample13.html +41 -0
  11. data/examples/api-samples/public/docs/sample14.html +30 -0
  12. data/examples/api-samples/public/docs/sample15.html +27 -0
  13. data/examples/api-samples/public/docs/sample16.html +25 -0
  14. data/examples/api-samples/public/docs/sample17.html +37 -0
  15. data/examples/api-samples/public/docs/sample18.html +62 -0
  16. data/examples/api-samples/public/docs/sample2.html +30 -0
  17. data/examples/api-samples/public/docs/sample3.html +34 -0
  18. data/examples/api-samples/public/docs/sample4.html +41 -0
  19. data/examples/api-samples/public/docs/sample5.html +56 -0
  20. data/examples/api-samples/public/docs/sample6.html +48 -0
  21. data/examples/api-samples/public/docs/sample7.html +43 -0
  22. data/examples/api-samples/public/docs/sample8.html +54 -0
  23. data/examples/api-samples/public/docs/sample9.html +31 -0
  24. data/examples/api-samples/samples/envelope-sample.rb +132 -0
  25. data/examples/api-samples/samples/sample1.rb +10 -2
  26. data/examples/api-samples/samples/sample10.rb +17 -5
  27. data/examples/api-samples/samples/sample11.rb +86 -0
  28. data/examples/api-samples/samples/sample12.rb +39 -0
  29. data/examples/api-samples/samples/sample13.rb +40 -0
  30. data/examples/api-samples/samples/sample14.rb +29 -0
  31. data/examples/api-samples/samples/sample15.rb +26 -0
  32. data/examples/api-samples/samples/sample16.rb +24 -0
  33. data/examples/api-samples/samples/sample17.rb +36 -0
  34. data/examples/api-samples/samples/sample18.rb +61 -0
  35. data/examples/api-samples/samples/sample2.rb +14 -4
  36. data/examples/api-samples/samples/sample3.rb +14 -4
  37. data/examples/api-samples/samples/sample4.rb +12 -3
  38. data/examples/api-samples/samples/sample5.rb +13 -2
  39. data/examples/api-samples/samples/sample6.rb +18 -6
  40. data/examples/api-samples/samples/sample7.rb +9 -0
  41. data/examples/api-samples/samples/sample8.rb +17 -4
  42. data/examples/api-samples/samples/sample9.rb +10 -2
  43. data/examples/api-samples/views/envelope_sample.haml +73 -0
  44. data/examples/api-samples/views/index.haml +18 -0
  45. data/examples/api-samples/views/sample1.haml +21 -0
  46. data/examples/api-samples/views/sample10.haml +21 -0
  47. data/examples/api-samples/views/sample11.haml +141 -0
  48. data/examples/api-samples/views/sample12.haml +94 -0
  49. data/examples/api-samples/views/sample13.haml +90 -0
  50. data/examples/api-samples/views/sample14.haml +86 -0
  51. data/examples/api-samples/views/sample15.haml +75 -0
  52. data/examples/api-samples/views/sample16.haml +68 -0
  53. data/examples/api-samples/views/sample17.haml +80 -0
  54. data/examples/api-samples/views/sample18.haml +87 -0
  55. data/examples/api-samples/views/sample2.haml +21 -0
  56. data/examples/api-samples/views/sample3.haml +23 -2
  57. data/examples/api-samples/views/sample4.haml +21 -0
  58. data/examples/api-samples/views/sample5.haml +21 -0
  59. data/examples/api-samples/views/sample6.haml +22 -1
  60. data/examples/api-samples/views/sample7.haml +21 -0
  61. data/examples/api-samples/views/sample8.haml +22 -1
  62. data/examples/api-samples/views/sample9.haml +21 -0
  63. data/lib/groupdocs/job.rb +5 -3
  64. data/lib/groupdocs/user.rb +33 -0
  65. data/lib/groupdocs/version.rb +1 -1
  66. data/spec/groupdocs/job_spec.rb +5 -0
  67. data/spec/groupdocs/user_spec.rb +22 -0
  68. data/spec/support/json/update_account.json +10 -0
  69. 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 &hellip; <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">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample2&#39;</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">&#39;/sample2&#39;</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">&quot;Please enter all required parameters&quot;</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">&#39;/&#39;</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=&gt;</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">=&gt;</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">&#39;&#39;</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">&lt;&lt;</span> <span class="s2">&quot;</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">&lt;br /&gt;&quot;</span><span class="p">}</span>
21
+
22
+ <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</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">=&gt;</span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=&gt;</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">=&gt;</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">=&gt;</span> <span class="n">filelist</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</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 &hellip; <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">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample3&#39;</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">&#39;/sample3&#39;</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">&quot;Please enter all required parameters&quot;</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">&quot;</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">&quot;</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">&#39;wb&#39;</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">&quot;&lt;p&gt;File was uploaded to GroupDocs. Here you can see your &lt;strong&gt;</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">&lt;/strong&gt; file in the GroupDocs Embedded Viewer.&lt;/p&gt;&quot;</span>
24
+ <span class="n">iframe</span> <span class="o">=</span> <span class="s2">&quot;&lt;iframe src=&#39;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">&#39; frameborder=&#39;0&#39; width=&#39;720&#39; height=&#39;600&#39;&gt;&lt;/iframe&gt;&quot;</span>
25
+
26
+ <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</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">=&gt;</span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=&gt;</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">=&gt;</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">=&gt;</span><span class="n">iframe</span><span class="p">,</span> <span class="ss">:massage</span> <span class="o">=&gt;</span> <span class="n">massage</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</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 &hellip; <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">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample4&#39;</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">&#39;/sample4&#39;</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">&quot;Please enter all required parameters&quot;</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">&#39;/&#39;</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=&gt;</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">=&gt;</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">&#39;&#39;</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">=&gt;</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">=&gt;</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">&quot;&lt;font color=&#39;green&#39;&gt;File was downloaded to the &lt;font color=&#39;blue&#39;&gt;</span><span class="si">#{</span><span class="n">dowloaded_file</span><span class="si">}</span><span class="s2">&lt;/font&gt; folder&lt;/font&gt; &lt;br /&gt;&quot;</span>
31
+ <span class="k">end</span>
32
+
33
+ <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</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">=&gt;</span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=&gt;</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">=&gt;</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">=&gt;</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">=&gt;</span> <span class="n">massage</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</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 &hellip; <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">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample5&#39;</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">&#39;/sample5&#39;</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">&quot;Please enter all required parameters&quot;</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">&#39;/&#39;</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=&gt;</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">=&gt;</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">&quot;No file with such FileID&quot;</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">=&gt;</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">=&gt;</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">=&gt;</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">=&gt;</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">&quot;File was </span><span class="si">#{</span><span class="n">button</span><span class="si">}</span><span class="s2">&#39;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&quot;</span>
46
+ <span class="k">end</span>
47
+
48
+ <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</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">=&gt;</span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=&gt;</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">=&gt;</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">=&gt;</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">=&gt;</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">=&gt;</span> <span class="n">massage</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</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 &hellip; <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">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample6&#39;</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">&#39;/sample6&#39;</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">&quot;Please enter all required parameters&quot;</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">&quot;</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">&quot;</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">&#39;wb&#39;</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">&quot;</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">&quot;</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">&#39;wb&#39;</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">&#39;Test&#39;</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">=&gt;</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">=&gt;</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">&quot;&lt;iframe src=&#39;https://apps.groupdocs.com/document-viewer/Embed/</span><span class="si">#{</span><span class="n">guid</span><span class="si">}</span><span class="s2">&#39; frameborder=&#39;0&#39; width=&#39;720&#39; height=&#39;600&#39;&gt;&lt;/iframe&gt;&quot;</span>
38
+ <span class="k">end</span>
39
+
40
+ <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</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">=&gt;</span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=&gt;</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">=&gt;</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">=&gt;</span> <span class="n">iframe</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</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 &hellip; <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">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample7&#39;</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">&#39;/sample7&#39;</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">&quot;Please enter all required parameters&quot;</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">&#39;/&#39;</span><span class="p">,</span> <span class="p">{</span><span class="ss">:extended</span> <span class="o">=&gt;</span> <span class="kp">true</span><span class="p">},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=&gt;</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">=&gt;</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">&#39;&#39;</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">&#39;::&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">last</span> <span class="o">==</span> <span class="s1">&#39;Folder&#39;</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">&quot;&lt;p&gt;&lt;img src=&#39;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">&#39;, width=&#39;40px&#39;, height=&#39;40px&#39;&gt; </span><span class="si">#{</span><span class="nb">name</span><span class="si">}</span><span class="s2">&lt;/p&gt;&quot;</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">=&gt;</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">=&gt;</span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=&gt;</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">=&gt;</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">=&gt;</span> <span class="n">thumbnails</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</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 &hellip; <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">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample8&#39;</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">&#39;/sample8&#39;</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">&quot;Please enter all required parameters&quot;</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">&#39;/&#39;</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=&gt;</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">=&gt;</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">&#39;::&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">last</span> <span class="o">==</span> <span class="s1">&#39;Folder&#39;</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">=&gt;</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">=&gt;</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">=&gt;</span> <span class="mi">0</span><span class="p">,</span> <span class="ss">:page_count</span> <span class="o">=&gt;</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">=&gt;</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">=&gt;</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">=&gt;</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">=&gt;</span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=&gt;</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">=&gt;</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">=&gt;</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">=&gt;</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">=&gt;</span><span class="n">image</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</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 &hellip; <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">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample9&#39;</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">&#39;/sample9&#39;</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">&quot;Please enter all required parameters&quot;</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">&quot;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=&#39;0&#39; width=&#39;</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">&#39; height=&#39;</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">&#39;&quot;</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">=&gt;</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">=&gt;</span> <span class="p">{</span> <span class="ss">:guid</span> <span class="o">=&gt;</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">=&gt;</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">=&gt;</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">=&gt;</span><span class="n">v_url</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</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>