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,87 @@
1
+ <!DOCTYPE html> <html> <head> <title>sample11.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> sample11.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;/sample11&#39;</span> <span class="k">do</span>
2
+ <span class="n">haml</span> <span class="ss">:sample11</span>
3
+ <span class="k">end</span>
4
+
5
+
6
+ <span class="n">post</span> <span class="s1">&#39;/sample11&#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">:fileId</span><span class="o">]</span>
11
+ <span class="n">set</span> <span class="ss">:annotation_type</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:annotation_type</span><span class="o">]</span>
12
+
13
+ <span class="k">begin</span>
14
+
15
+ <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> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span><span class="o">.</span><span class="n">empty?</span>
16
+
17
+
18
+ <span class="n">types</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;text&#39;</span> <span class="o">=&gt;</span> <span class="mi">0</span><span class="p">,</span> <span class="s1">&#39;area&#39;</span> <span class="o">=&gt;</span> <span class="mi">1</span><span class="p">,</span> <span class="s1">&#39;point&#39;</span> <span class="o">=&gt;</span> <span class="mi">2</span><span class="p">}</span>
19
+
20
+
21
+ <span class="n">allParams</span> <span class="o">=</span> <span class="n">allParams</span> <span class="o">=</span> <span class="o">[</span><span class="s1">&#39;annotation_type&#39;</span><span class="p">,</span> <span class="s1">&#39;box_x&#39;</span><span class="p">,</span> <span class="s1">&#39;box_y&#39;</span><span class="p">,</span> <span class="s1">&#39;text&#39;</span><span class="o">]</span>
22
+
23
+
24
+ <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span> <span class="o">==</span> <span class="s2">&quot;text&quot;</span>
25
+ <span class="n">allParams</span> <span class="o">=</span> <span class="n">allParams</span> <span class="o">|</span> <span class="o">[</span><span class="s1">&#39;box_width&#39;</span><span class="p">,</span> <span class="s1">&#39;box_height&#39;</span><span class="p">,</span> <span class="s1">&#39;annotationPosition_x&#39;</span><span class="p">,</span> <span class="s1">&#39;annotationPosition_y&#39;</span><span class="o">]</span>
26
+ <span class="k">elsif</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span> <span class="o">==</span> <span class="s2">&quot;area&quot;</span>
27
+ <span class="n">allParams</span> <span class="o">=</span> <span class="n">allParams</span> <span class="o">|</span> <span class="o">[</span><span class="s1">&#39;box_width&#39;</span><span class="p">,</span> <span class="s1">&#39;box_height&#39;</span><span class="o">]</span>
28
+ <span class="k">end</span>
29
+
30
+
31
+ <span class="n">allParams</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">param</span><span class="o">|</span>
32
+ <span class="k">raise</span> <span class="s2">&quot;Please enter all required parameters&quot;</span> <span class="k">if</span> <span class="n">params</span><span class="o">[</span><span class="n">param</span><span class="o">].</span><span class="n">empty?</span>
33
+ <span class="k">end</span>
34
+
35
+
36
+ <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>
37
+ <span class="n">document</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
38
+
39
+
40
+ <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>
41
+ <span class="k">if</span> <span class="n">element</span><span class="o">.</span><span class="n">respond_to?</span><span class="p">(</span><span class="s1">&#39;guid&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="kp">true</span> <span class="ow">and</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">file_id</span>
42
+ <span class="n">document</span> <span class="o">=</span> <span class="n">element</span>
43
+ <span class="k">end</span>
44
+ <span class="k">end</span>
45
+
46
+ <span class="k">unless</span> <span class="n">document</span><span class="o">.</span><span class="n">instance_of?</span> <span class="nb">String</span>
47
+
48
+
49
+ <span class="n">annotation</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="no">Annotation</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="ss">document</span><span class="p">:</span> <span class="n">document</span><span class="o">.</span><span class="n">to_document</span><span class="p">)</span>
50
+ <span class="n">annotation</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">types</span><span class="o">[</span><span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span><span class="o">]</span>
51
+
52
+
53
+ text annotation</p> </td> <td class="code"> <div class="highlight"><pre>
54
+ <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span> <span class="o">==</span> <span class="s2">&quot;text&quot;</span>
55
+ <span class="n">annotation</span><span class="o">.</span><span class="n">box</span> <span class="o">=</span> <span class="p">{</span><span class="ss">x</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">&#39;box_x&#39;</span><span class="o">]</span><span class="p">,</span> <span class="ss">y</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">&#39;box_y&#39;</span><span class="o">]</span><span class="p">,</span> <span class="ss">width</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">&#39;box_width&#39;</span><span class="o">]</span><span class="p">,</span> <span class="ss">height</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">&#39;box_height&#39;</span><span class="o">]</span><span class="p">}</span>
56
+ <span class="n">annotation</span><span class="o">.</span><span class="n">annotationPosition</span> <span class="o">=</span> <span class="p">{</span><span class="ss">x</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">&#39;annotationPosition_x&#39;</span><span class="o">]</span><span class="p">,</span> <span class="ss">y</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">&#39;annotationPosition_y&#39;</span><span class="o">]</span><span class="p">}</span>
57
+
58
+
59
+ <span class="k">elsif</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span> <span class="o">==</span> <span class="s2">&quot;area&quot;</span>
60
+ <span class="n">annotation</span><span class="o">.</span><span class="n">box</span> <span class="o">=</span> <span class="p">{</span><span class="ss">x</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">&#39;box_x&#39;</span><span class="o">]</span><span class="p">,</span> <span class="ss">y</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">&#39;box_y&#39;</span><span class="o">]</span><span class="p">,</span> <span class="ss">width</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">&#39;box_width&#39;</span><span class="o">]</span><span class="p">,</span> <span class="ss">height</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">&#39;box_height&#39;</span><span class="o">]</span><span class="p">}</span>
61
+ <span class="n">annotation</span><span class="o">.</span><span class="n">annotationPosition</span> <span class="o">=</span> <span class="p">{</span><span class="ss">x</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="ss">y</span><span class="p">:</span> <span class="mi">0</span><span class="p">}</span>
62
+
63
+
64
+ <span class="k">elsif</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span> <span class="o">==</span> <span class="s2">&quot;point&quot;</span>
65
+ <span class="n">annotation</span><span class="o">.</span><span class="n">box</span> <span class="o">=</span> <span class="p">{</span><span class="ss">x</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">&#39;box_x&#39;</span><span class="o">]</span><span class="p">,</span> <span class="ss">y</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">&#39;box_y&#39;</span><span class="o">]</span><span class="p">,</span> <span class="ss">width</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="ss">height</span><span class="p">:</span> <span class="mi">0</span><span class="p">}</span>
66
+ <span class="n">annotation</span><span class="o">.</span><span class="n">annotationPosition</span> <span class="o">=</span> <span class="p">{</span><span class="ss">x</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="ss">y</span><span class="p">:</span> <span class="mi">0</span><span class="p">}</span>
67
+ <span class="k">end</span>
68
+
69
+
70
+ <span class="n">annotation</span><span class="o">.</span><span class="n">create!</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>
71
+
72
+
73
+ <span class="n">reply</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="ss">Annotation</span><span class="p">:</span><span class="ss">:Reply</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="ss">annotation</span><span class="p">:</span> <span class="n">annotation</span><span class="p">)</span>
74
+ <span class="n">reply</span><span class="o">.</span><span class="n">text</span> <span class="o">=</span> <span class="n">params</span><span class="o">[</span><span class="s1">&#39;text&#39;</span><span class="o">]</span>
75
+ <span class="n">reply</span><span class="o">.</span><span class="n">create!</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>
76
+
77
+ <span class="k">end</span>
78
+
79
+ <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
80
+ <span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
81
+ <span class="k">end</span>
82
+
83
+
84
+ <span class="n">haml</span> <span class="ss">:sample11</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">:fileId</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">:annotationType</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span><span class="p">,</span> <span class="ss">:annotationId</span> <span class="o">=&gt;</span> <span class="p">(</span><span class="n">defined?</span> <span class="n">annotation</span><span class="o">.</span><span class="n">id</span><span class="p">)</span> <span class="p">?</span> <span class="n">annotation</span><span class="o">.</span><span class="n">id</span> <span class="p">:</span> <span class="kp">nil</span><span class="p">,</span> <span class="ss">:annotationText</span> <span class="o">=&gt;</span> <span class="n">params</span><span class="o">[</span><span class="s1">&#39;text&#39;</span><span class="o">]</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span> <span class="p">}</span>
85
+ <span class="k">end</span>
86
+
87
+ </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -0,0 +1,40 @@
1
+ <!DOCTYPE html> <html> <head> <title>sample12.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> sample12.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;/sample12&#39;</span> <span class="k">do</span>
2
+ <span class="n">haml</span> <span class="ss">:sample12</span>
3
+ <span class="k">end</span>
4
+
5
+
6
+ <span class="n">post</span> <span class="s1">&#39;/sample12&#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">:fileId</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">document</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">respond_to?</span><span class="p">(</span><span class="s1">&#39;guid&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="kp">true</span> <span class="ow">and</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">file_id</span>
23
+ <span class="n">document</span> <span class="o">=</span> <span class="n">element</span>
24
+ <span class="k">end</span>
25
+ <span class="k">end</span>
26
+
27
+ <span class="k">unless</span> <span class="n">document</span><span class="o">.</span><span class="n">instance_of?</span> <span class="nb">String</span>
28
+
29
+ <span class="n">annotations</span> <span class="o">=</span> <span class="n">document</span><span class="o">.</span><span class="n">to_document</span><span class="o">.</span><span class="n">annotations!</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>
30
+ <span class="k">end</span>
31
+
32
+ <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
33
+ <span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
34
+ <span class="k">end</span>
35
+
36
+
37
+ <span class="n">haml</span> <span class="ss">:sample12</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">:annotations</span> <span class="o">=&gt;</span> <span class="n">annotations</span><span class="p">,</span> <span class="ss">:fileId</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">:err</span> <span class="o">=&gt;</span> <span class="n">err</span> <span class="p">}</span>
38
+ <span class="k">end</span>
39
+
40
+ </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -0,0 +1,41 @@
1
+ <!DOCTYPE html> <html> <head> <title>sample13.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> sample13.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;/sample13&#39;</span> <span class="k">do</span>
2
+ <span class="n">haml</span> <span class="ss">:sample13</span>
3
+ <span class="k">end</span>
4
+
5
+
6
+ <span class="n">post</span> <span class="s1">&#39;/sample13&#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">:fileId</span><span class="o">]</span>
11
+ <span class="n">set</span> <span class="ss">:email</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:email</span><span class="o">]</span>
12
+
13
+ <span class="k">begin</span>
14
+
15
+ <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> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">email</span><span class="o">.</span><span class="n">empty?</span>
16
+
17
+
18
+ <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>
19
+ <span class="n">document</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
20
+
21
+
22
+ <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>
23
+ <span class="k">if</span> <span class="n">element</span><span class="o">.</span><span class="n">respond_to?</span><span class="p">(</span><span class="s1">&#39;guid&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="kp">true</span> <span class="ow">and</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">file_id</span>
24
+ <span class="n">document</span> <span class="o">=</span> <span class="n">element</span>
25
+ <span class="k">end</span>
26
+ <span class="k">end</span>
27
+
28
+ <span class="k">unless</span> <span class="n">document</span><span class="o">.</span><span class="n">instance_of?</span> <span class="nb">String</span>
29
+
30
+ <span class="n">result</span> <span class="o">=</span> <span class="n">document</span><span class="o">.</span><span class="n">to_document</span><span class="o">.</span><span class="n">set_collaborators!</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">email</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot; &quot;</span><span class="p">),</span> <span class="mi">1</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>
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">:sample13</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">:fileId</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">:email</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">email</span><span class="p">,</span> <span class="ss">:result</span> <span class="o">=&gt;</span> <span class="n">result</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,30 @@
1
+ <!DOCTYPE html> <html> <head> <title>sample14.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> sample14.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;/sample14&#39;</span> <span class="k">do</span>
2
+ <span class="n">haml</span> <span class="ss">:sample14</span>
3
+ <span class="k">end</span>
4
+
5
+
6
+ <span class="n">post</span> <span class="s1">&#39;/sample14&#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">:folder</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:folder</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">folder</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="n">settings</span><span class="o">.</span><span class="n">folder</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
+
19
+
20
+ <span class="n">shares</span> <span class="o">=</span> <span class="n">files_list</span><span class="o">.</span><span class="n">first</span><span class="o">.</span><span class="n">sharers!</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
+ <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">:sample14</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">:folder</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">folder</span><span class="p">,</span> <span class="ss">:shares</span> <span class="o">=&gt;</span> <span class="n">shares</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,27 @@
1
+ <!DOCTYPE html> <html> <head> <title>sample15.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> sample15.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;/sample15&#39;</span> <span class="k">do</span>
2
+ <span class="n">haml</span> <span class="ss">:sample15</span>
3
+ <span class="k">end</span>
4
+
5
+
6
+ <span class="n">post</span> <span class="s1">&#39;/sample15&#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">views</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">views!</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
+ <span class="n">total</span> <span class="o">=</span> <span class="n">views</span><span class="o">.</span><span class="n">count</span><span class="p">()</span>
18
+
19
+ <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
20
+ <span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
21
+ <span class="k">end</span>
22
+
23
+
24
+ <span class="n">haml</span> <span class="ss">:sample15</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">:total</span> <span class="o">=&gt;</span> <span class="n">total</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span> <span class="p">}</span>
25
+ <span class="k">end</span>
26
+
27
+ </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html> <html> <head> <title>sample16.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> sample16.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;/sample16&#39;</span> <span class="k">do</span>
2
+ <span class="n">haml</span> <span class="ss">:sample16</span>
3
+ <span class="k">end</span>
4
+
5
+
6
+ <span class="n">post</span> <span class="s1">&#39;/sample16&#39;</span> <span class="k">do</span>
7
+
8
+ <span class="n">set</span> <span class="ss">:fileId</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:fileId</span><span class="o">]</span>
9
+
10
+ <span class="k">begin</span>
11
+
12
+ <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">fileId</span><span class="o">.</span><span class="n">empty?</span>
13
+
14
+
15
+ <span class="n">iframe</span> <span class="o">=</span> <span class="s2">&quot;&lt;iframe src=&#39;https://apps.groupdocs.com/assembly2/questionnaire-assembly/</span><span class="si">#{</span><span class="n">settings</span><span class="o">.</span><span class="n">fileId</span><span class="si">}</span><span class="s2">&#39; frameborder=&#39;0&#39; width=&#39;100%&#39; height=&#39;600&#39;&gt;&lt;/iframe&gt;&quot;</span>
16
+
17
+ <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
18
+ <span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
19
+ <span class="k">end</span>
20
+
21
+
22
+ <span class="n">haml</span> <span class="ss">:sample16</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=&gt;</span> <span class="p">{</span> <span class="ss">:fileId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">fileId</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>
23
+ <span class="k">end</span>
24
+
25
+ </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -0,0 +1,37 @@
1
+ <!DOCTYPE html> <html> <head> <title>sample17.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> sample17.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;/sample17&#39;</span> <span class="k">do</span>
2
+ <span class="n">haml</span> <span class="ss">:sample17</span>
3
+ <span class="k">end</span>
4
+
5
+
6
+ <span class="n">post</span> <span class="s1">&#39;/sample17&#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</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:file</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</span><span class="o">.</span><span class="n">nil?</span>
15
+
16
+
17
+ <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>
18
+
19
+ <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>
20
+
21
+ <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>
22
+
23
+ <span class="n">file</span><span class="o">.</span><span class="n">compress!</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>
24
+
25
+
26
+ <span class="n">massage</span> <span class="o">=</span> <span class="s2">&quot;&lt;p&gt;Archive created and saved successfully. 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>
27
+ <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>
28
+
29
+ <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
30
+ <span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
31
+ <span class="k">end</span>
32
+
33
+
34
+ <span class="n">haml</span> <span class="ss">:sample17</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>
35
+ <span class="k">end</span>
36
+
37
+ </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -0,0 +1,62 @@
1
+ <!DOCTYPE html> <html> <head> <title>sample18.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> sample18.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;/sample18&#39;</span> <span class="k">do</span>
2
+ <span class="n">haml</span> <span class="ss">:sample18</span>
3
+ <span class="k">end</span>
4
+
5
+
6
+ <span class="n">post</span> <span class="s1">&#39;/sample18&#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">:fileId</span><span class="o">]</span>
11
+ <span class="n">set</span> <span class="ss">:convert_type</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:convert_type</span><span class="o">]</span>
12
+
13
+ <span class="k">begin</span>
14
+
15
+ <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>
16
+
17
+
18
+ <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>
19
+ <span class="n">document</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
20
+
21
+
22
+ <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>
23
+ <span class="k">if</span> <span class="n">element</span><span class="o">.</span><span class="n">respond_to?</span><span class="p">(</span><span class="s1">&#39;guid&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="kp">true</span> <span class="ow">and</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">file_id</span>
24
+ <span class="n">document</span> <span class="o">=</span> <span class="n">element</span>
25
+ <span class="k">end</span>
26
+ <span class="k">end</span>
27
+
28
+ <span class="n">message</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span>
29
+ <span class="k">unless</span> <span class="n">document</span><span class="o">.</span><span class="n">instance_of?</span> <span class="nb">String</span>
30
+
31
+
32
+ <span class="n">convert</span> <span class="o">=</span> <span class="n">document</span><span class="o">.</span><span class="n">to_document</span><span class="o">.</span><span class="n">convert!</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">convert_type</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="nb">sleep</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
34
+
35
+ <span class="k">if</span> <span class="n">convert</span><span class="o">.</span><span class="n">instance_of?</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Job</span>
36
+
37
+ <span class="n">jobs</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Job</span><span class="o">::</span><span class="n">all!</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>
38
+
39
+
40
+ <span class="n">job</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
41
+ <span class="n">jobs</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>
42
+ <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="n">convert</span><span class="o">.</span><span class="n">id</span>
43
+ <span class="n">job</span> <span class="o">=</span> <span class="n">element</span>
44
+ <span class="k">end</span>
45
+ <span class="k">end</span>
46
+
47
+ <span class="k">if</span> <span class="n">job</span><span class="o">.</span><span class="n">status</span> <span class="o">==</span> <span class="ss">:archived</span>
48
+ <span class="n">message</span> <span class="o">=</span> <span class="s2">&quot;&lt;p&gt;Converted file saved successfully.&quot;</span>
49
+ <span class="k">end</span>
50
+
51
+ <span class="k">end</span>
52
+ <span class="k">end</span>
53
+
54
+ <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
55
+ <span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
56
+ <span class="k">end</span>
57
+
58
+
59
+ <span class="n">haml</span> <span class="ss">:sample18</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">:fileId</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">:message</span> <span class="o">=&gt;</span> <span class="n">message</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span> <span class="p">}</span>
60
+ <span class="k">end</span>
61
+
62
+ </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>