groupdocs 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/CHANGELOG.md +6 -0
  2. data/examples/api-samples/README.md +1 -1
  3. data/examples/api-samples/public/css/style.css +2 -2
  4. data/examples/api-samples/public/docs/annotation-sample.html +57 -0
  5. data/examples/api-samples/public/docs/envelope-sample.html +32 -32
  6. data/examples/api-samples/public/docs/sample1.html +3 -3
  7. data/examples/api-samples/public/docs/sample10.html +25 -24
  8. data/examples/api-samples/public/docs/sample11.html +17 -17
  9. data/examples/api-samples/public/docs/sample12.html +4 -4
  10. data/examples/api-samples/public/docs/sample13.html +5 -5
  11. data/examples/api-samples/public/docs/sample14.html +5 -5
  12. data/examples/api-samples/public/docs/sample15.html +4 -4
  13. data/examples/api-samples/public/docs/sample16.html +3 -3
  14. data/examples/api-samples/public/docs/sample17.html +3 -3
  15. data/examples/api-samples/public/docs/sample18.html +129 -34
  16. data/examples/api-samples/public/docs/sample19.html +59 -0
  17. data/examples/api-samples/public/docs/sample2.html +5 -5
  18. data/examples/api-samples/public/docs/sample20.html +51 -0
  19. data/examples/api-samples/public/docs/sample21.html +66 -0
  20. data/examples/api-samples/public/docs/sample22.html +53 -0
  21. data/examples/api-samples/public/docs/sample3.html +4 -4
  22. data/examples/api-samples/public/docs/sample4.html +27 -16
  23. data/examples/api-samples/public/docs/sample5.html +29 -22
  24. data/examples/api-samples/public/docs/sample6.html +6 -6
  25. data/examples/api-samples/public/docs/sample7.html +8 -8
  26. data/examples/api-samples/public/docs/sample8.html +31 -23
  27. data/examples/api-samples/public/docs/sample9.html +26 -8
  28. data/examples/api-samples/public/templates/merge_feid_doc.docx +0 -0
  29. data/examples/api-samples/samples/annotation-sample.rb +22 -16
  30. data/examples/api-samples/samples/envelope-sample.rb +26 -25
  31. data/examples/api-samples/samples/sample1.rb +2 -2
  32. data/examples/api-samples/samples/sample10.rb +21 -20
  33. data/examples/api-samples/samples/sample11.rb +18 -18
  34. data/examples/api-samples/samples/sample12.rb +3 -3
  35. data/examples/api-samples/samples/sample13.rb +4 -4
  36. data/examples/api-samples/samples/sample14.rb +4 -4
  37. data/examples/api-samples/samples/sample15.rb +3 -3
  38. data/examples/api-samples/samples/sample16.rb +2 -2
  39. data/examples/api-samples/samples/sample17.rb +2 -2
  40. data/examples/api-samples/samples/sample18.rb +90 -106
  41. data/examples/api-samples/samples/sample19.rb +5 -5
  42. data/examples/api-samples/samples/sample2.rb +4 -4
  43. data/examples/api-samples/samples/sample20.rb +4 -4
  44. data/examples/api-samples/samples/sample21.rb +4 -4
  45. data/examples/api-samples/samples/sample22.rb +2 -2
  46. data/examples/api-samples/samples/sample23.rb +0 -0
  47. data/examples/api-samples/samples/sample24.rb +0 -0
  48. data/examples/api-samples/samples/sample25.rb +96 -0
  49. data/examples/api-samples/samples/sample3.rb +3 -3
  50. data/examples/api-samples/samples/sample4.rb +23 -12
  51. data/examples/api-samples/samples/sample5.rb +23 -16
  52. data/examples/api-samples/samples/sample6.rb +8 -8
  53. data/examples/api-samples/samples/sample7.rb +7 -7
  54. data/examples/api-samples/samples/sample8.rb +29 -21
  55. data/examples/api-samples/samples/sample9.rb +23 -5
  56. data/examples/api-samples/views/_others_samples.haml +57 -0
  57. data/examples/api-samples/views/annotation_sample.haml +30 -30
  58. data/examples/api-samples/views/envelope_sample.haml +31 -31
  59. data/examples/api-samples/views/index.haml +33 -25
  60. data/examples/api-samples/views/sample1.haml +22 -69
  61. data/examples/api-samples/views/sample10.haml +57 -73
  62. data/examples/api-samples/views/sample11.haml +31 -79
  63. data/examples/api-samples/views/sample12.haml +18 -66
  64. data/examples/api-samples/views/sample13.haml +21 -70
  65. data/examples/api-samples/views/sample14.haml +18 -67
  66. data/examples/api-samples/views/sample15.haml +15 -63
  67. data/examples/api-samples/views/sample16.haml +13 -61
  68. data/examples/api-samples/views/sample17.haml +19 -67
  69. data/examples/api-samples/views/sample18.haml +74 -159
  70. data/examples/api-samples/views/sample19.haml +25 -74
  71. data/examples/api-samples/views/sample2.haml +19 -66
  72. data/examples/api-samples/views/sample20.haml +19 -68
  73. data/examples/api-samples/views/sample21.haml +28 -76
  74. data/examples/api-samples/views/sample22.haml +29 -77
  75. data/examples/api-samples/views/sample23.haml +0 -0
  76. data/examples/api-samples/views/sample24.haml +0 -0
  77. data/examples/api-samples/views/sample25.haml +91 -0
  78. data/examples/api-samples/views/sample3.haml +20 -68
  79. data/examples/api-samples/views/sample4.haml +53 -68
  80. data/examples/api-samples/views/sample5.haml +54 -70
  81. data/examples/api-samples/views/sample6.haml +21 -69
  82. data/examples/api-samples/views/sample7.haml +19 -66
  83. data/examples/api-samples/views/sample8.haml +60 -75
  84. data/examples/api-samples/views/sample9.haml +54 -70
  85. data/examples/api-samples/web.rb +20 -0
  86. data/lib/groupdocs/api/request.rb +4 -2
  87. data/lib/groupdocs/version.rb +1 -1
  88. data/spec/groupdocs/api/request_spec.rb +10 -2
  89. metadata +18 -5
  90. data/examples/api-samples/app.rb +0 -15
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html> <html> <head> <title>sample21.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="annotation-sample.html"> annotation-sample.rb </a> <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="sample19.html"> sample19.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample20.html"> sample20.rb </a> <a class="source" href="sample21.html"> sample21.rb </a> <a class="source" href="sample22.html"> sample22.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> sample21.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;/sample21&#39;</span> <span class="k">do</span>
2
+ <span class="n">haml</span> <span class="ss">:sample21</span>
3
+ <span class="k">end</span>
4
+
5
+
6
+ <span class="n">post</span> <span class="s1">&#39;/sample21&#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">:email</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:email</span><span class="o">]</span>
11
+ <span class="n">set</span> <span class="ss">:name</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:name</span><span class="o">]</span>
12
+ <span class="n">set</span> <span class="ss">:lastName</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:lastName</span><span class="o">]</span>
13
+ <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>
14
+
15
+ <span class="k">begin</span>
16
+
17
+
18
+ <span class="k">raise</span> <span class="s1">&#39;Please enter all required parameters&#39;</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">email</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">name</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">lastName</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>
19
+
20
+
21
+ <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>
22
+
23
+ <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>
24
+
25
+ <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>
26
+
27
+
28
+ <span class="n">envelope</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="no">Envelope</span><span class="o">.</span><span class="n">new</span>
29
+ <span class="n">envelope</span><span class="o">.</span><span class="n">name</span> <span class="o">=</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>
30
+ <span class="n">envelope</span><span class="o">.</span><span class="n">email_subject</span> <span class="o">=</span> <span class="s1">&#39;Sing this!&#39;</span>
31
+ <span class="n">envelope</span><span class="o">.</span><span class="n">create!</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>
32
+
33
+
34
+ <span class="n">envelope</span><span class="o">.</span><span class="n">add_document!</span><span class="p">(</span><span class="n">file</span><span class="o">.</span><span class="n">to_document</span><span class="p">,</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>
35
+
36
+
37
+ <span class="n">roles</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="no">Role</span><span class="o">.</span><span class="n">get!</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>
38
+
39
+
40
+ <span class="n">recipient</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="no">Recipient</span><span class="o">.</span><span class="n">new</span>
41
+ <span class="n">recipient</span><span class="o">.</span><span class="n">email</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">email</span>
42
+ <span class="n">recipient</span><span class="o">.</span><span class="n">first_name</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">name</span>
43
+ <span class="n">recipient</span><span class="o">.</span><span class="n">last_name</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">lastName</span>
44
+ <span class="n">recipient</span><span class="o">.</span><span class="n">role_id</span> <span class="o">=</span> <span class="n">roles</span><span class="o">.</span><span class="n">detect</span> <span class="p">{</span> <span class="o">|</span><span class="n">role</span><span class="o">|</span> <span class="n">role</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s1">&#39;Signer&#39;</span> <span class="p">}</span><span class="o">.</span><span class="n">id</span>
45
+
46
+
47
+ <span class="n">add</span> <span class="o">=</span> <span class="n">envelope</span><span class="o">.</span><span class="n">add_recipient!</span><span class="p">(</span><span class="n">recipient</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>
48
+
49
+
50
+ <span class="n">recipient_id</span> <span class="o">=</span> <span class="n">add</span><span class="o">[</span><span class="ss">:recipient</span><span class="o">][</span><span class="ss">:id</span><span class="o">]</span>
51
+
52
+
53
+ <span class="n">envelope</span><span class="o">.</span><span class="n">send!</span><span class="p">(</span><span class="kp">nil</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>
54
+
55
+
56
+ <span class="n">iframe</span> <span class="o">=</span> <span class="s2">&quot;&lt;iframe src=&#39;https://apps.groupdocs.com/signature/signembed/</span><span class="si">#{</span><span class="n">envelope</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">/</span><span class="si">#{</span><span class="n">recipient_id</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>
57
+
58
+ <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
59
+ <span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
60
+ <span class="k">end</span>
61
+
62
+
63
+ <span class="n">haml</span> <span class="ss">:sample21</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">: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">:name</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="ss">:lastName</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">lastName</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>
64
+ <span class="k">end</span>
65
+
66
+ </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -0,0 +1,53 @@
1
+ <!DOCTYPE html> <html> <head> <title>sample22.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="annotation-sample.html"> annotation-sample.rb </a> <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="sample19.html"> sample19.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample20.html"> sample20.rb </a> <a class="source" href="sample21.html"> sample21.rb </a> <a class="source" href="sample22.html"> sample22.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> sample22.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;/sample22&#39;</span> <span class="k">do</span>
2
+ <span class="n">haml</span> <span class="ss">:sample22</span>
3
+ <span class="k">end</span>
4
+
5
+
6
+ <span class="n">post</span> <span class="s1">&#39;/sample22&#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">:fileId</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
+ <span class="n">set</span> <span class="ss">:first_name</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:first_name</span><span class="o">]</span>
13
+ <span class="n">set</span> <span class="ss">:last_name</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:last_name</span><span class="o">]</span>
14
+
15
+ <span class="k">begin</span>
16
+
17
+
18
+ <span class="k">raise</span> <span class="s1">&#39;Please enter all required parameters&#39;</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">fileId</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> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">first_name</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">last_name</span><span class="o">.</span><span class="n">empty?</span>
19
+
20
+
21
+ <span class="n">user</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:User</span><span class="o">.</span><span class="n">new</span>
22
+ <span class="n">user</span><span class="o">.</span><span class="n">primary_email</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">email</span>
23
+ <span class="n">user</span><span class="o">.</span><span class="n">nickname</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">first_name</span>
24
+ <span class="n">user</span><span class="o">.</span><span class="n">first_name</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">first_name</span>
25
+ <span class="n">user</span><span class="o">.</span><span class="n">last_name</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">last_name</span>
26
+
27
+
28
+ <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:User</span><span class="o">.</span><span class="n">update_account!</span><span class="p">(</span><span class="n">user</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>
29
+
30
+
31
+ <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">new</span><span class="p">(</span><span class="ss">guid</span><span class="p">:</span> <span class="n">settings</span><span class="o">.</span><span class="n">fileId</span><span class="p">)</span>
32
+
33
+
34
+ <span class="n">document</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">new</span><span class="p">(</span><span class="ss">file</span><span class="p">:</span> <span class="n">file</span><span class="p">)</span>
35
+
36
+
37
+ <span class="n">document</span><span class="o">.</span><span class="n">set_collaborators!</span><span class="p">(</span><span class="o">[</span><span class="n">settings</span><span class="o">.</span><span class="n">email</span><span class="o">]</span><span class="p">,</span> <span class="mi">2</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">collaborations</span> <span class="o">=</span> <span class="n">document</span><span class="o">.</span><span class="n">collaborators!</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>
41
+
42
+
43
+ <span class="n">document</span><span class="o">.</span><span class="n">set_reviewers!</span><span class="p">(</span><span class="n">collaborations</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>
44
+
45
+ <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
46
+ <span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
47
+ <span class="k">end</span>
48
+
49
+
50
+ <span class="n">haml</span> <span class="ss">:sample22</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">fileId</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">:first_name</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">first_name</span><span class="p">,</span> <span class="ss">:last_name</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">last_name</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span><span class="p">}</span>
51
+ <span class="k">end</span>
52
+
53
+ </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -1,4 +1,4 @@
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>
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="annotation-sample.html"> annotation-sample.rb </a> <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="sample19.html"> sample19.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample20.html"> sample20.rb </a> <a class="source" href="sample21.html"> sample21.rb </a> <a class="source" href="sample22.html"> sample22.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
2
  <span class="n">haml</span> <span class="ss">:sample3</span>
3
3
  <span class="k">end</span>
4
4
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  <span class="k">begin</span>
12
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>
13
+ <span class="k">raise</span> <span class="s1">&#39;Please enter all required parameters&#39;</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
14
 
15
15
 
16
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>
@@ -22,13 +22,13 @@
22
22
 
23
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
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
-
25
+
26
26
  <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
27
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
28
  <span class="k">end</span>
29
29
 
30
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>
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
32
  <span class="k">end</span>
33
33
 
34
34
  </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -1,4 +1,4 @@
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>
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="annotation-sample.html"> annotation-sample.rb </a> <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="sample19.html"> sample19.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample20.html"> sample20.rb </a> <a class="source" href="sample21.html"> sample21.rb </a> <a class="source" href="sample22.html"> sample22.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
2
  <span class="n">haml</span> <span class="ss">:sample4</span>
3
3
  <span class="k">end</span>
4
4
 
@@ -8,24 +8,35 @@
8
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
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
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">:source</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:source</span><span class="o">]</span>
12
+ <span class="n">set</span> <span class="ss">:url</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:url</span><span class="o">]</span>
11
13
 
12
14
  <span class="k">begin</span>
13
15
 
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>
16
+ <span class="k">raise</span> <span class="s1">&#39;Please enter all required parameters&#39;</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>
17
+
18
+
19
+ <span class="n">file</span> <span class="o">=</span> <span class="kp">nil</span>
20
+ <span class="k">case</span> <span class="n">settings</span><span class="o">.</span><span class="n">source</span>
21
+ <span class="k">when</span> <span class="s1">&#39;guid&#39;</span>
22
+ <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">new</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">file_id</span><span class="p">})</span>
23
+ <span class="k">when</span> <span class="s1">&#39;local&#39;</span>
24
+
25
+ <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>
26
+
27
+ <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>
28
+
29
+ <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>
30
+ <span class="k">when</span> <span class="s1">&#39;url&#39;</span>
31
+ <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_web!</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">url</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>
32
+ <span class="k">else</span>
33
+ <span class="k">raise</span> <span class="s1">&#39;Wrong GUID source.&#39;</span>
25
34
  <span class="k">end</span>
26
35
 
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>
36
+ <span class="n">pp</span> <span class="n">file</span>
37
+ <span class="n">pp</span> <span class="n">file</span><span class="o">.</span><span class="n">name</span>
38
+
39
+ <span class="n">dowloaded_file</span> <span class="o">=</span> <span class="n">file</span><span class="o">.</span><span class="n">download!</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">#{</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="si">}</span><span class="s2">/../public/downloads&quot;</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
40
  <span class="k">unless</span> <span class="n">dowloaded_file</span><span class="o">.</span><span class="n">empty?</span>
30
41
  <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
42
  <span class="k">end</span>
@@ -34,8 +45,8 @@
34
45
  <span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
35
46
  <span class="k">end</span>
36
47
 
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>
48
+
49
+ <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
50
  <span class="k">end</span>
40
51
 
41
52
  </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -1,4 +1,4 @@
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>
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="annotation-sample.html"> annotation-sample.rb </a> <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="sample19.html"> sample19.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample20.html"> sample20.rb </a> <a class="source" href="sample21.html"> sample21.rb </a> <a class="source" href="sample22.html"> sample22.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
2
  <span class="n">haml</span> <span class="ss">:sample5</span>
3
3
  <span class="k">end</span>
4
4
 
@@ -8,49 +8,56 @@
8
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
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
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">:url</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:url</span><span class="o">]</span>
11
12
  <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
13
  <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
14
  <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
+
15
16
  <span class="k">begin</span>
16
17
 
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>
18
+ <span class="k">raise</span> <span class="s1">&#39;Please enter all required parameters&#39;</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>
19
+
20
+ <span class="n">file</span> <span class="o">=</span> <span class="kp">nil</span>
21
+
22
+ <span class="k">case</span> <span class="n">settings</span><span class="o">.</span><span class="n">source</span>
23
+ <span class="k">when</span> <span class="s1">&#39;guid&#39;</span>
24
+ <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">new</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">file_id</span><span class="p">})</span>
25
+ <span class="k">when</span> <span class="s1">&#39;local&#39;</span>
26
+
27
+ <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>
28
+
29
+ <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>
30
+
31
+ <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>
32
+ <span class="k">when</span> <span class="s1">&#39;url&#39;</span>
33
+ <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_web!</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">url</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>
34
+ <span class="k">else</span>
35
+ <span class="k">raise</span> <span class="s1">&#39;Wrong GUID source.&#39;</span>
28
36
  <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
