groupdocs 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/examples/api-samples/README.md +1 -1
- data/examples/api-samples/public/css/style.css +2 -2
- data/examples/api-samples/public/docs/annotation-sample.html +57 -0
- data/examples/api-samples/public/docs/envelope-sample.html +32 -32
- data/examples/api-samples/public/docs/sample1.html +3 -3
- data/examples/api-samples/public/docs/sample10.html +25 -24
- data/examples/api-samples/public/docs/sample11.html +17 -17
- data/examples/api-samples/public/docs/sample12.html +4 -4
- data/examples/api-samples/public/docs/sample13.html +5 -5
- data/examples/api-samples/public/docs/sample14.html +5 -5
- data/examples/api-samples/public/docs/sample15.html +4 -4
- data/examples/api-samples/public/docs/sample16.html +3 -3
- data/examples/api-samples/public/docs/sample17.html +3 -3
- data/examples/api-samples/public/docs/sample18.html +129 -34
- data/examples/api-samples/public/docs/sample19.html +59 -0
- data/examples/api-samples/public/docs/sample2.html +5 -5
- data/examples/api-samples/public/docs/sample20.html +51 -0
- data/examples/api-samples/public/docs/sample21.html +66 -0
- data/examples/api-samples/public/docs/sample22.html +53 -0
- data/examples/api-samples/public/docs/sample3.html +4 -4
- data/examples/api-samples/public/docs/sample4.html +27 -16
- data/examples/api-samples/public/docs/sample5.html +29 -22
- data/examples/api-samples/public/docs/sample6.html +6 -6
- data/examples/api-samples/public/docs/sample7.html +8 -8
- data/examples/api-samples/public/docs/sample8.html +31 -23
- data/examples/api-samples/public/docs/sample9.html +26 -8
- data/examples/api-samples/public/templates/merge_feid_doc.docx +0 -0
- data/examples/api-samples/samples/annotation-sample.rb +22 -16
- data/examples/api-samples/samples/envelope-sample.rb +26 -25
- data/examples/api-samples/samples/sample1.rb +2 -2
- data/examples/api-samples/samples/sample10.rb +21 -20
- data/examples/api-samples/samples/sample11.rb +18 -18
- data/examples/api-samples/samples/sample12.rb +3 -3
- data/examples/api-samples/samples/sample13.rb +4 -4
- data/examples/api-samples/samples/sample14.rb +4 -4
- data/examples/api-samples/samples/sample15.rb +3 -3
- data/examples/api-samples/samples/sample16.rb +2 -2
- data/examples/api-samples/samples/sample17.rb +2 -2
- data/examples/api-samples/samples/sample18.rb +90 -106
- data/examples/api-samples/samples/sample19.rb +5 -5
- data/examples/api-samples/samples/sample2.rb +4 -4
- data/examples/api-samples/samples/sample20.rb +4 -4
- data/examples/api-samples/samples/sample21.rb +4 -4
- data/examples/api-samples/samples/sample22.rb +2 -2
- data/examples/api-samples/samples/sample23.rb +0 -0
- data/examples/api-samples/samples/sample24.rb +0 -0
- data/examples/api-samples/samples/sample25.rb +96 -0
- data/examples/api-samples/samples/sample3.rb +3 -3
- data/examples/api-samples/samples/sample4.rb +23 -12
- data/examples/api-samples/samples/sample5.rb +23 -16
- data/examples/api-samples/samples/sample6.rb +8 -8
- data/examples/api-samples/samples/sample7.rb +7 -7
- data/examples/api-samples/samples/sample8.rb +29 -21
- data/examples/api-samples/samples/sample9.rb +23 -5
- data/examples/api-samples/views/_others_samples.haml +57 -0
- data/examples/api-samples/views/annotation_sample.haml +30 -30
- data/examples/api-samples/views/envelope_sample.haml +31 -31
- data/examples/api-samples/views/index.haml +33 -25
- data/examples/api-samples/views/sample1.haml +22 -69
- data/examples/api-samples/views/sample10.haml +57 -73
- data/examples/api-samples/views/sample11.haml +31 -79
- data/examples/api-samples/views/sample12.haml +18 -66
- data/examples/api-samples/views/sample13.haml +21 -70
- data/examples/api-samples/views/sample14.haml +18 -67
- data/examples/api-samples/views/sample15.haml +15 -63
- data/examples/api-samples/views/sample16.haml +13 -61
- data/examples/api-samples/views/sample17.haml +19 -67
- data/examples/api-samples/views/sample18.haml +74 -159
- data/examples/api-samples/views/sample19.haml +25 -74
- data/examples/api-samples/views/sample2.haml +19 -66
- data/examples/api-samples/views/sample20.haml +19 -68
- data/examples/api-samples/views/sample21.haml +28 -76
- data/examples/api-samples/views/sample22.haml +29 -77
- data/examples/api-samples/views/sample23.haml +0 -0
- data/examples/api-samples/views/sample24.haml +0 -0
- data/examples/api-samples/views/sample25.haml +91 -0
- data/examples/api-samples/views/sample3.haml +20 -68
- data/examples/api-samples/views/sample4.haml +53 -68
- data/examples/api-samples/views/sample5.haml +54 -70
- data/examples/api-samples/views/sample6.haml +21 -69
- data/examples/api-samples/views/sample7.haml +19 -66
- data/examples/api-samples/views/sample8.haml +60 -75
- data/examples/api-samples/views/sample9.haml +54 -70
- data/examples/api-samples/web.rb +20 -0
- data/lib/groupdocs/api/request.rb +4 -2
- data/lib/groupdocs/version.rb +1 -1
- data/spec/groupdocs/api/request_spec.rb +10 -2
- metadata +18 -5
- data/examples/api-samples/app.rb +0 -15
data/CHANGELOG.md
CHANGED
@@ -211,12 +211,12 @@ div.footer h5 {
|
|
211
211
|
|
212
212
|
.description {
|
213
213
|
font-style: italic;
|
214
|
-
background: url(
|
214
|
+
background: url(../images/info.png) no-repeat left;
|
215
215
|
padding-left: 25px;
|
216
216
|
}
|
217
217
|
|
218
218
|
.documentation {
|
219
219
|
float: right;
|
220
|
-
background: url(
|
220
|
+
background: url(../images/help.png) no-repeat left;
|
221
221
|
padding-left: 20px;
|
222
222
|
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<!DOCTYPE html> <html> <head> <title>annotation-sample.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="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> annotation-sample.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/annotation-sample'</span> <span class="k">do</span>
|
2
|
+
<span class="n">haml</span> <span class="ss">:annotation_sample</span>
|
3
|
+
<span class="k">end</span>
|
4
|
+
|
5
|
+
|
6
|
+
<span class="n">post</span> <span class="s1">'/annotation-sample'</span> <span class="k">do</span>
|
7
|
+
<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>
|
8
|
+
<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>
|
9
|
+
|
10
|
+
<span class="n">set</span> <span class="ss">:email</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:email</span><span class="o">]</span>
|
11
|
+
<span class="n">set</span> <span class="ss">:first_name</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:first_name</span><span class="o">]</span>
|
12
|
+
<span class="n">set</span> <span class="ss">:last_name</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:last_name</span><span class="o">]</span>
|
13
|
+
<span class="n">set</span> <span class="ss">:file_name</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:file_name</span><span class="o">]</span>
|
14
|
+
|
15
|
+
<span class="k">begin</span>
|
16
|
+
<span class="k">raise</span> <span class="s1">'Please enter all required parameters'</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">file_name</span><span class="o">.</span><span class="n">empty?</span>
|
17
|
+
|
18
|
+
<span class="no">GroupDocs</span><span class="o">.</span><span class="n">configure</span> <span class="k">do</span> <span class="o">|</span><span class="n">groupdocs</span><span class="o">|</span>
|
19
|
+
<span class="n">groupdocs</span><span class="o">.</span><span class="n">client_id</span> <span class="o">=</span> <span class="n">params</span><span class="o">[</span><span class="ss">:client_id</span><span class="o">]</span>
|
20
|
+
<span class="n">groupdocs</span><span class="o">.</span><span class="n">private_key</span> <span class="o">=</span> <span class="n">params</span><span class="o">[</span><span class="ss">:private_key</span><span class="o">]</span>
|
21
|
+
<span class="n">groupdocs</span><span class="o">.</span><span class="n">api_server</span> <span class="o">=</span> <span class="s1">'https://api.groupdocs.com'</span>
|
22
|
+
<span class="k">end</span>
|
23
|
+
|
24
|
+
<span class="n">metadata</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">metadata!</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">file_name</span><span class="p">)</span>
|
25
|
+
<span class="n">document</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">File</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="nb">id</span><span class="p">:</span> <span class="n">metadata</span><span class="o">.</span><span class="n">id</span><span class="p">,</span> <span class="ss">guid</span><span class="p">:</span> <span class="n">metadata</span><span class="o">.</span><span class="n">guid</span><span class="p">)</span><span class="o">.</span><span class="n">to_document</span>
|
26
|
+
|
27
|
+
|
28
|
+
<span class="n">user</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:User</span><span class="o">.</span><span class="n">new</span>
|
29
|
+
<span class="n">user</span><span class="o">.</span><span class="n">nickname</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">email</span>
|
30
|
+
<span class="n">user</span><span class="o">.</span><span class="n">primary_email</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">email</span>
|
31
|
+
<span class="n">user</span><span class="o">.</span><span class="n">first_name</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">first_name</span>
|
32
|
+
<span class="n">user</span><span class="o">.</span><span class="n">last_name</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">last_name</span>
|
33
|
+
<span class="n">user</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:User</span><span class="o">.</span><span class="n">update_account!</span><span class="p">(</span><span class="n">user</span><span class="p">)</span>
|
34
|
+
|
35
|
+
|
36
|
+
<span class="n">document</span><span class="o">.</span><span class="n">add_collaborator!</span> <span class="n">user</span> <span class="k">unless</span> <span class="n">document</span><span class="o">.</span><span class="n">collaborators!</span><span class="o">.</span><span class="n">any?</span> <span class="p">{</span> <span class="o">|</span><span class="n">c</span><span class="o">|</span> <span class="n">c</span><span class="o">.</span><span class="n">guid</span> <span class="o">==</span> <span class="n">user</span><span class="o">.</span><span class="n">guid</span> <span class="p">}</span>
|
37
|
+
|
38
|
+
|
39
|
+
<span class="n">annotation</span> <span class="o">=</span> <span class="kp">true</span> <span class="c1"># looks like "IsAnnotation" is some helper method so I stub it here</span>
|
40
|
+
<span class="n">url</span> <span class="o">=</span> <span class="k">if</span> <span class="n">annotation</span>
|
41
|
+
<span class="s2">"/document-annotation2/embed?quality=50&guid=</span><span class="si">#{</span><span class="n">document</span><span class="o">.</span><span class="n">file</span><span class="o">.</span><span class="n">guid</span><span class="si">}</span><span class="s2">&uid=</span><span class="si">#{</span><span class="n">user</span><span class="o">.</span><span class="n">guid</span><span class="si">}</span><span class="s2">&download=True"</span>
|
42
|
+
<span class="k">else</span>
|
43
|
+
<span class="s2">"/document-viewer/embed?quality=50&guid=</span><span class="si">#{</span><span class="n">document</span><span class="o">.</span><span class="n">file</span><span class="o">.</span><span class="n">guid</span><span class="si">}</span><span class="s2">&uid=</span><span class="si">#{</span><span class="n">user</span><span class="o">.</span><span class="n">guid</span><span class="si">}</span><span class="s2">&download=True"</span>
|
44
|
+
<span class="k">end</span>
|
45
|
+
|
46
|
+
|
47
|
+
url = GroupDocs::Api::Request.new(path: url).prepare<em>and</em>sign_url</p> </td> <td class="code"> <div class="highlight"><pre>
|
48
|
+
|
49
|
+
<span class="n">iframe</span> <span class="o">=</span> <span class="s2">"<iframe src='https://apps.groupdocs.com</span><span class="si">#{</span><span class="n">url</span><span class="si">}</span><span class="s2">' frameborder='0' width='720' height='600'></iframe>"</span>
|
50
|
+
<span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=></span> <span class="n">e</span>
|
51
|
+
<span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
|
52
|
+
<span class="k">end</span>
|
53
|
+
|
54
|
+
<span class="n">haml</span> <span class="ss">:annotation_sample</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span><span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=></span> <span class="n">err</span><span class="p">,</span> <span class="ss">:file_name</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">file_name</span><span class="p">,</span> <span class="ss">:email</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">email</span><span class="p">,</span> <span class="ss">:first_name</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">first_name</span><span class="p">,</span> <span class="ss">:last_name</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">last_name</span><span class="p">,</span> <span class="ss">:iframe</span> <span class="o">=></span> <span class="n">iframe</span><span class="p">}</span>
|
55
|
+
<span class="k">end</span>
|
56
|
+
|
57
|
+
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<!DOCTYPE html> <html> <head> <title>envelope-sample.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> envelope-sample.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/envelope-sample'</span> <span class="k">do</span>
|
1
|
+
<!DOCTYPE html> <html> <head> <title>envelope-sample.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="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> envelope-sample.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/envelope-sample'</span> <span class="k">do</span>
|
2
2
|
<span class="n">haml</span> <span class="ss">:envelope_sample</span>
|
3
3
|
<span class="k">end</span>
|
4
4
|
|
@@ -7,14 +7,13 @@
|
|
7
7
|
|
8
8
|
<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>
|
9
9
|
<span class="k">begin</span>
|
10
|
-
<span class="k">raise</span> <span class="
|
11
|
-
|
10
|
+
<span class="k">raise</span> <span class="s1">'Empty params!'</span> <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">empty?</span>
|
12
11
|
|
13
|
-
<span class="n">
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
<span class="n">
|
12
|
+
<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="s1">'signed'</span><span class="p">,</span> <span class="s1">'w'</span><span class="p">)</span>
|
13
|
+
<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>
|
14
|
+
<span class="n">out_file</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"</span><span class="si">#{</span><span class="n">key</span><span class="si">}</span><span class="s2">: </span><span class="si">#{</span><span class="n">value</span><span class="si">}</span><span class="s2"> </span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span>
|
15
|
+
<span class="k">end</span>
|
16
|
+
<span class="n">out_file</span><span class="o">.</span><span class="n">close</span>
|
18
17
|
<span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=></span> <span class="n">e</span>
|
19
18
|
<span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
|
20
19
|
<span class="k">end</span>
|
@@ -24,18 +23,18 @@
|
|
24
23
|
|
25
24
|
<span class="n">post</span> <span class="s1">'/envelope-sample/sign-and-download'</span> <span class="k">do</span>
|
26
25
|
<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>
|
27
|
-
<span class="k">begin</span>
|
28
|
-
<span class="k">raise</span> <span class="
|
26
|
+
<span class="k">begin</span>
|
27
|
+
<span class="k">raise</span> <span class="s1">'Empty params!'</span> <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">empty?</span>
|
29
28
|
<span class="no">GroupDocs</span><span class="o">.</span><span class="n">configure</span> <span class="k">do</span> <span class="o">|</span><span class="n">groupdocs</span><span class="o">|</span>
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
<span class="n">groupdocs</span><span class="o">.</span><span class="n">client_id</span> <span class="o">=</span> <span class="s1">''</span> <span class="c1"># Your client Client ID here</span>
|
30
|
+
<span class="n">groupdocs</span><span class="o">.</span><span class="n">private_key</span> <span class="o">=</span> <span class="s1">''</span> <span class="c1"># Your API Key here</span>
|
31
|
+
<span class="n">groupdocs</span><span class="o">.</span><span class="n">api_server</span> <span class="o">=</span> <span class="s1">'https://api.groupdocs.com'</span>
|
33
32
|
<span class="k">end</span>
|
34
33
|
<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>
|
35
34
|
<span class="k">if</span> <span class="n">key</span> <span class="o">==</span> <span class="s1">'SourceId'</span>
|
36
35
|
|
37
36
|
<span class="n">envelope</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Signature</span><span class="o">::</span><span class="no">Envelope</span><span class="o">.</span><span class="n">new</span> <span class="nb">id</span><span class="p">:</span> <span class="n">value</span><span class="p">,</span>
|
38
|
-
|
37
|
+
<span class="nb">name</span><span class="p">:</span> <span class="n">value</span>
|
39
38
|
|
40
39
|
<span class="n">envelope</span><span class="o">.</span><span class="n">signed_documents!</span> <span class="s1">'.'</span>
|
41
40
|
<span class="k">end</span>
|
@@ -50,7 +49,7 @@
|
|
50
49
|
<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="s1">'signed'</span><span class="p">)</span>
|
51
50
|
<span class="no">File</span><span class="o">.</span><span class="n">readlines</span><span class="p">(</span><span class="s1">'signed'</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">line</span><span class="o">|</span>
|
52
51
|
<span class="k">end</span>
|
53
|
-
<span class="k">else</span>
|
52
|
+
<span class="k">else</span>
|
54
53
|
<span class="s1">'Have not signed yet'</span>
|
55
54
|
<span class="k">end</span>
|
56
55
|
<span class="k">end</span>
|
@@ -61,41 +60,41 @@
|
|
61
60
|
<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>
|
62
61
|
|
63
62
|
<span class="k">begin</span>
|
64
|
-
<span class="k">raise</span> <span class="
|
63
|
+
<span class="k">raise</span> <span class="s1">'Please enter all required parameters'</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="o">.</span><span class="n">empty?</span>
|
65
64
|
|
66
65
|
<span class="no">GroupDocs</span><span class="o">.</span><span class="n">configure</span> <span class="k">do</span> <span class="o">|</span><span class="n">groupdocs</span><span class="o">|</span>
|
67
66
|
<span class="n">groupdocs</span><span class="o">.</span><span class="n">client_id</span> <span class="o">=</span> <span class="n">params</span><span class="o">[</span><span class="ss">:client_id</span><span class="o">]</span>
|
68
67
|
<span class="n">groupdocs</span><span class="o">.</span><span class="n">private_key</span> <span class="o">=</span> <span class="n">params</span><span class="o">[</span><span class="ss">:private_key</span><span class="o">]</span>
|
69
|
-
<span class="n">groupdocs</span><span class="o">.</span><span class="n">api_server</span> <span class="o">=</span> <span class="s1">'https://api.groupdocs.com'</span>
|
68
|
+
<span class="n">groupdocs</span><span class="o">.</span><span class="n">api_server</span> <span class="o">=</span> <span class="s1">'https://stage-api.groupdocs.com'</span>
|
70
69
|
<span class="k">end</span>
|
71
|
-
|
70
|
+
|
72
71
|
|
73
72
|
<span class="n">filepath</span> <span class="o">=</span> <span class="s2">"</span><span class="si">#{</span><span class="no">Dir</span><span class="o">.</span><span class="n">tmpdir</span><span class="si">}</span><span class="s2">/</span><span class="si">#{</span><span class="n">params</span><span class="o">[</span><span class="ss">:file</span><span class="o">][</span><span class="ss">:filename</span><span class="o">]</span><span class="si">}</span><span class="s2">"</span>
|
74
73
|
<span class="no">File</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">filepath</span><span class="p">,</span> <span class="s1">'wb'</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">f</span><span class="o">|</span> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">params</span><span class="o">[</span><span class="ss">:file</span><span class="o">][</span><span class="ss">:tempfile</span><span class="o">].</span><span class="n">read</span><span class="p">)</span> <span class="p">}</span>
|
75
74
|
<span class="n">file</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">File</span><span class="o">.</span><span class="n">upload!</span><span class="p">(</span><span class="n">filepath</span><span class="p">,</span> <span class="p">{},</span> <span class="n">client_id</span><span class="p">:</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="n">private_key</span><span class="p">:</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">)</span>
|
76
75
|
<span class="n">document</span> <span class="o">=</span> <span class="n">file</span><span class="o">.</span><span class="n">to_document</span>
|
77
|
-
|
76
|
+
|
78
77
|
|
79
78
|
<span class="n">envelope</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Signature</span><span class="o">::</span><span class="no">Envelope</span><span class="o">.</span><span class="n">new</span>
|
80
|
-
<span class="n">envelope</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="
|
81
|
-
<span class="n">envelope</span><span class="o">.</span><span class="n">email_subject</span> <span class="o">=</span> <span class="
|
79
|
+
<span class="n">envelope</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s1">'Envelope'</span>
|
80
|
+
<span class="n">envelope</span><span class="o">.</span><span class="n">email_subject</span> <span class="o">=</span> <span class="s1">'Sing this!'</span>
|
82
81
|
<span class="n">envelope</span><span class="o">.</span><span class="n">create!</span>
|
83
|
-
|
82
|
+
|
84
83
|
|
85
84
|
<span class="n">envelope</span><span class="o">.</span><span class="n">add_document!</span> <span class="n">document</span>
|
86
|
-
|
85
|
+
|
87
86
|
|
88
87
|
<span class="n">document</span> <span class="o">=</span> <span class="n">envelope</span><span class="o">.</span><span class="n">documents!</span><span class="o">.</span><span class="n">first</span>
|
89
|
-
|
88
|
+
|
90
89
|
|
91
90
|
<span class="n">roles</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Signature</span><span class="o">::</span><span class="no">Role</span><span class="o">.</span><span class="n">get!</span>
|
92
91
|
<span class="n">recipient</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Signature</span><span class="o">::</span><span class="no">Recipient</span><span class="o">.</span><span class="n">new</span>
|
93
92
|
<span class="n">recipient</span><span class="o">.</span><span class="n">email</span> <span class="o">=</span> <span class="s1">'john@smith.com'</span>
|
94
93
|
<span class="n">recipient</span><span class="o">.</span><span class="n">first_name</span> <span class="o">=</span> <span class="s1">'John'</span>
|
95
94
|
<span class="n">recipient</span><span class="o">.</span><span class="n">last_name</span> <span class="o">=</span> <span class="s1">'Smith'</span>
|
96
|
-
<span class="n">recipient</span><span class="o">.</span><span class="n">role_id</span> <span class="o">=</span> <span class="n">roles</span><span class="o">.</span><span class="n">detect</span> <span class="p">{</span> <span class="o">|</span><span class="n">role</span><span class="o">|</span> <span class="n">role</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="
|
95
|
+
<span class="n">recipient</span><span class="o">.</span><span class="n">role_id</span> <span class="o">=</span> <span class="n">roles</span><span class="o">.</span><span class="n">detect</span> <span class="p">{</span> <span class="o">|</span><span class="n">role</span><span class="o">|</span> <span class="n">role</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s1">'Signer'</span> <span class="p">}</span><span class="o">.</span><span class="n">id</span>
|
97
96
|
<span class="n">envelope</span><span class="o">.</span><span class="n">add_recipient!</span> <span class="n">recipient</span>
|
98
|
-
|
97
|
+
|
99
98
|
|
100
99
|
<span class="n">recipient</span> <span class="o">=</span> <span class="n">envelope</span><span class="o">.</span><span class="n">recipients!</span><span class="o">.</span><span class="n">first</span>
|
101
100
|
|
@@ -106,27 +105,28 @@ field = GroupDocs::Signature::Field.get!.detect { |f| f.type == :single<em>line
|
|
106
105
|
field.name = 'City'
|
107
106
|
field.location = { location</em>x: 0.3, location<em>y: 0.2, page: 1 }
|
108
107
|
envelope.add</em>field! field, document, recipient</p> </td> <td class="code"> <div class="highlight"><pre>
|
109
|
-
|
108
|
+
|
110
109
|
|
111
110
|
field = GroupDocs::Signature::Field.get!.detect { |f| f.type == :signature }
|
112
111
|
field.location = { location<em>x: 0.3, location</em>y: 0.3, page: 1 }
|
113
112
|
envelope.add_field! field, document, recipient</p> </td> <td class="code"> <div class="highlight"><pre>
|
114
113
|
|
115
|
-
|
116
|
-
|
114
|
+
|
115
|
+
webhook = 'http://groupdocs-ruby-samples.herokuapp.com/envelope-sample/sign'</p> </td> <td class="code"> <div class="highlight"><pre>
|
116
|
+
<span class="n">webhook</span> <span class="o">=</span> <span class="s1">'http://77.81.243.48/?q=groupdocs_signature/signature_callback'</span>
|
117
117
|
|
118
118
|
|
119
119
|
<span class="n">envelope</span><span class="o">.</span><span class="n">send!</span> <span class="n">webhook</span>
|
120
|
-
|
120
|
+
|
121
121
|
|
122
|
-
<span class="n">url</span> <span class="o">=</span> <span class="s2">"https://apps.groupdocs.com/signature/signembed/</span><span class="si">#{</span><span class="n">envelope</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">/</span><span class="si">#{</span><span class="n">recipient</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">"</span>
|
122
|
+
<span class="n">url</span> <span class="o">=</span> <span class="s2">"https://stage-apps.groupdocs.com/signature/signembed/</span><span class="si">#{</span><span class="n">envelope</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">/</span><span class="si">#{</span><span class="n">recipient</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">"</span>
|
123
123
|
<span class="n">iframe</span> <span class="o">=</span> <span class="s2">"<iframe src='</span><span class="si">#{</span><span class="n">url</span><span class="si">}</span><span class="s2">' frameborder='0' width='720' height='600'></iframe>"</span>
|
124
124
|
|
125
125
|
<span class="k">rescue</span> <span class="no">Exception</span> <span class="o">=></span> <span class="n">e</span>
|
126
126
|
<span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
|
127
127
|
<span class="k">end</span>
|
128
128
|
|
129
|
-
<span class="n">haml</span> <span class="ss">:envelope_sample</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span
|
129
|
+
<span class="n">haml</span> <span class="ss">:envelope_sample</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span><span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=></span> <span class="n">err</span><span class="p">,</span> <span class="ss">:iframe</span> <span class="o">=></span> <span class="n">iframe</span><span class="p">}</span>
|
130
130
|
<span class="k">end</span>
|
131
131
|
|
132
132
|
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<!DOCTYPE html> <html> <head> <title>sample1.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample1.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/sample1'</span> <span class="k">do</span>
|
1
|
+
<!DOCTYPE html> <html> <head> <title>sample1.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="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> sample1.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/sample1'</span> <span class="k">do</span>
|
2
2
|
<span class="n">haml</span> <span class="ss">:sample1</span>
|
3
3
|
<span class="k">end</span>
|
4
4
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
<span class="k">begin</span>
|
12
12
|
|
13
|
-
<span class="k">raise</span> <span class="
|
13
|
+
<span class="k">raise</span> <span class="s1">'Please enter all required parameters'</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="o">.</span><span class="n">empty?</span>
|
14
14
|
|
15
15
|
|
16
16
|
<span class="n">user</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:User</span><span class="o">.</span><span class="n">get!</span><span class="p">({</span><span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
|
@@ -20,7 +20,7 @@
|
|
20
20
|
<span class="k">end</span>
|
21
21
|
|
22
22
|
|
23
|
-
<span class="n">haml</span> <span class="ss">:sample1</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span
|
23
|
+
<span class="n">haml</span> <span class="ss">:sample1</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span><span class="ss">:userId</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:user</span> <span class="o">=></span> <span class="n">user</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=></span> <span class="n">err</span><span class="p">}</span>
|
24
24
|
<span class="k">end</span>
|
25
25
|
|
26
26
|
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<!DOCTYPE html> <html> <head> <title>sample10.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample10.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/sample10'</span> <span class="k">do</span>
|
1
|
+
<!DOCTYPE html> <html> <head> <title>sample10.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="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> sample10.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/sample10'</span> <span class="k">do</span>
|
2
2
|
<span class="n">haml</span> <span class="ss">:sample10</span>
|
3
3
|
<span class="k">end</span>
|
4
4
|
|
@@ -7,34 +7,35 @@
|
|
7
7
|
|
8
8
|
<span class="n">set</span> <span class="ss">:client_id</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:client_id</span><span class="o">]</span>
|
9
9
|
<span class="n">set</span> <span class="ss">:private_key</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:private_key</span><span class="o">]</span>
|
10
|
-
<span class="n">set</span> <span class="ss">:guid</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:
|
10
|
+
<span class="n">set</span> <span class="ss">:guid</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:fileId</span><span class="o">]</span>
|
11
11
|
<span class="n">set</span> <span class="ss">:email</span><span class="p">,</span> <span class="n">params</span><span class="o">[</span><span class="ss">:email</span><span class="o">]</span>
|
12
12
|
|
13
13
|
<span class="k">begin</span>
|
14
14
|
|
15
|
-
<span class="k">raise</span> <span class="
|
16
|
-
|
17
|
-
|
18
|
-
<span class="n">
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
<span class="
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
<span class="n">
|
31
|
-
<span class="k">
|
15
|
+
<span class="k">raise</span> <span class="s1">'Please enter all required parameters'</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">guid</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">email</span><span class="o">.</span><span class="n">empty?</span>
|
16
|
+
|
17
|
+
|
18
|
+
<span class="n">file</span> <span class="o">=</span> <span class="kp">nil</span>
|
19
|
+
<span class="k">case</span> <span class="n">settings</span><span class="o">.</span><span class="n">source</span>
|
20
|
+
<span class="k">when</span> <span class="s1">'guid'</span>
|
21
|
+
<span class="n">file</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">File</span><span class="o">.</span><span class="n">new</span><span class="p">({</span><span class="ss">:guid</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">guid</span><span class="p">})</span>
|
22
|
+
<span class="k">when</span> <span class="s1">'local'</span>
|
23
|
+
|
24
|
+
<span class="n">filepath</span> <span class="o">=</span> <span class="s2">"</span><span class="si">#{</span><span class="no">Dir</span><span class="o">.</span><span class="n">tmpdir</span><span class="si">}</span><span class="s2">/</span><span class="si">#{</span><span class="n">params</span><span class="o">[</span><span class="ss">:file</span><span class="o">][</span><span class="ss">:filename</span><span class="o">]</span><span class="si">}</span><span class="s2">"</span>
|
25
|
+
|
26
|
+
<span class="no">File</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">filepath</span><span class="p">,</span> <span class="s1">'wb'</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">f</span><span class="o">|</span> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">params</span><span class="o">[</span><span class="ss">:file</span><span class="o">][</span><span class="ss">:tempfile</span><span class="o">].</span><span class="n">read</span><span class="p">)</span> <span class="p">}</span>
|
27
|
+
|
28
|
+
<span class="n">file</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">File</span><span class="o">.</span><span class="n">upload!</span><span class="p">(</span><span class="n">filepath</span><span class="p">,</span> <span class="p">{},</span> <span class="n">client_id</span><span class="p">:</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="n">private_key</span><span class="p">:</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">)</span>
|
29
|
+
<span class="k">when</span> <span class="s1">'url'</span>
|
30
|
+
<span class="n">file</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">File</span><span class="o">.</span><span class="n">upload_web!</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">url</span><span class="p">,</span> <span class="n">client_id</span><span class="p">:</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="n">private_key</span><span class="p">:</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">)</span>
|
31
|
+
<span class="k">else</span>
|
32
|
+
<span class="k">raise</span> <span class="s1">'Wrong GUID source.'</span>
|
32
33
|
<span class="k">end</span>
|
33
34
|
|
34
|
-
|
35
|
-
<span class="n">shared</span> <span class="o">=</span> <span class="n">
|
35
|
+
|
36
|
+
<span class="n">shared</span> <span class="o">=</span> <span class="n">file</span><span class="o">.</span><span class="n">to_document</span><span class="o">.</span><span class="n">sharers_set!</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">' '</span><span class="p">),</span> <span class="p">{</span><span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
|
36
37
|
|
37
|
-
|
38
|
+
|
38
39
|
<span class="k">if</span> <span class="n">shared</span>
|
39
40
|
<span class="n">shared_emails</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">email</span>
|
40
41
|
<span class="k">end</span>
|
@@ -42,8 +43,8 @@
|
|
42
43
|
<span class="n">err</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span>
|
43
44
|
<span class="k">end</span>
|
44
45
|
|
45
|
-
|
46
|
-
<span class="n">haml</span> <span class="ss">:sample10</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span
|
46
|
+
|
47
|
+
<span class="n">haml</span> <span class="ss">:sample10</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span><span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:guid</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">guid</span><span class="p">,</span> <span class="ss">:email</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">email</span><span class="p">,</span> <span class="ss">:shared</span> <span class="o">=></span> <span class="n">shared_emails</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=></span> <span class="n">err</span><span class="p">}</span>
|
47
48
|
<span class="k">end</span>
|
48
49
|
|
49
50
|
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<!DOCTYPE html> <html> <head> <title>sample11.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample11.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/sample11'</span> <span class="k">do</span>
|
1
|
+
<!DOCTYPE html> <html> <head> <title>sample11.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <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> sample11.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/sample11'</span> <span class="k">do</span>
|
2
2
|
<span class="n">haml</span> <span class="ss">:sample11</span>
|
3
3
|
<span class="k">end</span>
|
4
4
|
|
@@ -12,28 +12,28 @@
|
|
12
12
|
|
13
13
|
<span class="k">begin</span>
|
14
14
|
|
15
|
-
<span class="k">raise</span> <span class="
|
15
|
+
<span class="k">raise</span> <span class="s1">'Please enter all required parameters'</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">file_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span><span class="o">.</span><span class="n">empty?</span>
|
16
16
|
|
17
17
|
|
18
|
-
<span class="n">types</span> <span class="o">=</span> <span class="p">{</span><span class="
|
18
|
+
<span class="n">types</span> <span class="o">=</span> <span class="p">{</span><span class="ss">:text</span> <span class="o">=></span> <span class="mi">0</span><span class="p">,</span> <span class="ss">:area</span> <span class="o">=></span> <span class="mi">1</span><span class="p">,</span> <span class="ss">:point</span> <span class="o">=></span> <span class="mi">2</span><span class="p">}</span>
|
19
19
|
|
20
20
|
|
21
|
-
<span class="n">
|
21
|
+
<span class="n">all_params</span> <span class="o">=</span> <span class="n">all_params</span> <span class="o">=</span> <span class="o">[</span><span class="s1">'annotation_type'</span><span class="p">,</span> <span class="s1">'box_x'</span><span class="p">,</span> <span class="s1">'box_y'</span><span class="p">,</span> <span class="s1">'text'</span><span class="o">]</span>
|
22
22
|
|
23
23
|
|
24
|
-
<span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span> <span class="o">==</span> <span class="
|
25
|
-
<span class="n">
|
26
|
-
<span class="k">elsif</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span> <span class="o">==</span> <span class="
|
27
|
-
<span class="n">
|
24
|
+
<span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span> <span class="o">==</span> <span class="s1">'text'</span>
|
25
|
+
<span class="n">all_params</span> <span class="o">=</span> <span class="n">all_params</span> <span class="o">|</span> <span class="o">[</span><span class="s1">'box_width'</span><span class="p">,</span> <span class="s1">'box_height'</span><span class="p">,</span> <span class="s1">'annotationPosition_x'</span><span class="p">,</span> <span class="s1">'annotationPosition_y'</span><span class="o">]</span>
|
26
|
+
<span class="k">elsif</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span> <span class="o">==</span> <span class="s1">'area'</span>
|
27
|
+
<span class="n">all_params</span> <span class="o">=</span> <span class="n">all_params</span> <span class="o">|</span> <span class="o">[</span><span class="s1">'box_width'</span><span class="p">,</span> <span class="s1">'box_height'</span><span class="o">]</span>
|
28
28
|
<span class="k">end</span>
|
29
29
|
|
30
30
|
|
31
|
-
<span class="n">
|
32
|
-
<span class="k">raise</span> <span class="
|
31
|
+
<span class="n">all_params</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">param</span><span class="o">|</span>
|
32
|
+
<span class="k">raise</span> <span class="s1">'Please enter all required parameters'</span> <span class="k">if</span> <span class="n">params</span><span class="o">[</span><span class="n">param</span><span class="o">].</span><span class="n">empty?</span>
|
33
33
|
<span class="k">end</span>
|
34
34
|
|
35
35
|
|
36
|
-
<span class="n">files_list</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">Folder</span><span class="o">.</span><span class="n">list!</span><span class="p">(</span><span class="s1">'/'</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span
|
36
|
+
<span class="n">files_list</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Storage</span><span class="o">::</span><span class="no">Folder</span><span class="o">.</span><span class="n">list!</span><span class="p">(</span><span class="s1">'/'</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span><span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
|
37
37
|
<span class="n">document</span> <span class="o">=</span> <span class="s1">''</span>
|
38
38
|
|
39
39
|
|
@@ -51,28 +51,28 @@
|
|
51
51
|
|
52
52
|
|
53
53
|
text annotation</p> </td> <td class="code"> <div class="highlight"><pre>
|
54
|
-
<span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span> <span class="o">==</span> <span class="
|
54
|
+
<span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span> <span class="o">==</span> <span class="s1">'text'</span>
|
55
55
|
<span class="n">annotation</span><span class="o">.</span><span class="n">box</span> <span class="o">=</span> <span class="p">{</span><span class="ss">x</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">'box_x'</span><span class="o">]</span><span class="p">,</span> <span class="ss">y</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">'box_y'</span><span class="o">]</span><span class="p">,</span> <span class="ss">width</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">'box_width'</span><span class="o">]</span><span class="p">,</span> <span class="ss">height</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">'box_height'</span><span class="o">]</span><span class="p">}</span>
|
56
56
|
<span class="n">annotation</span><span class="o">.</span><span class="n">annotationPosition</span> <span class="o">=</span> <span class="p">{</span><span class="ss">x</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">'annotationPosition_x'</span><span class="o">]</span><span class="p">,</span> <span class="ss">y</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">'annotationPosition_y'</span><span class="o">]</span><span class="p">}</span>
|
57
57
|
|
58
58
|
|
59
|
-
<span class="k">elsif</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span> <span class="o">==</span> <span class="
|
59
|
+
<span class="k">elsif</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span> <span class="o">==</span> <span class="s1">'area'</span>
|
60
60
|
<span class="n">annotation</span><span class="o">.</span><span class="n">box</span> <span class="o">=</span> <span class="p">{</span><span class="ss">x</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">'box_x'</span><span class="o">]</span><span class="p">,</span> <span class="ss">y</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">'box_y'</span><span class="o">]</span><span class="p">,</span> <span class="ss">width</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">'box_width'</span><span class="o">]</span><span class="p">,</span> <span class="ss">height</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">'box_height'</span><span class="o">]</span><span class="p">}</span>
|
61
61
|
<span class="n">annotation</span><span class="o">.</span><span class="n">annotationPosition</span> <span class="o">=</span> <span class="p">{</span><span class="ss">x</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="ss">y</span><span class="p">:</span> <span class="mi">0</span><span class="p">}</span>
|
62
62
|
|
63
63
|
|
64
|
-
<span class="k">elsif</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span> <span class="o">==</span> <span class="
|
64
|
+
<span class="k">elsif</span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span> <span class="o">==</span> <span class="s1">'point'</span>
|
65
65
|
<span class="n">annotation</span><span class="o">.</span><span class="n">box</span> <span class="o">=</span> <span class="p">{</span><span class="ss">x</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">'box_x'</span><span class="o">]</span><span class="p">,</span> <span class="ss">y</span><span class="p">:</span> <span class="n">params</span><span class="o">[</span><span class="s1">'box_y'</span><span class="o">]</span><span class="p">,</span> <span class="ss">width</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="ss">height</span><span class="p">:</span> <span class="mi">0</span><span class="p">}</span>
|
66
66
|
<span class="n">annotation</span><span class="o">.</span><span class="n">annotationPosition</span> <span class="o">=</span> <span class="p">{</span><span class="ss">x</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="ss">y</span><span class="p">:</span> <span class="mi">0</span><span class="p">}</span>
|
67
67
|
<span class="k">end</span>
|
68
68
|
|
69
69
|
|
70
|
-
<span class="n">annotation</span><span class="o">.</span><span class="n">create!</span><span class="p">({</span
|
70
|
+
<span class="n">annotation</span><span class="o">.</span><span class="n">create!</span><span class="p">({</span><span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
|
71
71
|
|
72
72
|
|
73
73
|
<span class="n">reply</span> <span class="o">=</span> <span class="ss">GroupDocs</span><span class="p">:</span><span class="ss">:Document</span><span class="o">::</span><span class="ss">Annotation</span><span class="p">:</span><span class="ss">:Reply</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="ss">annotation</span><span class="p">:</span> <span class="n">annotation</span><span class="p">)</span>
|
74
74
|
<span class="n">reply</span><span class="o">.</span><span class="n">text</span> <span class="o">=</span> <span class="n">params</span><span class="o">[</span><span class="s1">'text'</span><span class="o">]</span>
|
75
|
-
<span class="n">reply</span><span class="o">.</span><span class="n">create!</span><span class="p">({</span
|
75
|
+
<span class="n">reply</span><span class="o">.</span><span class="n">create!</span><span class="p">({</span><span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
|
76
76
|
|
77
77
|
<span class="k">end</span>
|
78
78
|
|
@@ -81,7 +81,7 @@ text annotation</p> </td> <td class="code">
|
|
81
81
|
<span class="k">end</span>
|
82
82
|
|
83
83
|
|
84
|
-
<span class="n">haml</span> <span class="ss">:sample11</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span
|
84
|
+
<span class="n">haml</span> <span class="ss">:sample11</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span><span class="ss">:userId</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:fileId</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">file_id</span><span class="p">,</span> <span class="ss">:annotationType</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">annotation_type</span><span class="p">,</span> <span class="ss">:annotationId</span> <span class="o">=></span> <span class="p">(</span><span class="n">defined?</span> <span class="n">annotation</span><span class="o">.</span><span class="n">id</span><span class="p">)</span> <span class="p">?</span> <span class="n">annotation</span><span class="o">.</span><span class="n">id</span> <span class="p">:</span> <span class="kp">nil</span><span class="p">,</span> <span class="ss">:annotationText</span> <span class="o">=></span> <span class="n">params</span><span class="o">[</span><span class="s1">'text'</span><span class="o">]</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=></span> <span class="n">err</span><span class="p">}</span>
|
85
85
|
<span class="k">end</span>
|
86
86
|
|
87
87
|
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<!DOCTYPE html> <html> <head> <title>sample12.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="envelope-sample.html"> envelope-sample.rb </a> <a class="source" href="sample1.html"> sample1.rb </a> <a class="source" href="sample10.html"> sample10.rb </a> <a class="source" href="sample11.html"> sample11.rb </a> <a class="source" href="sample12.html"> sample12.rb </a> <a class="source" href="sample13.html"> sample13.rb </a> <a class="source" href="sample14.html"> sample14.rb </a> <a class="source" href="sample15.html"> sample15.rb </a> <a class="source" href="sample16.html"> sample16.rb </a> <a class="source" href="sample17.html"> sample17.rb </a> <a class="source" href="sample18.html"> sample18.rb </a> <a class="source" href="sample2.html"> sample2.rb </a> <a class="source" href="sample3.html"> sample3.rb </a> <a class="source" href="sample4.html"> sample4.rb </a> <a class="source" href="sample5.html"> sample5.rb </a> <a class="source" href="sample6.html"> sample6.rb </a> <a class="source" href="sample7.html"> sample7.rb </a> <a class="source" href="sample8.html"> sample8.rb </a> <a class="source" href="sample9.html"> sample9.rb </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> sample12.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/sample12'</span> <span class="k">do</span>
|
1
|
+
<!DOCTYPE html> <html> <head> <title>sample12.rb</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <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> sample12.rb </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>GET request</p> </td> <td class="code"> <div class="highlight"><pre><span class="n">get</span> <span class="s1">'/sample12'</span> <span class="k">do</span>
|
2
2
|
<span class="n">haml</span> <span class="ss">:sample12</span>
|
3
3
|
<span class="k">end</span>
|
4
4
|
|
@@ -11,10 +11,10 @@
|
|
11
11
|
|
12
12
|
<span class="k">begin</span>
|
13
13
|
|
14
|
-
<span class="k">raise</span> <span class="
|
14
|
+
<span class="k">raise</span> <span class="s1">'Please enter all required parameters'</span> <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="o">.</span><span class="n">empty?</span> <span class="ow">or</span> <span class="n">settings</span><span class="o">.</span><span class="n">file_id</span><span class="o">.</span><span class="n">empty?</span>
|
15
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="s1">'/'</span><span class="p">,</span> <span class="p">{},</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="s1">'/'</span><span class="p">,</span> <span class="p">{},</span> <span class="p">{</span><span class="ss">:client_id</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:private_key</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">})</span>
|
18
18
|
<span class="n">document</span> <span class="o">=</span> <span class="s1">''</span>
|
19
19
|
|
20
20
|
|
@@ -34,7 +34,7 @@
|
|
34
34
|
<span class="k">end</span>
|
35
35
|
|
36
36
|
|
37
|
-
<span class="n">haml</span> <span class="ss">:sample12</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span
|
37
|
+
<span class="n">haml</span> <span class="ss">:sample12</span><span class="p">,</span> <span class="ss">:locals</span> <span class="o">=></span> <span class="p">{</span><span class="ss">:userId</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">client_id</span><span class="p">,</span> <span class="ss">:privateKey</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">private_key</span><span class="p">,</span> <span class="ss">:annotations</span> <span class="o">=></span> <span class="n">annotations</span><span class="p">,</span> <span class="ss">:fileId</span> <span class="o">=></span> <span class="n">settings</span><span class="o">.</span><span class="n">file_id</span><span class="p">,</span> <span class="ss">:err</span> <span class="o">=></span> <span class="n">err</span><span class="p">}</span>
|
38
38
|
<span class="k">end</span>
|
39
39
|
|
40
40
|
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
|