groupdocs 1.5.3 → 1.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +0 -1
- data/README.md +2 -0
- data/examples/api-samples/public/docs/annotation-sample.html +167 -57
- data/examples/api-samples/public/docs/docco.css +459 -151
- data/examples/api-samples/public/docs/envelope-sample.html +373 -131
- data/examples/api-samples/public/docs/sample1.html +126 -26
- data/examples/api-samples/public/docs/sample10.html +213 -50
- data/examples/api-samples/public/docs/sample11.html +319 -87
- data/examples/api-samples/public/docs/sample12.html +165 -40
- data/examples/api-samples/public/docs/sample13.html +166 -41
- data/examples/api-samples/public/docs/sample14.html +142 -30
- data/examples/api-samples/public/docs/sample15.html +127 -27
- data/examples/api-samples/public/docs/sample16.html +125 -25
- data/examples/api-samples/public/docs/sample17.html +188 -37
- data/examples/api-samples/public/docs/sample18.html +614 -157
- data/examples/api-samples/public/docs/sample19.html +221 -59
- data/examples/api-samples/public/docs/sample2.html +142 -30
- data/examples/api-samples/public/docs/sample20.html +176 -51
- data/examples/api-samples/public/docs/sample21.html +287 -66
- data/examples/api-samples/public/docs/sample22.html +224 -53
- data/examples/api-samples/public/docs/sample23.html +256 -0
- data/examples/api-samples/public/docs/sample24.html +143 -0
- data/examples/api-samples/public/docs/sample25.html +429 -0
- data/examples/api-samples/public/docs/sample26.html +113 -0
- data/examples/api-samples/public/docs/sample27.html +433 -0
- data/examples/api-samples/public/docs/sample28.html +185 -0
- data/examples/api-samples/public/docs/sample29.html +175 -0
- data/examples/api-samples/public/docs/sample3.html +172 -34
- data/examples/api-samples/public/docs/sample30.html +144 -0
- data/examples/api-samples/public/docs/sample31.html +734 -0
- data/examples/api-samples/public/docs/sample4.html +204 -52
- data/examples/api-samples/public/docs/sample5.html +241 -63
- data/examples/api-samples/public/docs/sample6.html +209 -48
- data/examples/api-samples/public/docs/sample7.html +155 -43
- data/examples/api-samples/public/docs/sample8.html +235 -62
- data/examples/api-samples/public/docs/sample9.html +200 -49
- data/examples/api-samples/public/templates/merge_field1_doc.docx +0 -0
- data/examples/api-samples/public/templates/merge_field2_doc.docx +0 -0
- data/examples/api-samples/samples/sample23.rb +54 -0
- data/examples/api-samples/samples/sample24.rb +30 -0
- data/examples/api-samples/samples/sample25.rb +4 -4
- data/examples/api-samples/samples/sample26.rb +25 -0
- data/examples/api-samples/samples/sample27.rb +100 -0
- data/examples/api-samples/samples/sample28.rb +47 -0
- data/examples/api-samples/samples/sample29.rb +52 -0
- data/examples/api-samples/samples/sample30.rb +39 -0
- data/examples/api-samples/samples/sample31.rb +204 -0
- data/examples/api-samples/samples/sample5.rb +5 -3
- data/examples/api-samples/samples/sample6.rb +2 -0
- data/examples/api-samples/views/_others_samples.haml +12 -0
- data/examples/api-samples/views/index.haml +12 -0
- data/examples/api-samples/views/layout.haml +1 -0
- data/examples/api-samples/views/sample1.haml +3 -2
- data/examples/api-samples/views/sample10.haml +3 -2
- data/examples/api-samples/views/sample11.haml +4 -0
- data/examples/api-samples/views/sample12.haml +4 -0
- data/examples/api-samples/views/sample13.haml +4 -0
- data/examples/api-samples/views/sample14.haml +4 -0
- data/examples/api-samples/views/sample15.haml +4 -0
- data/examples/api-samples/views/sample16.haml +4 -0
- data/examples/api-samples/views/sample17.haml +4 -0
- data/examples/api-samples/views/sample19.haml +4 -0
- data/examples/api-samples/views/sample2.haml +3 -2
- data/examples/api-samples/views/sample20.haml +4 -0
- data/examples/api-samples/views/sample21.haml +4 -0
- data/examples/api-samples/views/sample22.haml +4 -0
- data/examples/api-samples/views/sample23.haml +87 -0
- data/examples/api-samples/views/sample24.haml +44 -0
- data/examples/api-samples/views/sample26.haml +54 -0
- data/examples/api-samples/views/sample27.haml +122 -0
- data/examples/api-samples/views/sample28.haml +47 -0
- data/examples/api-samples/views/sample29.haml +70 -0
- data/examples/api-samples/views/sample3.haml +3 -2
- data/examples/api-samples/views/sample30.haml +46 -0
- data/examples/api-samples/views/sample31.haml +114 -0
- data/examples/api-samples/views/sample4.haml +3 -2
- data/examples/api-samples/views/sample5.haml +3 -2
- data/examples/api-samples/views/sample6.haml +3 -2
- data/examples/api-samples/views/sample7.haml +3 -2
- data/examples/api-samples/views/sample8.haml +3 -2
- data/examples/api-samples/views/sample9.haml +3 -2
- data/examples/viewer/Gemfile +1 -1
- data/groupdocs.gemspec +3 -3
- data/lib/groupdocs/datasource.rb +22 -0
- data/lib/groupdocs/document.rb +493 -43
- data/lib/groupdocs/document/annotation.rb +73 -0
- data/lib/groupdocs/job.rb +82 -1
- data/lib/groupdocs/post.rb +83 -0
- data/lib/groupdocs/questionnaire.rb +41 -0
- data/lib/groupdocs/signature.rb +342 -0
- data/lib/groupdocs/signature/envelope.rb +56 -0
- data/lib/groupdocs/signature/form.rb +47 -5
- data/lib/groupdocs/signature/shared/field_methods.rb +37 -0
- data/lib/groupdocs/storage/file.rb +83 -0
- data/lib/groupdocs/subscription.rb +218 -0
- data/lib/groupdocs/user.rb +422 -1
- data/lib/groupdocs/version.rb +1 -1
- data/spec/groupdocs/job_spec.rb +4 -5
- data/spec/groupdocs/user_spec.rb +157 -0
- data/spec/support/json/annotation_resize.json +11 -0
- data/spec/support/json/annotation_text_color.json +10 -0
- data/spec/support/json/annotation_text_info.json +11 -0
- data/spec/support/json/document_content_get.json +8 -0
- data/spec/support/json/document_edit_lock_get.json +10 -0
- data/spec/support/json/document_editlock_remove.json +8 -0
- data/spec/support/json/document_page_html_urls_get.json +14 -0
- data/spec/support/json/document_password_set.json +19 -0
- data/spec/support/json/document_representations.json +25 -0
- data/spec/support/json/document_shared_documents_get.json +32 -0
- data/spec/support/json/document_tags_get.json +9 -0
- data/spec/support/json/document_tags_remove.json +8 -0
- data/spec/support/json/document_tags_set.json +8 -0
- data/spec/support/json/document_user_status_set.json +12 -0
- data/spec/support/json/job_documents.json +103 -35
- data/spec/support/json/job_xml_get.json +30 -0
- data/spec/support/json/jobs_documents.json +40 -0
- data/spec/support/json/user_get_profile.json +73 -0
- metadata +49 -177
@@ -1,51 +1,176 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
<
|
7
|
-
|
8
|
-
<
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>sample20.rb</title>
|
6
|
+
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
7
|
+
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
|
8
|
+
<link rel="stylesheet" media="all" href="docco.css" />
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div id="container">
|
12
|
+
<div id="background"></div>
|
13
|
+
|
14
|
+
<ul class="sections">
|
15
|
+
|
16
|
+
<li id="title">
|
17
|
+
<div class="annotation">
|
18
|
+
<h1>sample20.rb</h1>
|
19
|
+
</div>
|
20
|
+
</li>
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
<li id="section-1">
|
25
|
+
<div class="annotation">
|
26
|
+
|
27
|
+
<div class="pilwrap ">
|
28
|
+
<a class="pilcrow" href="#section-1">¶</a>
|
29
|
+
</div>
|
30
|
+
<p>GET request</p>
|
31
|
+
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<div class="content"><div class='highlight'><pre>get <span class="string">'/sample20'</span> <span class="keyword">do</span>
|
35
|
+
haml <span class="symbol">:sample20</span>
|
36
|
+
<span class="keyword">end</span></pre></div></div>
|
37
|
+
|
38
|
+
</li>
|
39
|
+
|
40
|
+
|
41
|
+
<li id="section-2">
|
42
|
+
<div class="annotation">
|
43
|
+
|
44
|
+
<div class="pilwrap ">
|
45
|
+
<a class="pilcrow" href="#section-2">¶</a>
|
46
|
+
</div>
|
47
|
+
<p>POST request</p>
|
48
|
+
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div class="content"><div class='highlight'><pre>post <span class="string">'/sample20'</span> <span class="keyword">do</span></pre></div></div>
|
52
|
+
|
53
|
+
</li>
|
54
|
+
|
55
|
+
|
56
|
+
<li id="section-3">
|
57
|
+
<div class="annotation">
|
58
|
+
|
59
|
+
<div class="pilwrap ">
|
60
|
+
<a class="pilcrow" href="#section-3">¶</a>
|
61
|
+
</div>
|
62
|
+
<p>set variables</p>
|
63
|
+
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:client_id</span>]
|
67
|
+
set <span class="symbol">:private_key</span>, params[<span class="symbol">:private_key</span>]
|
68
|
+
set <span class="symbol">:resultFileId</span>, params[<span class="symbol">:resultFileId</span>]
|
69
|
+
|
70
|
+
<span class="keyword">begin</span></pre></div></div>
|
71
|
+
|
72
|
+
</li>
|
73
|
+
|
74
|
+
|
75
|
+
<li id="section-4">
|
76
|
+
<div class="annotation">
|
77
|
+
|
78
|
+
<div class="pilwrap ">
|
79
|
+
<a class="pilcrow" href="#section-4">¶</a>
|
80
|
+
</div>
|
81
|
+
<p>check required variables</p>
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.client_id.empty? <span class="keyword">or</span> settings.private_key.empty? <span class="keyword">or</span> settings.resultFileId.empty?</pre></div></div>
|
86
|
+
|
87
|
+
</li>
|
88
|
+
|
89
|
+
|
90
|
+
<li id="section-5">
|
91
|
+
<div class="annotation">
|
92
|
+
|
93
|
+
<div class="pilwrap ">
|
94
|
+
<a class="pilcrow" href="#section-5">¶</a>
|
95
|
+
</div>
|
96
|
+
<p>construct new storage file</p>
|
97
|
+
|
98
|
+
</div>
|
99
|
+
|
100
|
+
<div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.new(<span class="symbol">guid:</span> settings.resultFileId)</pre></div></div>
|
101
|
+
|
102
|
+
</li>
|
103
|
+
|
104
|
+
|
105
|
+
<li id="section-6">
|
106
|
+
<div class="annotation">
|
107
|
+
|
108
|
+
<div class="pilwrap ">
|
109
|
+
<a class="pilcrow" href="#section-6">¶</a>
|
110
|
+
</div>
|
111
|
+
<p>construct new document</p>
|
112
|
+
|
113
|
+
</div>
|
114
|
+
|
115
|
+
<div class="content"><div class='highlight'><pre> document = <span class="constant">GroupDocs::Document</span>.new(<span class="symbol">file:</span> file)</pre></div></div>
|
116
|
+
|
117
|
+
</li>
|
118
|
+
|
119
|
+
|
120
|
+
<li id="section-7">
|
121
|
+
<div class="annotation">
|
122
|
+
|
123
|
+
<div class="pilwrap ">
|
124
|
+
<a class="pilcrow" href="#section-7">¶</a>
|
125
|
+
</div>
|
126
|
+
<p>get compare changes</p>
|
127
|
+
|
128
|
+
</div>
|
129
|
+
|
130
|
+
<div class="content"><div class='highlight'><pre> changes = document.changes!({<span class="symbol">:client_id</span> => settings.client_id, <span class="symbol">:private_key</span> => settings.private_key})
|
131
|
+
|
132
|
+
result = <span class="string">''</span>
|
133
|
+
result += <span class="string">"<table class='border'>"</span>
|
134
|
+
result += <span class="string">"<tr><td><font color='green'>Change Name</font></td><td><font color='green'>Change</font></td></tr>"</span>
|
135
|
+
changes.each <span class="keyword">do</span> |change|
|
136
|
+
result += <span class="string">"<tr><td>id</td><td><span class="subst">#{change.id}</span></td></tr>"</span>
|
137
|
+
result += <span class="string">"<tr><td>type</td><td><span class="subst">#{change.type}</span></td></tr>"</span>
|
138
|
+
result += <span class="string">"<tr><td>text</td><td><span class="subst">#{change.text}</span></td></tr>"</span>
|
139
|
+
result += <span class="string">"<tr><td>page id</td><td><span class="subst">#{change.page[<span class="symbol">:Id</span>]}</span></td></tr>"</span>
|
140
|
+
result += <span class="string">"<tr><td>page weight</td><td><span class="subst">#{change.page[<span class="symbol">:Width</span>]}</span></td></tr>"</span>
|
141
|
+
result += <span class="string">"<tr><td>page height</td><td><span class="subst">#{change.page[<span class="symbol">:Height</span>]}</span></td></tr>"</span>
|
142
|
+
result += <span class="string">"<tr><td>box x</td><td><span class="subst">#{change.box.x}</span></td></tr>"</span>
|
143
|
+
result += <span class="string">"<tr><td>box y</td><td><span class="subst">#{change.box.y}</span></td></tr>"</span>
|
144
|
+
result += <span class="string">"<tr><td>box weight</td><td><span class="subst">#{change.box.width}</span></td></tr>"</span>
|
145
|
+
result += <span class="string">"<tr><td>box height</td><td><span class="subst">#{change.box.height}</span></td></tr>"</span>
|
146
|
+
result += <span class="string">"<tr bgcolor='#808080'><td></td><td></td></tr>"</span>
|
147
|
+
<span class="keyword">end</span>
|
148
|
+
|
149
|
+
result += <span class="string">'</table>'</span>
|
150
|
+
|
151
|
+
<span class="keyword">rescue</span> <span class="constant">Exception</span> => e
|
152
|
+
err = e.message
|
153
|
+
<span class="keyword">end</span></pre></div></div>
|
154
|
+
|
155
|
+
</li>
|
156
|
+
|
157
|
+
|
158
|
+
<li id="section-8">
|
159
|
+
<div class="annotation">
|
160
|
+
|
161
|
+
<div class="pilwrap ">
|
162
|
+
<a class="pilcrow" href="#section-8">¶</a>
|
163
|
+
</div>
|
164
|
+
<p>set variables for template</p>
|
165
|
+
|
166
|
+
</div>
|
167
|
+
|
168
|
+
<div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample20</span>, <span class="symbol">:locals</span> => {<span class="symbol">:userId</span> => settings.client_id, <span class="symbol">:privateKey</span> => settings.private_key, <span class="symbol">:resultFileId</span> => settings.resultFileId, <span class="symbol">:result</span> => result, <span class="symbol">:err</span> => err}
|
169
|
+
<span class="keyword">end</span></pre></div></div>
|
170
|
+
|
171
|
+
</li>
|
172
|
+
|
173
|
+
</ul>
|
174
|
+
</div>
|
175
|
+
</body>
|
176
|
+
</html>
|
@@ -1,66 +1,287 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
<
|
7
|
-
|
8
|
-
<
|
9
|
-
|
10
|
-
|
11
|
-
<
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>sample21.rb</title>
|
6
|
+
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
7
|
+
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
|
8
|
+
<link rel="stylesheet" media="all" href="docco.css" />
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div id="container">
|
12
|
+
<div id="background"></div>
|
13
|
+
|
14
|
+
<ul class="sections">
|
15
|
+
|
16
|
+
<li id="title">
|
17
|
+
<div class="annotation">
|
18
|
+
<h1>sample21.rb</h1>
|
19
|
+
</div>
|
20
|
+
</li>
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
<li id="section-1">
|
25
|
+
<div class="annotation">
|
26
|
+
|
27
|
+
<div class="pilwrap ">
|
28
|
+
<a class="pilcrow" href="#section-1">¶</a>
|
29
|
+
</div>
|
30
|
+
<p>GET request</p>
|
31
|
+
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<div class="content"><div class='highlight'><pre>get <span class="string">'/sample21'</span> <span class="keyword">do</span>
|
35
|
+
haml <span class="symbol">:sample21</span>
|
36
|
+
<span class="keyword">end</span></pre></div></div>
|
37
|
+
|
38
|
+
</li>
|
39
|
+
|
40
|
+
|
41
|
+
<li id="section-2">
|
42
|
+
<div class="annotation">
|
43
|
+
|
44
|
+
<div class="pilwrap ">
|
45
|
+
<a class="pilcrow" href="#section-2">¶</a>
|
46
|
+
</div>
|
47
|
+
<p>POST request</p>
|
48
|
+
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div class="content"><div class='highlight'><pre>post <span class="string">'/sample21'</span> <span class="keyword">do</span></pre></div></div>
|
52
|
+
|
53
|
+
</li>
|
54
|
+
|
55
|
+
|
56
|
+
<li id="section-3">
|
57
|
+
<div class="annotation">
|
58
|
+
|
59
|
+
<div class="pilwrap ">
|
60
|
+
<a class="pilcrow" href="#section-3">¶</a>
|
61
|
+
</div>
|
62
|
+
<p>set variables</p>
|
63
|
+
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:client_id</span>]
|
67
|
+
set <span class="symbol">:private_key</span>, params[<span class="symbol">:private_key</span>]
|
68
|
+
set <span class="symbol">:email</span>, params[<span class="symbol">:email</span>]
|
69
|
+
set <span class="symbol">:name</span>, params[<span class="symbol">:name</span>]
|
70
|
+
set <span class="symbol">:lastName</span>, params[<span class="symbol">:lastName</span>]
|
71
|
+
set <span class="symbol">:file</span>, params[<span class="symbol">:file</span>]
|
72
|
+
|
73
|
+
<span class="keyword">begin</span></pre></div></div>
|
74
|
+
|
75
|
+
</li>
|
76
|
+
|
77
|
+
|
78
|
+
<li id="section-4">
|
79
|
+
<div class="annotation">
|
80
|
+
|
81
|
+
<div class="pilwrap ">
|
82
|
+
<a class="pilcrow" href="#section-4">¶</a>
|
83
|
+
</div>
|
84
|
+
<p>check required variables</p>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.client_id.empty? <span class="keyword">or</span> settings.private_key.empty? <span class="keyword">or</span> settings.email.empty? <span class="keyword">or</span> settings.name.empty? <span class="keyword">or</span> settings.lastName.empty? <span class="keyword">or</span> settings.file.<span class="keyword">nil</span>?</pre></div></div>
|
89
|
+
|
90
|
+
</li>
|
91
|
+
|
92
|
+
|
93
|
+
<li id="section-5">
|
94
|
+
<div class="annotation">
|
95
|
+
|
96
|
+
<div class="pilwrap ">
|
97
|
+
<a class="pilcrow" href="#section-5">¶</a>
|
98
|
+
</div>
|
99
|
+
<p>construct path</p>
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
<div class="content"><div class='highlight'><pre> filepath = <span class="string">"<span class="subst">#{<span class="constant">Dir</span>.tmpdir}</span>/<span class="subst">#{params[<span class="symbol">:file</span>][<span class="symbol">:filename</span>]}</span>"</span></pre></div></div>
|
104
|
+
|
105
|
+
</li>
|
106
|
+
|
107
|
+
|
108
|
+
<li id="section-6">
|
109
|
+
<div class="annotation">
|
110
|
+
|
111
|
+
<div class="pilwrap ">
|
112
|
+
<a class="pilcrow" href="#section-6">¶</a>
|
113
|
+
</div>
|
114
|
+
<p>open file</p>
|
115
|
+
|
116
|
+
</div>
|
117
|
+
|
118
|
+
<div class="content"><div class='highlight'><pre> <span class="constant">File</span>.open(filepath, <span class="string">'wb'</span>) { |f| f.write(params[<span class="symbol">:file</span>][<span class="symbol">:tempfile</span>].read) }</pre></div></div>
|
119
|
+
|
120
|
+
</li>
|
121
|
+
|
122
|
+
|
123
|
+
<li id="section-7">
|
124
|
+
<div class="annotation">
|
125
|
+
|
126
|
+
<div class="pilwrap ">
|
127
|
+
<a class="pilcrow" href="#section-7">¶</a>
|
128
|
+
</div>
|
129
|
+
<p>upload file</p>
|
130
|
+
|
131
|
+
</div>
|
132
|
+
|
133
|
+
<div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload!(filepath, {}, <span class="symbol">client_id:</span> settings.client_id, <span class="symbol">private_key:</span> settings.private_key)</pre></div></div>
|
134
|
+
|
135
|
+
</li>
|
136
|
+
|
137
|
+
|
138
|
+
<li id="section-8">
|
139
|
+
<div class="annotation">
|
140
|
+
|
141
|
+
<div class="pilwrap ">
|
142
|
+
<a class="pilcrow" href="#section-8">¶</a>
|
143
|
+
</div>
|
144
|
+
<p>create envelope using user id and entered by user name</p>
|
145
|
+
|
146
|
+
</div>
|
147
|
+
|
148
|
+
<div class="content"><div class='highlight'><pre> envelope = <span class="constant">GroupDocs::Signature::Envelope</span>.new
|
149
|
+
envelope.name = params[<span class="symbol">:file</span>][<span class="symbol">:filename</span>]
|
150
|
+
envelope.email_subject = <span class="string">'Sing this!'</span>
|
151
|
+
envelope.create!({}, <span class="symbol">client_id:</span> settings.client_id, <span class="symbol">private_key:</span> settings.private_key)</pre></div></div>
|
152
|
+
|
153
|
+
</li>
|
154
|
+
|
155
|
+
|
156
|
+
<li id="section-9">
|
157
|
+
<div class="annotation">
|
158
|
+
|
159
|
+
<div class="pilwrap ">
|
160
|
+
<a class="pilcrow" href="#section-9">¶</a>
|
161
|
+
</div>
|
162
|
+
<p>Add uploaded document to envelope</p>
|
163
|
+
|
164
|
+
</div>
|
165
|
+
|
166
|
+
<div class="content"><div class='highlight'><pre> envelope.add_document!(file.to_document, {}, {<span class="symbol">client_id:</span> settings.client_id, <span class="symbol">private_key:</span> settings.private_key})</pre></div></div>
|
167
|
+
|
168
|
+
</li>
|
169
|
+
|
170
|
+
|
171
|
+
<li id="section-10">
|
172
|
+
<div class="annotation">
|
173
|
+
|
174
|
+
<div class="pilwrap ">
|
175
|
+
<a class="pilcrow" href="#section-10">¶</a>
|
176
|
+
</div>
|
177
|
+
<p>Get role list for current user</p>
|
178
|
+
|
179
|
+
</div>
|
180
|
+
|
181
|
+
<div class="content"><div class='highlight'><pre> roles = <span class="constant">GroupDocs::Signature::Role</span>.get!({}, {<span class="symbol">client_id:</span> settings.client_id, <span class="symbol">private_key:</span> settings.private_key})</pre></div></div>
|
182
|
+
|
183
|
+
</li>
|
184
|
+
|
185
|
+
|
186
|
+
<li id="section-11">
|
187
|
+
<div class="annotation">
|
188
|
+
|
189
|
+
<div class="pilwrap ">
|
190
|
+
<a class="pilcrow" href="#section-11">¶</a>
|
191
|
+
</div>
|
192
|
+
<p>Create new recipient</p>
|
193
|
+
|
194
|
+
</div>
|
195
|
+
|
196
|
+
<div class="content"><div class='highlight'><pre> recipient = <span class="constant">GroupDocs::Signature::Recipient</span>.new
|
197
|
+
recipient.email = settings.email
|
198
|
+
recipient.first_name = settings.name
|
199
|
+
recipient.last_name = settings.lastName
|
200
|
+
recipient.role_id = roles.detect { |role| role.name == <span class="string">'Signer'</span> }.id</pre></div></div>
|
201
|
+
|
202
|
+
</li>
|
203
|
+
|
204
|
+
|
205
|
+
<li id="section-12">
|
206
|
+
<div class="annotation">
|
207
|
+
|
208
|
+
<div class="pilwrap ">
|
209
|
+
<a class="pilcrow" href="#section-12">¶</a>
|
210
|
+
</div>
|
211
|
+
<p>Add recipient to envelope</p>
|
212
|
+
|
213
|
+
</div>
|
214
|
+
|
215
|
+
<div class="content"><div class='highlight'><pre> add = envelope.add_recipient!(recipient, {<span class="symbol">client_id:</span> settings.client_id, <span class="symbol">private_key:</span> settings.private_key})</pre></div></div>
|
216
|
+
|
217
|
+
</li>
|
218
|
+
|
219
|
+
|
220
|
+
<li id="section-13">
|
221
|
+
<div class="annotation">
|
222
|
+
|
223
|
+
<div class="pilwrap ">
|
224
|
+
<a class="pilcrow" href="#section-13">¶</a>
|
225
|
+
</div>
|
226
|
+
<p>get recipient id</p>
|
227
|
+
|
228
|
+
</div>
|
229
|
+
|
230
|
+
<div class="content"><div class='highlight'><pre> recipient_id = add[<span class="symbol">:recipient</span>][<span class="symbol">:id</span>]</pre></div></div>
|
231
|
+
|
232
|
+
</li>
|
233
|
+
|
234
|
+
|
235
|
+
<li id="section-14">
|
236
|
+
<div class="annotation">
|
237
|
+
|
238
|
+
<div class="pilwrap ">
|
239
|
+
<a class="pilcrow" href="#section-14">¶</a>
|
240
|
+
</div>
|
241
|
+
<p>Send envelop</p>
|
242
|
+
|
243
|
+
</div>
|
244
|
+
|
245
|
+
<div class="content"><div class='highlight'><pre> envelope.send!(<span class="keyword">nil</span>, {<span class="symbol">client_id:</span> settings.client_id, <span class="symbol">private_key:</span> settings.private_key})</pre></div></div>
|
246
|
+
|
247
|
+
</li>
|
248
|
+
|
249
|
+
|
250
|
+
<li id="section-15">
|
251
|
+
<div class="annotation">
|
252
|
+
|
253
|
+
<div class="pilwrap ">
|
254
|
+
<a class="pilcrow" href="#section-15">¶</a>
|
255
|
+
</div>
|
256
|
+
<p>Make iframe</p>
|
257
|
+
|
258
|
+
</div>
|
259
|
+
|
260
|
+
<div class="content"><div class='highlight'><pre> iframe = <span class="string">"<iframe src='https://apps.groupdocs.com/signature/signembed/<span class="subst">#{envelope.id}</span>/<span class="subst">#{recipient_id}</span>' frameborder='0' width='720' height='600'></iframe>"</span>
|
261
|
+
|
262
|
+
<span class="keyword">rescue</span> <span class="constant">Exception</span> => e
|
263
|
+
err = e.message
|
264
|
+
<span class="keyword">end</span></pre></div></div>
|
265
|
+
|
266
|
+
</li>
|
267
|
+
|
268
|
+
|
269
|
+
<li id="section-16">
|
270
|
+
<div class="annotation">
|
271
|
+
|
272
|
+
<div class="pilwrap ">
|
273
|
+
<a class="pilcrow" href="#section-16">¶</a>
|
274
|
+
</div>
|
275
|
+
<p>set variables for template</p>
|
276
|
+
|
277
|
+
</div>
|
278
|
+
|
279
|
+
<div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample21</span>, <span class="symbol">:locals</span> => {<span class="symbol">:userId</span> => settings.client_id, <span class="symbol">:privateKey</span> => settings.private_key, <span class="symbol">:email</span> => settings.email, <span class="symbol">:name</span> => settings.name, <span class="symbol">:lastName</span> => settings.lastName, <span class="symbol">:iframe</span> => iframe, <span class="symbol">:err</span> => err}
|
280
|
+
<span class="keyword">end</span></pre></div></div>
|
281
|
+
|
282
|
+
</li>
|
283
|
+
|
284
|
+
</ul>
|
285
|
+
</div>
|
286
|
+
</body>
|
287
|
+
</html>
|