37
 
31
-
38
+
32
39
  <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>
40
+ <span class="n">file</span> <span class="o">=</span> <span class="n">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
41
  <span class="n">button</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">copy</span>
35
42
  <span class="k">end</span>
36
43
 
37
-
44
+
38
45
  <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>
46
+ <span class="n">file</span> <span class="o">=</span> <span class="n">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
47
  <span class="n">button</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">move</span>
41
48
  <span class="k">end</span>
42
49
 
43
-
50
+
44
51
  <span class="k">if</span> <span class="n">file</span>
45
52
  <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
53
  <span class="k">end</span>
47
-
54
+
48
55
  <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
49
56
  <span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
50
57
  <span class="k">end</span>
51
58
 
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>
59
+
60
+ <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
61
  <span class="k">end</span>
55
62
 
56
63
  </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -1,4 +1,4 @@
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>
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="annotation-sample.html"> annotation-sample.rb </a> <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="sample19.html"> sample19.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample20.html"> sample20.rb </a> <a class="source" href="sample21.html"> sample21.rb </a> <a class="source" href="sample22.html"> sample22.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
2
  <span class="n">haml</span> <span class="ss">:sample6</span>
3
3
  <span class="k">end</span>
4
4
 
@@ -7,10 +7,10 @@
7
7
 
