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
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html> <html> <head> <title>sample13.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample13.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample13&#39;</span> <span class="k">do</span>
1
+ <!DOCTYPE html> <html> <head> <title>sample13.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="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> sample13.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample13&#39;</span> <span class="k">do</span>
2
2
  <span class="n">haml</span> <span class="ss">:sample13</span>
3
3
  <span class="k">end</span>
4
4
 
@@ -12,10 +12,10 @@
12
12
 
13
13
  <span class="k">begin</span>
14
14
 
15
- <span class="k">raise</span> <span class="s2">&quot;Please enter all required parameters&quot;</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">file_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">email</span><span class="o">.</span><span class="n">empty?</span>
15
+ <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> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">email</span><span class="o">.</span><span class="n">empty?</span>
16
16
 
17
17
 
18
- <span class="n">files_list</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">Folder</span><span class="o">.</span><span class="n">list!</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
18
+ <span class="n">files_list</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">Folder</span><span class="o">.</span><span class="n">list!</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span><span class="ss">:client_id</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
19
19
  <span class="n">document</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
20
20
 
21
21
 
@@ -27,7 +27,7 @@
27
27
 
28
28
  <span class="k">unless</span> <span class="n">document</span><span class="o">.</span><span class="n">instance_of?</span> <span class="nb">String</span>
29
29
 
30
- <span class="n">result</span> <span class="o">=</span> <span class="n">document</span><span class="o">.</span><span class="n">to_document</span><span class="o">.</span><span class="n">set_collaborators!</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">email</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot; &quot;</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="p">{</span><span class="ss">:client_id</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
30
+ <span class="n">result</span> <span class="o">=</span> <span class="n">document</span><span class="o">.</span><span class="n">to_document</span><span class="o">.</span><span class="n">set_collaborators!</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">email</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39; &#39;</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="p">{</span><span class="ss">:client_id</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
31
31
  <span class="k">end</span>
32
32
 
33
33
  <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
@@ -35,7 +35,7 @@
35
35
  <span class="k">end</span>
36
36
 
37
37
 
38
- <span class="n">haml</span> <span class="ss">:sample13</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=&gt;</span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:fileId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">file_id</span><span class="p">,</span> <span class="ss">:email</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">email</span><span class="p">,</span> <span class="ss">:result</span> <span class="o">=&gt;</span> <span class="n">result</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span> <span class="p">}</span>
38
+ <span class="n">haml</span> <span class="ss">:sample13</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=&gt;</span> <span class="p">{</span><span class="ss">:userId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:fileId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">file_id</span><span class="p">,</span> <span class="ss">:email</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">email</span><span class="p">,</span> <span class="ss">:result</span> <span class="o">=&gt;</span> <span class="n">result</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span><span class="p">}</span>
39
39
  <span class="k">end</span>
40
40
 
41
41
  </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html> <html> <head> <title>sample14.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample14.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample14&#39;</span> <span class="k">do</span>
1
+ <!DOCTYPE html> <html> <head> <title>sample14.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="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> sample14.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample14&#39;</span> <span class="k">do</span>
2
2
  <span class="n">haml</span> <span class="ss">:sample14</span>
3
3
  <span class="k">end</span>
4
4
 
@@ -11,20 +11,20 @@
11
11
 
12
12
  <span class="k">begin</span>
13
13
 
14
- <span class="k">raise</span> <span class="s2">&quot;Please enter all required parameters&quot;</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">folder</span><span class="o">.</span><span class="n">empty?</span>
14
+ <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">folder</span><span class="o">.</span><span class="n">empty?</span>
15
15
 
16
16
 
17
- <span class="n">files_list</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">Folder</span><span class="o">.</span><span class="n">list!</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">folder</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
17
+ <span class="n">files_list</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">Folder</span><span class="o">.</span><span class="n">list!</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">folder</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span><span class="ss">:client_id</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
18
18
 
19
19
 
