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,132 +1,374 @@
|
|
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
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
<span class="
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>envelope-sample.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>envelope-sample.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">'/envelope-sample'</span> <span class="keyword">do</span>
|
35
|
+
haml <span class="symbol">:envelope_sample</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 to handle callback when document was signed</p>
|
48
|
+
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div class="content"><div class='highlight'><pre>post <span class="string">'/envelope-sample/sign'</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>Content Type of callback is application/json</p>
|
63
|
+
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<div class="content"><div class='highlight'><pre> data = <span class="constant">JSON</span>.parse(request.body.read)
|
67
|
+
<span class="keyword">begin</span>
|
68
|
+
raise <span class="string">'Empty params!'</span> <span class="keyword">if</span> data.empty?</pre></div></div>
|
69
|
+
|
70
|
+
</li>
|
71
|
+
|
72
|
+
|
73
|
+
<li id="section-4">
|
74
|
+
<div class="annotation">
|
75
|
+
|
76
|
+
<div class="pilwrap ">
|
77
|
+
<a class="pilcrow" href="#section-4">¶</a>
|
78
|
+
</div>
|
79
|
+
<p>create empty file and write data as "key: value" to it</p>
|
80
|
+
|
81
|
+
</div>
|
82
|
+
|
83
|
+
<div class="content"><div class='highlight'><pre> out_file = <span class="constant">File</span>.new(<span class="string">'signed'</span>, <span class="string">'w'</span>)
|
84
|
+
data.each <span class="keyword">do</span> |key, value|
|
85
|
+
out_file.write(<span class="string">"<span class="subst">#{key}</span>: <span class="subst">#{value}</span> \n"</span>)
|
86
|
+
<span class="keyword">end</span>
|
87
|
+
out_file.close
|
88
|
+
<span class="keyword">rescue</span> <span class="constant">Exception</span> => e
|
89
|
+
err = e.message
|
90
|
+
<span class="keyword">end</span>
|
91
|
+
<span class="keyword">end</span></pre></div></div>
|
92
|
+
|
93
|
+
</li>
|
94
|
+
|
95
|
+
|
96
|
+
<li id="section-5">
|
97
|
+
<div class="annotation">
|
98
|
+
|
99
|
+
<div class="pilwrap ">
|
100
|
+
<a class="pilcrow" href="#section-5">¶</a>
|
101
|
+
</div>
|
102
|
+
<p>POST request to handle callback and download envelop when document was signed</p>
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
<div class="content"><div class='highlight'><pre>post <span class="string">'/envelope-sample/sign-and-download'</span> <span class="keyword">do</span>
|
107
|
+
data = <span class="constant">JSON</span>.parse(request.body.read)
|
108
|
+
<span class="keyword">begin</span>
|
109
|
+
raise <span class="string">'Empty params!'</span> <span class="keyword">if</span> data.empty?
|
110
|
+
<span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
|
111
|
+
groupdocs.client_id = <span class="string">''</span> <span class="comment"># Your client Client ID here</span>
|
112
|
+
groupdocs.private_key = <span class="string">''</span> <span class="comment"># Your API Key here</span>
|
113
|
+
groupdocs.api_server = <span class="string">'https://api.groupdocs.com'</span>
|
114
|
+
<span class="keyword">end</span>
|
115
|
+
data.each <span class="keyword">do</span> |key, value|
|
116
|
+
<span class="keyword">if</span> key == <span class="string">'SourceId'</span></pre></div></div>
|
117
|
+
|
118
|
+
</li>
|
119
|
+
|
120
|
+
|
121
|
+
<li id="section-6">
|
122
|
+
<div class="annotation">
|
123
|
+
|
124
|
+
<div class="pilwrap ">
|
125
|
+
<a class="pilcrow" href="#section-6">¶</a>
|
126
|
+
</div>
|
127
|
+
<p>Create envelop with id and name as SourceId parameter from callback</p>
|
128
|
+
|
129
|
+
</div>
|
130
|
+
|
131
|
+
<div class="content"><div class='highlight'><pre> envelope = <span class="constant">GroupDocs::Signature::Envelope</span>.new <span class="symbol">id:</span> value,
|
132
|
+
<span class="symbol">name:</span> value</pre></div></div>
|
133
|
+
|
134
|
+
</li>
|
135
|
+
|
136
|
+
|
137
|
+
<li id="section-7">
|
138
|
+
<div class="annotation">
|
139
|
+
|
140
|
+
<div class="pilwrap ">
|
141
|
+
<a class="pilcrow" href="#section-7">¶</a>
|
142
|
+
</div>
|
143
|
+
<p>download signed documents as archive</p>
|
144
|
+
|
145
|
+
</div>
|
146
|
+
|
147
|
+
<div class="content"><div class='highlight'><pre> envelope.signed_documents! <span class="string">'.'</span>
|
148
|
+
<span class="keyword">end</span>
|
149
|
+
<span class="keyword">end</span>
|
150
|
+
<span class="keyword">rescue</span> <span class="constant">Exception</span> => e
|
151
|
+
err = e.message
|
152
|
+
<span class="keyword">end</span>
|
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>GET request to check if envelop was signed</p>
|
165
|
+
|
166
|
+
</div>
|
167
|
+
|
168
|
+
<div class="content"><div class='highlight'><pre>get <span class="string">'/envelope-sample/check'</span> <span class="keyword">do</span>
|
169
|
+
<span class="keyword">if</span> <span class="constant">File</span>.exist?(<span class="string">'signed'</span>)
|
170
|
+
<span class="constant">File</span>.readlines(<span class="string">'signed'</span>).each <span class="keyword">do</span> |line|
|
171
|
+
<span class="keyword">end</span>
|
172
|
+
<span class="keyword">else</span>
|
173
|
+
<span class="string">'Have not signed yet'</span>
|
174
|
+
<span class="keyword">end</span>
|
175
|
+
<span class="keyword">end</span></pre></div></div>
|
176
|
+
|
177
|
+
</li>
|
178
|
+
|
179
|
+
|
180
|
+
<li id="section-9">
|
181
|
+
<div class="annotation">
|
182
|
+
|
183
|
+
<div class="pilwrap ">
|
184
|
+
<a class="pilcrow" href="#section-9">¶</a>
|
185
|
+
</div>
|
186
|
+
<p>POST request</p>
|
187
|
+
|
188
|
+
</div>
|
189
|
+
|
190
|
+
<div class="content"><div class='highlight'><pre>post <span class="string">'/envelope-sample'</span> <span class="keyword">do</span>
|
191
|
+
set <span class="symbol">:client_id</span>, params[<span class="symbol">:client_id</span>]
|
192
|
+
set <span class="symbol">:private_key</span>, params[<span class="symbol">:private_key</span>]
|
193
|
+
|
194
|
+
<span class="keyword">begin</span>
|
195
|
+
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?
|
196
|
+
|
197
|
+
<span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
|
198
|
+
groupdocs.client_id = params[<span class="symbol">:client_id</span>]
|
199
|
+
groupdocs.private_key = params[<span class="symbol">:private_key</span>]
|
200
|
+
groupdocs.api_server = <span class="string">'https://stage-api.groupdocs.com'</span>
|
201
|
+
<span class="keyword">end</span></pre></div></div>
|
202
|
+
|
203
|
+
</li>
|
204
|
+
|
205
|
+
|
206
|
+
<li id="section-10">
|
207
|
+
<div class="annotation">
|
208
|
+
|
209
|
+
<div class="pilwrap ">
|
210
|
+
<a class="pilcrow" href="#section-10">¶</a>
|
211
|
+
</div>
|
212
|
+
<p>upload document</p>
|
213
|
+
|
214
|
+
</div>
|
215
|
+
|
216
|
+
<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>
|
217
|
+
<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) }
|
218
|
+
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)
|
219
|
+
document = file.to_document</pre></div></div>
|
220
|
+
|
221
|
+
</li>
|
222
|
+
|
223
|
+
|
224
|
+
<li id="section-11">
|
225
|
+
<div class="annotation">
|
226
|
+
|
227
|
+
<div class="pilwrap ">
|
228
|
+
<a class="pilcrow" href="#section-11">¶</a>
|
229
|
+
</div>
|
230
|
+
<p>create envelope</p>
|
231
|
+
|
232
|
+
</div>
|
233
|
+
|
234
|
+
<div class="content"><div class='highlight'><pre> envelope = <span class="constant">GroupDocs::Signature::Envelope</span>.new
|
235
|
+
envelope.name = <span class="string">'Envelope'</span>
|
236
|
+
envelope.email_subject = <span class="string">'Sing this!'</span>
|
237
|
+
envelope.create!</pre></div></div>
|
238
|
+
|
239
|
+
</li>
|
240
|
+
|
241
|
+
|
242
|
+
<li id="section-12">
|
243
|
+
<div class="annotation">
|
244
|
+
|
245
|
+
<div class="pilwrap ">
|
246
|
+
<a class="pilcrow" href="#section-12">¶</a>
|
247
|
+
</div>
|
248
|
+
<p>add document to envelope</p>
|
249
|
+
|
250
|
+
</div>
|
251
|
+
|
252
|
+
<div class="content"><div class='highlight'><pre> envelope.add_document! document</pre></div></div>
|
253
|
+
|
254
|
+
</li>
|
255
|
+
|
256
|
+
|
257
|
+
<li id="section-13">
|
258
|
+
<div class="annotation">
|
259
|
+
|
260
|
+
<div class="pilwrap ">
|
261
|
+
<a class="pilcrow" href="#section-13">¶</a>
|
262
|
+
</div>
|
263
|
+
<p>update document object after it's created</p>
|
264
|
+
|
265
|
+
</div>
|
266
|
+
|
267
|
+
<div class="content"><div class='highlight'><pre> document = envelope.documents!.first</pre></div></div>
|
268
|
+
|
269
|
+
</li>
|
270
|
+
|
271
|
+
|
272
|
+
<li id="section-14">
|
273
|
+
<div class="annotation">
|
274
|
+
|
275
|
+
<div class="pilwrap ">
|
276
|
+
<a class="pilcrow" href="#section-14">¶</a>
|
277
|
+
</div>
|
278
|
+
<p>add new recipient to envelope</p>
|
279
|
+
|
280
|
+
</div>
|
281
|
+
|
282
|
+
<div class="content"><div class='highlight'><pre> roles = <span class="constant">GroupDocs::Signature::Role</span>.get!
|
283
|
+
recipient = <span class="constant">GroupDocs::Signature::Recipient</span>.new
|
284
|
+
recipient.email = <span class="string">'john@smith.com'</span>
|
285
|
+
recipient.first_name = <span class="string">'John'</span>
|
286
|
+
recipient.last_name = <span class="string">'Smith'</span>
|
287
|
+
recipient.role_id = roles.detect { |role| role.name == <span class="string">'Signer'</span> }.id
|
288
|
+
envelope.add_recipient! recipient</pre></div></div>
|
289
|
+
|
290
|
+
</li>
|
291
|
+
|
292
|
+
|
293
|
+
<li id="section-15">
|
294
|
+
<div class="annotation">
|
295
|
+
|
296
|
+
<div class="pilwrap ">
|
297
|
+
<a class="pilcrow" href="#section-15">¶</a>
|
298
|
+
</div>
|
299
|
+
<p>update recipient object after it's created</p>
|
300
|
+
|
301
|
+
</div>
|
302
|
+
|
303
|
+
<div class="content"><div class='highlight'><pre> recipient = envelope.recipients!.first</pre></div></div>
|
304
|
+
|
305
|
+
</li>
|
306
|
+
|
307
|
+
|
308
|
+
<li id="section-16">
|
309
|
+
<div class="annotation">
|
310
|
+
|
311
|
+
<div class="pilwrap ">
|
312
|
+
<a class="pilcrow" href="#section-16">¶</a>
|
313
|
+
</div>
|
314
|
+
<p>You can add fields manually.</p>
|
315
|
+
<p>add city field to envelope
|
316
|
+
field = GroupDocs::Signature::Field.get!.detect { |f| f.type == :single_line }
|
317
|
+
field.name = 'City'
|
318
|
+
field.location = { location_x: 0.3, location_y: 0.2, page: 1 }
|
319
|
+
envelope.add_field! field, document, recipient</p>
|
320
|
+
<p>add signature field to envelope
|
110
321
|
field = GroupDocs::Signature::Field.get!.detect { |f| f.type == :signature }
|
111
|
-
field.location = {
|
112
|
-
envelope.add_field! field, document, recipient</p>
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
322
|
+
field.location = { location_x: 0.3, location_y: 0.3, page: 1 }
|
323
|
+
envelope.add_field! field, document, recipient</p>
|
324
|
+
<p>URL for callback
|
325
|
+
webhook = '<a href="http://groupdocs-ruby-samples.herokuapp.com/envelope-sample/sign">http://groupdocs-ruby-samples.herokuapp.com/envelope-sample/sign</a>'</p>
|
326
|
+
|
327
|
+
</div>
|
328
|
+
|
329
|
+
<div class="content"><div class='highlight'><pre> webhook = <span class="string">'http://77.81.243.48/?q=groupdocs_signature/signature_callback'</span></pre></div></div>
|
330
|
+
|
331
|
+
</li>
|
332
|
+
|
333
|
+
|
334
|
+
<li id="section-17">
|
335
|
+
<div class="annotation">
|
336
|
+
|
337
|
+
<div class="pilwrap ">
|
338
|
+
<a class="pilcrow" href="#section-17">¶</a>
|
339
|
+
</div>
|
340
|
+
<p>send envelope</p>
|
341
|
+
|
342
|
+
</div>
|
343
|
+
|
344
|
+
<div class="content"><div class='highlight'><pre> envelope.send! webhook</pre></div></div>
|
345
|
+
|
346
|
+
</li>
|
347
|
+
|
348
|
+
|
349
|
+
<li id="section-18">
|
350
|
+
<div class="annotation">
|
351
|
+
|
352
|
+
<div class="pilwrap ">
|
353
|
+
<a class="pilcrow" href="#section-18">¶</a>
|
354
|
+
</div>
|
355
|
+
<p>construct embedded signature url</p>
|
356
|
+
|
357
|
+
</div>
|
358
|
+
|
359
|
+
<div class="content"><div class='highlight'><pre> url = <span class="string">"https://stage-apps.groupdocs.com/signature/signembed/<span class="subst">#{envelope.id}</span>/<span class="subst">#{recipient.id}</span>"</span>
|
360
|
+
iframe = <span class="string">"<iframe src='<span class="subst">#{url}</span>' frameborder='0' width='720' height='600'></iframe>"</span>
|
361
|
+
|
362
|
+
<span class="keyword">rescue</span> <span class="constant">Exception</span> => e
|
363
|
+
err = e.message
|
364
|
+
<span class="keyword">end</span>
|
365
|
+
|
366
|
+
haml <span class="symbol">:envelope_sample</span>, <span class="symbol">:locals</span> => {<span class="symbol">:client_id</span> => settings.client_id, <span class="symbol">:private_key</span> => settings.private_key, <span class="symbol">:err</span> => err, <span class="symbol">:iframe</span> => iframe}
|
367
|
+
<span class="keyword">end</span></pre></div></div>
|
368
|
+
|
369
|
+
</li>
|
370
|
+
|
371
|
+
</ul>
|
372
|
+
</div>
|
373
|
+
</body>
|
374
|
+
</html>
|