8
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
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
-
10
+
11
11
  <span class="k">begin</span>
12
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>
13
+ <span class="k">raise</span> <span class="s1">&#39;Please enter all required parameters&#39;</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
14
 
15
15
 
16
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>
@@ -26,10 +26,10 @@
26
26
 
27
27
 
28
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>
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
30
 
31
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>
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
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
34
 
35
35
 
@@ -42,7 +42,7 @@
42
42
  <span class="k">end</span>
43
43
 
44
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>
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
46
  <span class="k">end</span>
47
47
 
48
48
  </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -1,4 +1,4 @@
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>
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="annotation-sample.html"> annotation-sample.rb </a> <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="sample19.html"> sample19.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample20.html"> sample20.rb </a> <a class="source" href="sample21.html"> sample21.rb </a> <a class="source" href="sample22.html"> sample22.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
2
  <span class="n">haml</span> <span class="ss">:sample7</span>
3
3
  <span class="k">end</span>
4
4
 
@@ -7,13 +7,13 @@
7
7
 
8
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
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
-
10
+
11
11
  <span class="k">begin</span>
12
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>
13
+ <span class="k">raise</span> <span class="s1">&#39;Please enter all required parameters&#39;</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
14
 
15
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>
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
17
 
18
18
 
19
19
  <span class="n">thumbnails</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