20
- <span class="n">shares</span> <span class="o">=</span> <span class="n">files_list</span><span class="o">.</span><span class="n">first</span><span class="o">.</span><span class="n">sharers!</span><span class="p">({</span><span class="ss">:client_id</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
20
+ <span class="n">shares</span> <span class="o">=</span> <span class="n">files_list</span><span class="o">.</span><span class="n">first</span><span class="o">.</span><span class="n">sharers!</span><span class="p">({</span><span class="ss">:client_id</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
21
21
 
22
22
  <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
23
23
  <span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
24
24
  <span class="k">end</span>
25
25
 
26
26
 
27
- <span class="n">haml</span> <span class="ss">:sample14</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=&gt;</span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:folder</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">folder</span><span class="p">,</span> <span class="ss">:shares</span> <span class="o">=&gt;</span> <span class="n">shares</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span> <span class="p">}</span>
27
+ <span class="n">haml</span> <span class="ss">:sample14</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=&gt;</span> <span class="p">{</span><span class="ss">:userId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:folder</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">folder</span><span class="p">,</span> <span class="ss">:shares</span> <span class="o">=&gt;</span> <span class="n">shares</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span><span class="p">}</span>
28
28
  <span class="k">end</span>
29
29
 
30
30
  </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html> <html> <head> <title>sample15.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample15.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample15&#39;</span> <span class="k">do</span>
1
+ <!DOCTYPE html> <html> <head> <title>sample15.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="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> sample15.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample15&#39;</span> <span class="k">do</span>
2
2
  <span class="n">haml</span> <span class="ss">:sample15</span>
3
3
  <span class="k">end</span>
4
4
 
@@ -10,10 +10,10 @@
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">views</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Document</span><span class="o">.</span><span class="n">views!</span><span class="p">({},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
16
+ <span class="n">views</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Document</span><span class="o">.</span><span class="n">views!</span><span class="p">({},</span> <span class="p">{</span><span class="ss">:client_id</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
17
17
  <span class="n">total</span> <span class="o">=</span> <span class="n">views</span><span class="o">.</span><span class="n">count</span><span class="p">()</span>
18
18
 
19
19
  <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
@@ -21,7 +21,7 @@
21
21
  <span class="k">end</span>
22
22
 
23
23
 
24
- <span class="n">haml</span> <span class="ss">:sample15</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=&gt;</span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:total</span> <span class="o">=&gt;</span> <span class="n">total</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span> <span class="p">}</span>
24
+ <span class="n">haml</span> <span class="ss">:sample15</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=&gt;</span> <span class="p">{</span><span class="ss">:userId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:total</span> <span class="o">=&gt;</span> <span class="n">total</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span><span class="p">}</span>
25
25
  <span class="k">end</span>
26
26
 
27
27
  </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html> <html> <head> <title>sample16.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample16.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample16&#39;</span> <span class="k">do</span>
1
+ <!DOCTYPE html> <html> <head> <title>sample16.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="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> sample16.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample16&#39;</span> <span class="k">do</span>
2
2
  <span class="n">haml</span> <span class="ss">:sample16</span>
3
3
  <span class="k">end</span>
4
4
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  <span class="k">begin</span>
11
11
 
12
- <span class="k">raise</span> <span class="s2">&quot;Please enter all required parameters&quot;</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">fileId</span><span class="o">.</span><span class="n">empty?</span>
12
+ <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">fileId</span><span class="o">.</span><span class="n">empty?</span>
13
13
 
14
14
 
15
15
  <span class="n">iframe</span> <span class="o">=</span> <span class="s2">&quot;&lt;iframe src=&#39;https://apps.groupdocs.com/assembly2/questionnaire-assembly/</span><span class="si">#{</span><span class="n">settings</span><span class="o">.</span><span class="n">fileId</span><span class="si">}</span><span class="s2">&#39; frameborder=&#39;0&#39; width=&#39;100%&#39; height=&#39;600&#39;&gt;&lt;/iframe&gt;&quot;</span>
@@ -19,7 +19,7 @@
19
19
  <span class="k">end</span>
20
20
 
21
21
 
22
- <span class="n">haml</span> <span class="ss">:sample16</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=&gt;</span> <span class="p">{</span> <span class="ss">:fileId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">fileId</span><span class="p">,</span> <span class="ss">:iframe</span> <span class="o">=&gt;</span> <span class="n">iframe</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span> <span class="p">}</span>
22
+ <span class="n">haml</span> <span class="ss">:sample16</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=&gt;</span> <span class="p">{</span><span class="ss">:fileId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">fileId</span><span class="p">,</span> <span class="ss">:iframe</span> <span class="o">=&gt;</span> <span class="n">iframe</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span><span class="p">}</span>
23
23
  <span class="k">end</span>
24
24
 
25
25
  </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html> <html> <head> <title>sample17.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample17.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample17&#39;</span> <span class="k">do</span>
1
+ <!DOCTYPE html> <html> <head> <title>sample17.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="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> sample17.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample17&#39;</span> <span class="k">do</span>
2
2
  <span class="n">haml</span> <span class="ss">:sample17</span>
3
3
  <span class="k">end</span>
4
4
 
@@ -11,7 +11,7 @@
11
11
 
12
12
  <span class="k">begin</span>
13
13
 
14
- <span class="k">raise</span> <span class="s2">&quot;Please enter all required parameters&quot;</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">file</span><span class="o">.</span><span class="n">nil?</span>
14
+ <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</span><span class="o">.</span><span class="n">nil?</span>
15
15
 
16
16
 
17
17
  <span class="n">filepath</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="si">#{</span><span class="no">Dir</span><span class="o">.</span><span class="n">tmpdir</span><span class="si">}</span><span class="s2">/</span><span class="si">#{</span><span class="n">params</span><span class="o">[</span><span class="ss">:file</span><span class="o">][</span><span class="ss">:filename</span><span class="o">]</span><span class="si">}</span><span class="s2">&quot;</span>
@@ -31,7 +31,7 @@
31
31
  <span class="k">end</span>
32
32
 
33
33
 
34
- <span class="n">haml</span> <span class="ss">:sample17</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=&gt;</span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:iframe</span><span class="o">=&gt;</span><span class="n">iframe</span><span class="p">,</span> <span class="ss">:massage</span> <span class="o">=&gt;</span> <span class="n">massage</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span> <span class="p">}</span>
34
+ <span class="n">haml</span> <span class="ss">:sample17</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=&gt;</span> <span class="p">{</span><span class="ss">:userId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:iframe</span> <span class="o">=&gt;</span> <span class="n">iframe</span><span class="p">,</span> <span class="ss">:massage</span> <span class="o">=&gt;</span> <span class="n">massage</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span><span class="p">}</span>
35
35
  <span class="k">end</span>
36
36
 
37
37
  </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -1,62 +1,157 @@
1
- <!DOCTYPE html> <html> <head> <title>sample18.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample18.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample18&#39;</span> <span class="k">do</span>
1
+ <!DOCTYPE html> <html> <head> <title>sample18.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="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> sample18.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample18&#39;</span> <span class="k">do</span>
2
2
  <span class="n">haml</span> <span class="ss">:sample18</span>
3
3
  <span class="k">end</span>
4
4
 
5
5
 
6
+ <span class="n">post</span> <span class="s1">&#39;/sample18/convert_callback&#39;</span> <span class="k">do</span>
7
+
8
+ <span class="n">downloads_path</span> <span class="o">=</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>
9
+
10
+
11
+ <span class="n">data</span> <span class="o">=</span> <span class="no">JSON</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">body</span><span class="o">.</span><span class="n">read</span><span class="p">)</span>
12
+ <span class="k">begin</span>
13
+ <span class="k">raise</span> <span class="s1">&#39;Empty params!&#39;</span> <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">empty?</span>
14
+ <span class="n">source_id</span> <span class="o">=</span> <span class="kp">nil</span>
15
+ <span class="n">client_key</span> <span class="o">=</span> <span class="kp">nil</span>
16
+ <span class="n">private_key</span> <span class="o">=</span> <span class="kp">nil</span>
17
+
18
+
19
+ <span class="n">data</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="o">|</span>
20
+ <span class="k">if</span> <span class="n">key</span> <span class="o">==</span> <span class="s1">&#39;SourceId&#39;</span>
21
+ <span class="n">source_id</span> <span class="o">=</span> <span class="n">value</span>
22
+ <span class="k">end</span>
23
+ <span class="k">end</span>
24
+
25
+
26
+ <span class="k">if</span> <span class="no">File</span><span class="o">.</span><span class="n">exist?</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/user_info.txt&quot;</span><span class="p">)</span>
27
+ <span class="n">contents</span> <span class="o">=</span> <span class="no">File</span><span class="o">.</span><span class="n">read</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/user_info.txt&quot;</span><span class="p">)</span>
28
+ <span class="n">contents</span> <span class="o">=</span> <span class="n">contents</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39; &#39;</span><span class="p">)</span>
29
+ <span class="n">client_key</span> <span class="o">=</span> <span class="n">contents</span><span class="o">.</span><span class="n">first</span>
30
+ <span class="n">private_key</span> <span class="o">=</span> <span class="n">contents</span><span class="o">.</span><span class="n">last</span>
31
+ <span class="k">end</span>
32
+
33
+
34
+ <span class="n">job</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Job</span><span class="o">.</span><span class="n">new</span><span class="p">({</span><span class="ss">:id</span> <span class="o">=&gt;</span> <span class="n">source_id</span><span class="p">})</span>
35
+
36
+
37
+ <span class="n">documents</span> <span class="o">=</span> <span class="n">job</span><span class="o">.</span><span class="n">documents!</span><span class="p">({</span><span class="ss">:client_id</span> <span class="o">=&gt;</span> <span class="n">client_key</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=&gt;</span> <span class="n">private_key</span><span class="p">})</span>
38
+
39
+
40
+ <span class="n">documents</span><span class="o">[</span><span class="ss">:inputs</span><span class="o">].</span><span class="n">first</span><span class="o">.</span><span class="n">outputs</span><span class="o">.</span><span class="n">first</span><span class="o">.</span><span class="n">download!</span><span class="p">(</span><span class="n">downloads_path</span><span class="p">,</span> <span class="p">{</span><span class="ss">:client_id</span> <span class="o">=&gt;</span> <span class="n">client_key</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=&gt;</span> <span class="n">private_key</span><span class="p">})</span>
41
+
42
+ <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
43
+ <span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
44
+ <span class="k">end</span>
45
+ <span class="k">end</span>
46
+
47
+
48
+
49
+ <span class="n">get</span> <span class="s1">&#39;/sample18/check&#39;</span> <span class="k">do</span>
50
+
51
+
52
+ <span class="k">unless</span> <span class="no">File</span><span class="o">.</span><span class="n">directory?</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>
53
+ <span class="k">return</span> <span class="s1">&#39;Directory was not found.&#39;</span>
54
+ <span class="k">end</span>
55
+
56
+
57
+ <span class="nb">name</span> <span class="o">=</span> <span class="kp">nil</span>
58
+ <span class="no">Dir</span><span class="o">.</span><span class="n">entries</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="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">file</span><span class="o">|</span>
59
+ <span class="nb">name</span> <span class="o">=</span> <span class="n">file</span> <span class="k">if</span> <span class="n">file</span> <span class="o">!=</span> <span class="s1">&#39;.&#39;</span> <span class="o">&amp;&amp;</span> <span class="n">file</span> <span class="o">!=</span> <span class="s1">&#39;..&#39;</span>
60
+ <span class="k">end</span>
61
+
62
+ <span class="nb">name</span>
63
+ <span class="k">end</span>
64
+
65
+
66
+ <span class="n">get</span> <span class="s1">&#39;/sample18/downloads/:filename&#39;</span> <span class="k">do</span> <span class="o">|</span><span class="n">filename</span><span class="o">|</span>
67
+
68
+ <span class="n">send_file</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/</span><span class="si">#{</span><span class="n">filename</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="ss">:filename</span> <span class="o">=&gt;</span> <span class="n">filename</span><span class="p">,</span> <span class="ss">:type</span> <span class="o">=&gt;</span> <span class="s1">&#39;Application/octet-stream&#39;</span>
69
+ <span class="k">end</span>
70
+
71
+
72
+
6
73
  <span class="n">post</span> <span class="s1">&#39;/sample18&#39;</span> <span class="k">do</span>
7
-
74
+
8
75
  <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
76
  <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>
77
+ <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>
10
78
  <span class="n">set</span> <span class="ss">:file_id</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:fileId</span><span class="o">]</span>
79
+ <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
80
  <span class="n">set</span> <span class="ss">:convert_type</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:convert_type</span><span class="o">]</span>
81
+ <span class="n">set</span> <span class="ss">:callback</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:callback</span><span class="o">]</span>
12
82
 
13
- <span class="k">begin</span>
14
-
15
- <span class="k">raise</span> <span class="s2">&quot;Please enter all required parameters&quot;</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">file_id</span><span class="o">.</span><span class="n">empty?</span>
83
+
84
+ <span class="n">downloads_path</span> <span class="o">=</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>
16
85
 
17
-
18
- <span class="n">files_list</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">Folder</span><span class="o">.</span><span class="n">list!</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span> <span class="ss">:client_id</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
19
- <span class="n">document</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
86
+
87
+ <span class="k">if</span> <span class="no">File</span><span class="o">.</span><span class="n">directory?</span><span class="p">(</span><span class="n">downloads_path</span><span class="p">)</span>
88
+ <span class="no">Dir</span><span class="o">.</span><span class="n">foreach</span><span class="p">(</span><span class="n">downloads_path</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">fn</span> <span class="o">=</span> <span class="no">File</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">downloads_path</span><span class="p">,</span> <span class="n">f</span><span class="p">);</span> <span class="no">File</span><span class="o">.</span><span class="n">delete</span><span class="p">(</span><span class="n">fn</span><span class="p">)</span> <span class="k">if</span> <span class="n">f</span> <span class="o">!=</span> <span class="s1">&#39;.&#39;</span> <span class="o">&amp;&amp;</span> <span class="n">f</span> <span class="o">!=</span> <span class="s1">&#39;..&#39;</span> <span class="p">}</span>
89
+ <span class="k">else</span>
90
+ <span class="ss">Dir</span><span class="p">:</span><span class="ss">:mkdir</span><span class="p">(</span><span class="n">downloads_path</span><span class="p">)</span>
91
+ <span class="k">end</span>
20
92
 
21
-
22
- <span class="n">files_list</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">element</span><span class="o">|</span>
23
- <span class="k">if</span> <span class="n">element</span><span class="o">.</span><span class="n">respond_to?</span><span class="p">(</span><span class="s1">&#39;guid&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="kp">true</span> <span class="ow">and</span> <span class="n">element</span><span class="o">.</span><span class="n">guid</span> <span class="o">==</span> <span class="n">settings</span><span class="o">.</span><span class="n">file_id</span>
24
- <span class="n">document</span> <span class="o">=</span> <span class="n">element</span>
25
- <span class="k">end</span>
93
+ <span class="k">begin</span>
94
+
95
+ <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>
96
+
97
+
98
+ <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">callback</span><span class="o">[</span><span class="mi">0</span><span class="o">]</span>
99
+ <span class="n">out_file</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="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/user_info.txt&quot;</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span><span class="p">)</span>
100
+ <span class="n">out_file</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">#{</span><span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
101
+ <span class="n">out_file</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">#{</span><span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
102
+ <span class="n">out_file</span><span class="o">.</span><span class="n">close</span>
26
103
  <span class="k">end</span>
27
104
 
28
- <span class="n">message</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span>
29
- <span class="k">unless</span> <span class="n">document</span><span class="o">.</span><span class="n">instance_of?</span> <span class="nb">String</span>
105
+ <span class="n">file</span> <span class="o">=</span> <span class="kp">nil</span>
106
+
107
+
108
+ <span class="k">case</span> <span class="n">settings</span><span class="o">.</span><span class="n">source</span>
109
+ <span class="k">when</span> <span class="s1">&#39;guid&#39;</span>
110
+
111
+ <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>
112
+ <span class="k">when</span> <span class="s1">&#39;local&#39;</span>
113
+
114
+ <span class="n">file_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">:file</span><span class="o">][</span><span class="ss">:filename</span><span class="o">]</span><span class="si">}</span><span class="s2">&quot;</span>
115
+
116
+ <span class="no">File</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">file_path</span><span class="p">,</span> <span class="s1">&#39;wb&#39;</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">f</span><span class="o">|</span> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">params</span><span class="o">[</span><span class="ss">: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>
117
+
118
+ <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">file_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>
119
+ <span class="k">when</span> <span class="s1">&#39;url&#39;</span>
120
+
121
+ <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="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>
122
+ <span class="k">else</span>
123
+ <span class="k">raise</span> <span class="s1">&#39;Wrong GUID source.&#39;</span>
124
+ <span class="k">end</span>
30
125
 
31
-
32
- <span class="n">convert</span> <span class="o">=</span> <span class="n">document</span><span class="o">.</span><span class="n">to_document</span><span class="o">.</span><span class="n">convert!</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">convert_type</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span><span class="ss">:client_id</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
33
- <span class="nb">sleep</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
126
+
127
+ <span class="k">raise</span> <span class="s1">&#39;No such file&#39;</span> <span class="k">unless</span> <span class="n">file</span><span class="o">.</span><span class="n">is_a?</span><span class="p">(</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="p">)</span>
34
128
 
35
- <span class="k">if</span> <span class="n">convert</span><span class="o">.</span><span class="n">instance_of?</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Job</span>
36
-
37
- <span class="n">jobs</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Job</span><span class="o">::</span><span class="n">all!</span><span class="p">({},</span> <span class="p">{</span><span class="ss">:client_id</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
129
+
130
+ <span class="n">document</span> <span class="o">=</span> <span class="n">file</span><span class="o">.</span><span class="n">to_document</span>
131
+
132
+ <span class="n">convert</span> <span class="o">=</span> <span class="n">document</span><span class="o">.</span><span class="n">convert!</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">convert_type</span><span class="p">,</span> <span class="p">{</span><span class="ss">:callback</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">callback</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>
133
+
134
+ <span class="nb">sleep</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
38
135
 
39
-
40
- <span class="n">job</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
41
- <span class="n">jobs</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">element</span><span class="o">|</span>
42
- <span class="k">if</span> <span class="n">element</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="n">convert</span><span class="o">.</span><span class="n">id</span>
43
- <span class="n">job</span> <span class="o">=</span> <span class="n">element</span>
44
- <span class="k">end</span>
45
- <span class="k">end</span>
136
+
137
+ <span class="n">original_document</span> <span class="o">=</span> <span class="n">convert</span><span class="o">.</span><span class="n">documents!</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
138
 
47
- <span class="k">if</span> <span class="n">job</span><span class="o">.</span><span class="n">status</span> <span class="o">==</span> <span class="ss">:archived</span>
48
- <span class="n">message</span> <span class="o">=</span> <span class="s2">&quot;&lt;p&gt;Converted file saved successfully.&quot;</span>
49
- <span class="k">end</span>
139
+
140
+ <span class="n">guid</span> <span class="o">=</span> <span class="n">original_document</span><span class="o">[</span><span class="ss">:inputs</span><span class="o">].</span><span class="n">first</span><span class="o">.</span><span class="n">outputs</span><span class="o">.</span><span class="n">first</span><span class="o">.</span><span class="n">guid</span>
50
141
 
51
- <span class="k">end</span>
142
+
143
+ <span class="k">if</span> <span class="n">guid</span>
144
+ <span class="n">iframe</span> <span class="o">=</span> <span class="s2">&quot;&lt;iframe width=&#39;100%&#39; height=&#39;600&#39; frameborder=&#39;0&#39; src=&#39;https://apps.groupdocs.com/document-viewer/embed/</span><span class="si">#{</span><span class="n">guid</span><span class="si">}</span><span class="s2">&#39;&gt;&lt;/iframe&gt;&quot;</span>
145
+ <span class="k">else</span>
146
+ <span class="k">raise</span> <span class="s1">&#39;File was not converted&#39;</span>
52
147
  <span class="k">end</span>
53
148
 
54
149
  <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
55
150
  <span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
56
151
  <span class="k">end</span>
57
152
 
58
-
59
- <span class="n">haml</span> <span class="ss">:sample18</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=&gt;</span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:fileId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">file_id</span><span class="p">,</span> <span class="ss">:message</span> <span class="o">=&gt;</span> <span class="n">message</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span> <span class="p">}</span>
153
+
154
+ <span class="n">haml</span> <span class="ss">:sample18</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=&gt;</span> <span class="p">{</span><span class="ss">:userId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:callback</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">callback</span><span class="p">,</span> <span class="ss">:fileId</span> <span class="o">=&gt;</span> <span class="n">file</span><span class="p">,</span> <span class="ss">:converted</span> <span class="o">=&gt;</span> <span class="n">guid</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>
60
155
  <span class="k">end</span>
61
156
 
62
157
  </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -0,0 +1,59 @@
1
+ <!DOCTYPE html> <html> <head> <title>sample19.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> sample19.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;/sample19&#39;</span> <span class="k">do</span>
2
+ <span class="n">haml</span> <span class="ss">:sample19</span>
3
+ <span class="k">end</span>
4
+
5
+
6
+ <span class="n">post</span> <span class="s1">&#39;/sample19&#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">:sourceFileId</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:sourceFileId</span><span class="o">]</span>
11
+ <span class="n">set</span> <span class="ss">:targetFileId</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:targetFileId</span><span class="o">]</span>
12
+ <span class="n">set</span> <span class="ss">:callbackUrl</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:callbackUrl</span><span class="o">]</span>
13
+
14
+ <span class="k">begin</span>
15
+
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> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">sourceFileId</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">targetFileId</span><span class="o">.</span><span class="n">empty?</span>
17
+
18
+
19
+ <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>
20
+
21
+ <span class="n">source_document</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
22
+ <span class="n">target_document</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
23
+
24
+
25
+ <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>
26
+ <span class="k">if</span> <span class="n">element</span><span class="o">.</span><span class="n">respond_to?</span><span class="p">(</span><span class="s1">&#39;guid&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="kp">true</span> <span class="ow">and</span> <span class="n">element</span><span class="o">.</span><span class="n">guid</span> <span class="o">==</span> <span class="n">settings</span><span class="o">.</span><span class="n">sourceFileId</span>
27
+ <span class="n">source_document</span> <span class="o">=</span> <span class="n">element</span>
28
+ <span class="k">end</span>
29
+ <span class="k">if</span> <span class="n">element</span><span class="o">.</span><span class="n">respond_to?</span><span class="p">(</span><span class="s1">&#39;guid&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="kp">true</span> <span class="ow">and</span> <span class="n">element</span><span class="o">.</span><span class="n">guid</span> <span class="o">==</span> <span class="n">settings</span><span class="o">.</span><span class="n">targetFileId</span>
30
+ <span class="n">target_document</span> <span class="o">=</span> <span class="n">element</span>
31
+ <span class="k">end</span>
32
+ <span class="k">end</span>
33
+
34
+ <span class="k">unless</span> <span class="n">source_document</span><span class="o">.</span><span class="n">instance_of?</span> <span class="nb">String</span> <span class="ow">and</span> <span class="n">target_document</span><span class="o">.</span><span class="n">instance_of?</span> <span class="nb">String</span>
35
+
36
+ <span class="n">info</span> <span class="o">=</span> <span class="n">source_document</span><span class="o">.</span><span class="n">to_document</span><span class="o">.</span><span class="n">compare!</span><span class="p">(</span><span class="n">target_document</span><span class="o">.</span><span class="n">to_document</span><span class="p">,</span> <span class="p">{</span><span class="ss">:client_id</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
37
+ <span class="nb">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
38
+
39
+
40
+ <span class="n">job</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Job</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="nb">id</span><span class="p">:</span> <span class="n">info</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
41
+
42
+ <span class="n">documents</span> <span class="o">=</span> <span class="n">job</span><span class="o">.</span><span class="n">documents!</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>
43
+
44
+ <span class="n">guid</span> <span class="o">=</span> <span class="n">documents</span><span class="o">[</span><span class="ss">:outputs</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>
45
+
46
+
47
+ <span class="n">iframe</span> <span class="o">=</span> <span class="s2">&quot;&lt;iframe src=&#39;https://apps.groupdocs.com/document-viewer/embed/</span><span class="si">#{</span><span class="n">guid</span><span class="si">}</span><span class="s2">&#39; frameborder=&#39;0&#39; width=&#39;100%&#39; height=&#39;600&#39;&gt;&lt;/iframe&gt;&quot;</span>
48
+
49
+ <span class="k">end</span>
50
+
51
+ <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
52
+ <span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
53
+ <span class="k">end</span>
54
+
55
+
56
+ <span class="n">haml</span> <span class="ss">:sample19</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">:sourceFileId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">sourceFileId</span><span class="p">,</span> <span class="ss">:targetFileId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">targetFileId</span><span class="p">,</span> <span class="ss">:callbackUrl</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">callbackUrl</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>
57
+ <span class="k">end</span>
58
+
59
+ </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html> <html> <head> <title>sample2.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample2.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample2&#39;</span> <span class="k">do</span>
1
+ <!DOCTYPE html> <html> <head> <title>sample2.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="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> sample2.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">&#39;/sample2&#39;</span> <span class="k">do</span>
2
2
  <span class="n">haml</span> <span class="ss">:sample2</span>
3
3
  <span class="k">end</span>
4
4
 
@@ -10,21 +10,21 @@
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="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="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">filelist</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
20
- <span class="n">files_list</span><span class="o">.</span><span class="n">each</span> <span class="p">{</span><span class="o">|</span><span class="n">element</span><span class="o">|</span> <span class="n">filelist</span> <span class="o">&lt;&lt;</span> <span class="s2">&quot;</span><span class="si">#{</span><span class="n">element</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">&lt;br /&gt;&quot;</span><span class="p">}</span>
20
+ <span class="n">files_list</span><span class="o">.</span><span class="n">each</span> <span class="p">{</span> <span class="o">|</span><span class="n">element</span><span class="o">|</span> <span class="n">filelist</span> <span class="o">&lt;&lt;</span> <span class="s2">&quot;</span><span class="si">#{</span><span class="n">element</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">&lt;br /&gt;&quot;</span> <span class="p">}</span>
21
21
 
22
22
  <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
23
23
  <span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
24
24
  <span class="k">end</span>
25
25
 
26
26
 
27
- <span class="n">haml</span> <span class="ss">:sample2</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=&gt;</span> <span class="p">{</span> <span class="ss">:userId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:filelist</span> <span class="o">=&gt;</span> <span class="n">filelist</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span> <span class="p">}</span>
27
+ <span class="n">haml</span> <span class="ss">:sample2</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=&gt;</span> <span class="p">{</span><span class="ss">:userId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:filelist</span> <span class="o">=&gt;</span> <span class="n">filelist</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span><span class="p">}</span>
28
28
  <span class="k">end</span>
29
29
 
30
30
  </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -0,0 +1,51 @@
1
+ <!DOCTYPE html> <html> <head> <title>sample20.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> sample20.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;/sample20&#39;</span> <span class="k">do</span>
2
+ <span class="n">haml</span> <span class="ss">:sample20</span>
3
+ <span class="k">end</span>
4
+
5
+
6
+ <span class="n">post</span> <span class="s1">&#39;/sample20&#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">:resultFileId</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:resultFileId</span><span class="o">]</span>
11
+
12
+ <span class="k">begin</span>
13
+
14
+
15
+ <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">resultFileId</span><span class="o">.</span><span class="n">empty?</span>
16
+
17
+
18
+ <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">resultFileId</span><span class="p">)</span>
19
+
20
+ <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>
21
+
22
+ <span class="n">changes</span> <span class="o">=</span> <span class="n">document</span><span class="o">.</span><span class="n">changes!</span><span class="p">({</span><span class="ss">:client_id</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
23
+
24
+ <span class="n">result</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
25
+ <span class="n">result</span> <span class="o">+=</span> <span class="s2">&quot;&lt;table class=&#39;border&#39;&gt;&quot;</span>
26
+ <span class="n">result</span> <span class="o">+=</span> <span class="s2">&quot;&lt;tr&gt;&lt;td&gt;&lt;font color=&#39;green&#39;&gt;Change Name&lt;/font&gt;&lt;/td&gt;&lt;td&gt;&lt;font color=&#39;green&#39;&gt;Change&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&quot;</span>
27
+ <span class="n">changes</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">change</span><span class="o">|</span>
28
+ <span class="n">result</span> <span class="o">+=</span> <span class="s2">&quot;&lt;tr&gt;&lt;td&gt;id&lt;/td&gt;&lt;td&gt;</span><span class="si">#{</span><span class="n">change</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">&lt;/td&gt;&lt;/tr&gt;&quot;</span>
29
+ <span class="n">result</span> <span class="o">+=</span> <span class="s2">&quot;&lt;tr&gt;&lt;td&gt;type&lt;/td&gt;&lt;td&gt;</span><span class="si">#{</span><span class="n">change</span><span class="o">.</span><span class="n">type</span><span class="si">}</span><span class="s2">&lt;/td&gt;&lt;/tr&gt;&quot;</span>
30
+ <span class="n">result</span> <span class="o">+=</span> <span class="s2">&quot;&lt;tr&gt;&lt;td&gt;text&lt;/td&gt;&lt;td&gt;</span><span class="si">#{</span><span class="n">change</span><span class="o">.</span><span class="n">text</span><span class="si">}</span><span class="s2">&lt;/td&gt;&lt;/tr&gt;&quot;</span>
31
+ <span class="n">result</span> <span class="o">+=</span> <span class="s2">&quot;&lt;tr&gt;&lt;td&gt;page id&lt;/td&gt;&lt;td&gt;</span><span class="si">#{</span><span class="n">change</span><span class="o">.</span><span class="n">page</span><span class="o">[</span><span class="ss">:Id</span><span class="o">]</span><span class="si">}</span><span class="s2">&lt;/td&gt;&lt;/tr&gt;&quot;</span>
32
+ <span class="n">result</span> <span class="o">+=</span> <span class="s2">&quot;&lt;tr&gt;&lt;td&gt;page weight&lt;/td&gt;&lt;td&gt;</span><span class="si">#{</span><span class="n">change</span><span class="o">.</span><span class="n">page</span><span class="o">[</span><span class="ss">:Width</span><span class="o">]</span><span class="si">}</span><span class="s2">&lt;/td&gt;&lt;/tr&gt;&quot;</span>
33
+ <span class="n">result</span> <span class="o">+=</span> <span class="s2">&quot;&lt;tr&gt;&lt;td&gt;page height&lt;/td&gt;&lt;td&gt;</span><span class="si">#{</span><span class="n">change</span><span class="o">.</span><span class="n">page</span><span class="o">[</span><span class="ss">:Height</span><span class="o">]</span><span class="si">}</span><span class="s2">&lt;/td&gt;&lt;/tr&gt;&quot;</span>
34
+ <span class="n">result</span> <span class="o">+=</span> <span class="s2">&quot;&lt;tr&gt;&lt;td&gt;box x&lt;/td&gt;&lt;td&gt;</span><span class="si">#{</span><span class="n">change</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">x</span><span class="si">}</span><span class="s2">&lt;/td&gt;&lt;/tr&gt;&quot;</span>
35
+ <span class="n">result</span> <span class="o">+=</span> <span class="s2">&quot;&lt;tr&gt;&lt;td&gt;box y&lt;/td&gt;&lt;td&gt;</span><span class="si">#{</span><span class="n">change</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">y</span><span class="si">}</span><span class="s2">&lt;/td&gt;&lt;/tr&gt;&quot;</span>
36
+ <span class="n">result</span> <span class="o">+=</span> <span class="s2">&quot;&lt;tr&gt;&lt;td&gt;box weight&lt;/td&gt;&lt;td&gt;</span><span class="si">#{</span><span class="n">change</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">width</span><span class="si">}</span><span class="s2">&lt;/td&gt;&lt;/tr&gt;&quot;</span>
37
+ <span class="n">result</span> <span class="o">+=</span> <span class="s2">&quot;&lt;tr&gt;&lt;td&gt;box height&lt;/td&gt;&lt;td&gt;</span><span class="si">#{</span><span class="n">change</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">height</span><span class="si">}</span><span class="s2">&lt;/td&gt;&lt;/tr&gt;&quot;</span>
38
+ <span class="n">result</span> <span class="o">+=</span> <span class="s2">&quot;&lt;tr bgcolor=&#39;#808080&#39;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&quot;</span>
39
+ <span class="k">end</span>
40
+
41
+ <span class="n">result</span> <span class="o">+=</span> <span class="s1">&#39;&lt;/table&gt;&#39;</span>
42
+
43
+ <span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=&gt;</span> <span class="n">e</span>
44
+ <span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
45
+ <span class="k">end</span>
46
+
47
+
48
+ <span class="n">haml</span> <span class="ss">:sample20</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">:resultFileId</span> <span class="o">=&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">resultFileId</span><span class="p">,</span> <span class="ss">:result</span> <span class="o">=&gt;</span> <span class="n">result</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=&gt;</span> <span class="n">err</span><span class="p">}</span>
49
+ <span class="k">end</span>
50
+
51
+ </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>