@@ -21,13 +21,13 @@
21
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
22
  <span class="k">next</span>
23
23
  <span class="k">end</span>
24
-
24
+
25
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>
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
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
28
  <span class="k">end</span>
29
29
  <span class="k">end</span>
30
-
30
+
31
31
  <span class="k">unless</span> <span class="n">thumbnails</span><span class="o">.</span><span class="n">empty?</span>
32
32
  <span class="n">set</span> <span class="ss">:thumbnails</span><span class="p">,</span> <span class="n">thumbnails</span>
33
33
  <span class="k">end</span>
@@ -37,7 +37,7 @@
37
37
  <span class="k">end</span>
38
38
 
39
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>
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
41
  <span class="k">end</span>
42
42
 
43
43
  </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -1,4 +1,4 @@
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>
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="annotation-sample.html"> annotation-sample.rb </a> <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="sample19.html"> sample19.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample20.html"> sample20.rb </a> <a class="source" href="sample21.html"> sample21.rb </a> <a class="source" href="sample22.html"> sample22.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
2
  <span class="n">haml</span> <span class="ss">:sample8</span>
3
3
  <span class="k">end</span>
4
4
 
@@ -9,36 +9,44 @@
9
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
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
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
-
12
+
13
13
 
14
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
-
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
17
  <span class="k">begin</span>
18
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>
19
+ <span class="k">raise</span> <span class="s1">&#39;Please enter all required parameters&#39;</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>
23
20
 
21
+ <span class="n">file</span> <span class="o">=</span> <span class="kp">nil</span>
24
22
  <span class="n">doc</span> <span class="o">=</span> <span class="kp">nil</span>
25
23
  <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>
24
+
25
+
26
+ <span class="k">case</span> <span class="n">settings</span><span class="o">.</span><span class="n">source</span>
27
+ <span class="k">when</span> <span class="s1">&#39;guid&#39;</span>
28
+ <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">new</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">file_id</span><span class="p">})</span>
29
+ <span class="k">when</span> <span class="s1">&#39;local&#39;</span>
30
+
31
+ <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>
32
+
33
+ <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>
34
+
35
+ <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>
36
+ <span class="k">when</span> <span class="s1">&#39;url&#39;</span>
37
+ <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_web!</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">url</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>
38
+ <span class="k">else</span>
39
+ <span class="k">raise</span> <span class="s1">&#39;Wrong GUID source.&#39;</span>
36
40
  <span class="k">end</span>
37
41
 
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>
42
+ <span class="n">doc</span> <span class="o">=</span> <span class="n">file</span><span class="o">.</span><span class="n">to_document</span>
43
+ <span class="n">metadata</span> <span class="o">=</span> <span class="n">doc</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>
44
+
45
+
46
+
47
+ <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
48
 
41
-
49
+
42
50
  <span class="k">unless</span> <span class="n">images</span><span class="o">.</span><span class="n">empty?</span>
43
51
  <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
52
  <span class="k">end</span>
@@ -47,8 +55,8 @@
47
55
  <span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
48
56
  <span class="k">end</span>
49
57
 
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>
58
+
59
+ <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
60
  <span class="k">end</span>
53
61
 
54
62
  </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>