groupdocs 1.5.7 → 1.5.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +51 -0
- data/examples/api-samples/Gemfile +1 -1
- data/examples/api-samples/Gemfile.lock +43 -0
- data/examples/api-samples/public/docs/{sample2.html → sample01.html} +39 -19
- data/examples/api-samples/public/docs/{sample3.html → sample02.html} +28 -22
- data/examples/api-samples/public/docs/sample03.html +285 -0
- data/examples/api-samples/public/docs/{sample4.html → sample04.html} +30 -36
- data/examples/api-samples/public/docs/{sample5.html → sample05.html} +68 -31
- data/examples/api-samples/public/docs/sample06.html +299 -0
- data/examples/api-samples/public/docs/{sample7.html → sample07.html} +53 -18
- data/examples/api-samples/public/docs/{sample8.html → sample08.html} +64 -41
- data/examples/api-samples/public/docs/sample09.html +260 -0
- data/examples/api-samples/public/docs/sample10.html +67 -28
- data/examples/api-samples/public/docs/sample11.html +171 -55
- data/examples/api-samples/public/docs/sample12.html +53 -17
- data/examples/api-samples/public/docs/sample13.html +52 -16
- data/examples/api-samples/public/docs/sample14.html +51 -8
- data/examples/api-samples/public/docs/sample15.html +46 -10
- data/examples/api-samples/public/docs/sample16.html +81 -7
- data/examples/api-samples/public/docs/sample17.html +103 -15
- data/examples/api-samples/public/docs/sample18.html +117 -41
- data/examples/api-samples/public/docs/sample19.html +410 -36
- data/examples/api-samples/public/docs/sample20.html +46 -10
- data/examples/api-samples/public/docs/sample21.html +504 -45
- data/examples/api-samples/public/docs/sample22.html +166 -28
- data/examples/api-samples/public/docs/sample23.html +61 -25
- data/examples/api-samples/public/docs/sample24.html +100 -12
- data/examples/api-samples/public/docs/sample25.html +123 -49
- data/examples/api-samples/public/docs/sample26.html +41 -8
- data/examples/api-samples/public/docs/sample27.html +125 -50
- data/examples/api-samples/public/docs/sample28.html +27 -9
- data/examples/api-samples/public/docs/sample29.html +10 -10
- data/examples/api-samples/public/docs/sample30.html +70 -14
- data/examples/api-samples/public/docs/sample31.html +108 -67
- data/examples/api-samples/public/docs/sample32.html +71 -99
- data/examples/api-samples/public/docs/sample33.html +107 -32
- data/examples/api-samples/public/docs/{sample1.html → sample34.html} +58 -18
- data/examples/api-samples/public/docs/sample35.html +666 -0
- data/examples/api-samples/public/docs/{sample6.html → sample36.html} +56 -37
- data/examples/api-samples/public/docs/sample37.html +815 -0
- data/examples/api-samples/public/docs/sample38.html +508 -0
- data/examples/api-samples/public/docs/sample39.html +921 -0
- data/examples/api-samples/public/docs/sample40.html +510 -0
- data/examples/api-samples/public/docs/sample41.html +452 -0
- data/examples/api-samples/public/docs/sample42.html +311 -0
- data/examples/api-samples/public/templates/test_all_fields2.pdf +0 -0
- data/examples/api-samples/samples/sample01.rb +37 -0
- data/examples/api-samples/samples/sample02.rb +41 -0
- data/examples/api-samples/samples/sample03.rb +73 -0
- data/examples/api-samples/samples/sample04.rb +47 -0
- data/examples/api-samples/samples/{sample5.rb → sample05.rb} +26 -14
- data/examples/api-samples/samples/sample06.rb +80 -0
- data/examples/api-samples/samples/sample07.rb +52 -0
- data/examples/api-samples/samples/sample08.rb +69 -0
- data/examples/api-samples/samples/sample09.rb +83 -0
- data/examples/api-samples/samples/sample10.rb +29 -15
- data/examples/api-samples/samples/sample11.rb +89 -37
- data/examples/api-samples/samples/sample12.rb +22 -11
- data/examples/api-samples/samples/sample13.rb +22 -10
- data/examples/api-samples/samples/sample14.rb +23 -5
- data/examples/api-samples/samples/sample15.rb +18 -7
- data/examples/api-samples/samples/sample16.rb +28 -4
- data/examples/api-samples/samples/sample17.rb +31 -5
- data/examples/api-samples/samples/sample18.rb +36 -8
- data/examples/api-samples/samples/sample19.rb +138 -18
- data/examples/api-samples/samples/sample20.rb +14 -3
- data/examples/api-samples/samples/sample21.rb +162 -23
- data/examples/api-samples/samples/sample22.rb +73 -22
- data/examples/api-samples/samples/sample23.rb +17 -6
- data/examples/api-samples/samples/sample24.rb +34 -7
- data/examples/api-samples/samples/sample25.rb +37 -12
- data/examples/api-samples/samples/sample26.rb +12 -5
- data/examples/api-samples/samples/sample27.rb +38 -12
- data/examples/api-samples/samples/sample28.rb +25 -6
- data/examples/api-samples/samples/sample29.rb +12 -12
- data/examples/api-samples/samples/sample30.rb +27 -15
- data/examples/api-samples/samples/sample31.rb +44 -33
- data/examples/api-samples/samples/sample32.rb +43 -41
- data/examples/api-samples/samples/sample33.rb +42 -14
- data/examples/api-samples/samples/sample34.rb +40 -0
- data/examples/api-samples/samples/sample35.rb +224 -0
- data/examples/api-samples/samples/sample36.rb +58 -0
- data/examples/api-samples/samples/sample37.rb +229 -0
- data/examples/api-samples/samples/sample38.rb +128 -0
- data/examples/api-samples/samples/sample39.rb +252 -0
- data/examples/api-samples/samples/sample40.rb +164 -0
- data/examples/api-samples/samples/sample41.rb +118 -0
- data/examples/api-samples/samples/sample42.rb +97 -0
- data/examples/api-samples/views/_others_samples.haml +25 -11
- data/examples/api-samples/views/index.haml +23 -11
- data/examples/api-samples/views/popup.haml +32 -0
- data/examples/api-samples/views/{sample1.haml → sample01.haml} +12 -7
- data/examples/api-samples/views/{sample2.haml → sample02.haml} +20 -15
- data/examples/api-samples/views/sample03.haml +83 -0
- data/examples/api-samples/views/sample04.haml +49 -0
- data/examples/api-samples/views/{sample5.haml → sample05.haml} +19 -14
- data/examples/api-samples/views/sample06.haml +53 -0
- data/examples/api-samples/views/sample07.haml +47 -0
- data/examples/api-samples/views/{sample8.haml → sample08.haml} +17 -12
- data/examples/api-samples/views/{sample9.haml → sample09.haml} +19 -4
- data/examples/api-samples/views/sample10.haml +18 -13
- data/examples/api-samples/views/sample11.haml +48 -19
- data/examples/api-samples/views/sample12.haml +26 -21
- data/examples/api-samples/views/sample13.haml +18 -12
- data/examples/api-samples/views/sample14.haml +21 -15
- data/examples/api-samples/views/sample15.haml +16 -9
- data/examples/api-samples/views/sample16.haml +18 -5
- data/examples/api-samples/views/sample17.haml +14 -9
- data/examples/api-samples/views/sample18.haml +13 -7
- data/examples/api-samples/views/sample19.haml +37 -8
- data/examples/api-samples/views/sample20.haml +13 -8
- data/examples/api-samples/views/sample21.haml +71 -13
- data/examples/api-samples/views/sample22.haml +53 -16
- data/examples/api-samples/views/sample23.haml +9 -4
- data/examples/api-samples/views/sample24.haml +9 -4
- data/examples/api-samples/views/sample25.haml +18 -13
- data/examples/api-samples/views/sample26.haml +8 -3
- data/examples/api-samples/views/sample27.haml +20 -14
- data/examples/api-samples/views/sample28.haml +16 -10
- data/examples/api-samples/views/sample29.haml +4 -4
- data/examples/api-samples/views/sample30.haml +16 -10
- data/examples/api-samples/views/sample31.haml +39 -32
- data/examples/api-samples/views/sample32.haml +25 -36
- data/examples/api-samples/views/sample33.haml +14 -17
- data/examples/api-samples/views/sample34.haml +48 -0
- data/examples/api-samples/views/sample35.haml +95 -0
- data/examples/api-samples/views/sample36.haml +64 -0
- data/examples/api-samples/views/sample37.haml +124 -0
- data/examples/api-samples/views/sample38.haml +115 -0
- data/examples/api-samples/views/sample39.haml +236 -0
- data/examples/api-samples/views/sample40.haml +95 -0
- data/examples/api-samples/views/{sample4.haml → sample41.haml} +90 -72
- data/examples/api-samples/views/sample42.haml +59 -0
- data/lib/groupdocs/api/helpers/rest_helper.rb +13 -1
- data/lib/groupdocs/datasource.rb +2 -1
- data/lib/groupdocs/document.rb +101 -13
- data/lib/groupdocs/document/annotation.rb +28 -13
- data/lib/groupdocs/document/annotation/marker.rb +18 -0
- data/lib/groupdocs/document/annotation/reply.rb +9 -2
- data/lib/groupdocs/document/field.rb +5 -1
- data/lib/groupdocs/job.rb +12 -2
- data/lib/groupdocs/questionnaire.rb +174 -4
- data/lib/groupdocs/questionnaire/collector.rb +21 -0
- data/lib/groupdocs/questionnaire/question.rb +19 -0
- data/lib/groupdocs/questionnaire/question/answer.rb +5 -0
- data/lib/groupdocs/questionnaire/question/conditions.rb +20 -0
- data/lib/groupdocs/signature.rb +36 -308
- data/lib/groupdocs/signature/envelope.rb +146 -4
- data/lib/groupdocs/signature/field.rb +20 -1
- data/lib/groupdocs/signature/field/location.rb +18 -7
- data/lib/groupdocs/signature/form.rb +199 -10
- data/lib/groupdocs/signature/shared/document_methods.rb +38 -0
- data/lib/groupdocs/signature/shared/entity_methods.rb +0 -1
- data/lib/groupdocs/signature/shared/field_methods.rb +13 -38
- data/lib/groupdocs/signature/shared/recipient_methods.rb +8 -0
- data/lib/groupdocs/signature/template.rb +3 -1
- data/lib/groupdocs/storage.rb +4 -1
- data/lib/groupdocs/storage/file.rb +18 -1
- data/lib/groupdocs/subscription.rb +8 -3
- data/lib/groupdocs/user.rb +8 -0
- data/lib/groupdocs/version.rb +1 -1
- data/spec/groupdocs/document/annotation_spec.rb +1 -14
- data/spec/groupdocs/subscription_spec.rb +2 -2
- metadata +86 -32
- checksums.yaml +0 -15
- data/examples/api-samples/public/docs/sample9.html +0 -200
- data/examples/api-samples/samples/sample1.rb +0 -25
- data/examples/api-samples/samples/sample2.rb +0 -29
- data/examples/api-samples/samples/sample3.rb +0 -33
- data/examples/api-samples/samples/sample4.rb +0 -51
- data/examples/api-samples/samples/sample6.rb +0 -49
- data/examples/api-samples/samples/sample7.rb +0 -42
- data/examples/api-samples/samples/sample8.rb +0 -61
- data/examples/api-samples/samples/sample9.rb +0 -48
- data/examples/api-samples/views/sample3.haml +0 -44
- data/examples/api-samples/views/sample6.haml +0 -49
- data/examples/api-samples/views/sample7.haml +0 -42
@@ -0,0 +1,508 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>sample38.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>sample38.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">'/sample38'</span> <span class="keyword">do</span>
|
35
|
+
haml <span class="symbol">:sample38</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">'/sample38'</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">:clientId</span>]
|
67
|
+
set <span class="symbol">:private_key</span>, params[<span class="symbol">:privateKey</span>]
|
68
|
+
set <span class="symbol">:email</span>, params[<span class="symbol">:email</span>]
|
69
|
+
set <span class="symbol">:source</span>, params[<span class="symbol">:source</span>]
|
70
|
+
set <span class="symbol">:file_id</span>, params[<span class="symbol">:fileId</span>]
|
71
|
+
set <span class="symbol">:url</span>, params[<span class="symbol">:url</span>]
|
72
|
+
set <span class="symbol">:first_name</span>, params[<span class="symbol">:firstName</span>]
|
73
|
+
set <span class="symbol">:last_name</span>, params[<span class="symbol">:lastName</span>]
|
74
|
+
set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]</pre></div></div>
|
75
|
+
|
76
|
+
</li>
|
77
|
+
|
78
|
+
|
79
|
+
<li id="section-4">
|
80
|
+
<div class="annotation">
|
81
|
+
|
82
|
+
<div class="pilwrap ">
|
83
|
+
<a class="pilcrow" href="#section-4">¶</a>
|
84
|
+
</div>
|
85
|
+
<p>raise params.to_yaml
|
86
|
+
Set download path</p>
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
<div class="content"><div class='highlight'><pre> downloads_path = <span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/downloads"</span></pre></div></div>
|
91
|
+
|
92
|
+
</li>
|
93
|
+
|
94
|
+
|
95
|
+
<li id="section-5">
|
96
|
+
<div class="annotation">
|
97
|
+
|
98
|
+
<div class="pilwrap ">
|
99
|
+
<a class="pilcrow" href="#section-5">¶</a>
|
100
|
+
</div>
|
101
|
+
<p>Remove all files from download directory or create folder if it not there</p>
|
102
|
+
|
103
|
+
</div>
|
104
|
+
|
105
|
+
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> <span class="constant">File</span>.directory?(downloads_path)
|
106
|
+
<span class="constant">Dir</span>.foreach(downloads_path) { |f| fn = <span class="constant">File</span>.join(downloads_path, f); <span class="constant">File</span>.delete(fn) <span class="keyword">if</span> f != <span class="string">'.'</span> && f != <span class="string">'..'</span> }
|
107
|
+
<span class="keyword">else</span>
|
108
|
+
<span class="constant">Dir::</span>mkdir(downloads_path)
|
109
|
+
<span class="keyword">end</span>
|
110
|
+
|
111
|
+
|
112
|
+
<span class="keyword">begin</span></pre></div></div>
|
113
|
+
|
114
|
+
</li>
|
115
|
+
|
116
|
+
|
117
|
+
<li id="section-6">
|
118
|
+
<div class="annotation">
|
119
|
+
|
120
|
+
<div class="pilwrap ">
|
121
|
+
<a class="pilcrow" href="#section-6">¶</a>
|
122
|
+
</div>
|
123
|
+
<p>Check required variables
|
124
|
+
raise 'Please enter all required parameters' if settings.client_id.empty? or settings.private_key.empty? or settings.email.empty? or settings.first_name.empty? or settings.last_name?</p>
|
125
|
+
|
126
|
+
</div>
|
127
|
+
|
128
|
+
<div class="content"><div class='highlight'><pre>
|
129
|
+
<span class="keyword">if</span> settings.base_path.empty? <span class="keyword">then</span> settings.base_path = <span class="string">'https://api.groupdocs.com'</span> <span class="keyword">end</span></pre></div></div>
|
130
|
+
|
131
|
+
</li>
|
132
|
+
|
133
|
+
|
134
|
+
<li id="section-7">
|
135
|
+
<div class="annotation">
|
136
|
+
|
137
|
+
<div class="pilwrap ">
|
138
|
+
<a class="pilcrow" href="#section-7">¶</a>
|
139
|
+
</div>
|
140
|
+
<p>Configure your access to API server</p>
|
141
|
+
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
|
145
|
+
groupdocs.client_id = settings.client_id
|
146
|
+
groupdocs.private_key = settings.private_key</pre></div></div>
|
147
|
+
|
148
|
+
</li>
|
149
|
+
|
150
|
+
|
151
|
+
<li id="section-8">
|
152
|
+
<div class="annotation">
|
153
|
+
|
154
|
+
<div class="pilwrap ">
|
155
|
+
<a class="pilcrow" href="#section-8">¶</a>
|
156
|
+
</div>
|
157
|
+
<p>Optionally specify API server and version</p>
|
158
|
+
|
159
|
+
</div>
|
160
|
+
|
161
|
+
<div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
|
162
|
+
<span class="keyword">end</span></pre></div></div>
|
163
|
+
|
164
|
+
</li>
|
165
|
+
|
166
|
+
|
167
|
+
<li id="section-9">
|
168
|
+
<div class="annotation">
|
169
|
+
|
170
|
+
<div class="pilwrap ">
|
171
|
+
<a class="pilcrow" href="#section-9">¶</a>
|
172
|
+
</div>
|
173
|
+
<p>Get document by file GUID</p>
|
174
|
+
|
175
|
+
</div>
|
176
|
+
|
177
|
+
<div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.source
|
178
|
+
<span class="keyword">when</span> <span class="string">'guid'</span></pre></div></div>
|
179
|
+
|
180
|
+
</li>
|
181
|
+
|
182
|
+
|
183
|
+
<li id="section-10">
|
184
|
+
<div class="annotation">
|
185
|
+
|
186
|
+
<div class="pilwrap ">
|
187
|
+
<a class="pilcrow" href="#section-10">¶</a>
|
188
|
+
</div>
|
189
|
+
<p>Create instance of File</p>
|
190
|
+
|
191
|
+
</div>
|
192
|
+
|
193
|
+
<div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.new({<span class="symbol">:guid</span> => settings.file_id})
|
194
|
+
<span class="keyword">when</span> <span class="string">'local'</span></pre></div></div>
|
195
|
+
|
196
|
+
</li>
|
197
|
+
|
198
|
+
|
199
|
+
<li id="section-11">
|
200
|
+
<div class="annotation">
|
201
|
+
|
202
|
+
<div class="pilwrap ">
|
203
|
+
<a class="pilcrow" href="#section-11">¶</a>
|
204
|
+
</div>
|
205
|
+
<p>Construct path</p>
|
206
|
+
|
207
|
+
</div>
|
208
|
+
|
209
|
+
<div class="content"><div class='highlight'><pre> file_path = <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>
|
210
|
+
|
211
|
+
</li>
|
212
|
+
|
213
|
+
|
214
|
+
<li id="section-12">
|
215
|
+
<div class="annotation">
|
216
|
+
|
217
|
+
<div class="pilwrap ">
|
218
|
+
<a class="pilcrow" href="#section-12">¶</a>
|
219
|
+
</div>
|
220
|
+
<p>Open file</p>
|
221
|
+
|
222
|
+
</div>
|
223
|
+
|
224
|
+
<div class="content"><div class='highlight'><pre> <span class="constant">File</span>.open(file_path, <span class="string">'wb'</span>) { |f| f.write(params[<span class="symbol">:file</span>][<span class="symbol">:tempfile</span>].read) }</pre></div></div>
|
225
|
+
|
226
|
+
</li>
|
227
|
+
|
228
|
+
|
229
|
+
<li id="section-13">
|
230
|
+
<div class="annotation">
|
231
|
+
|
232
|
+
<div class="pilwrap ">
|
233
|
+
<a class="pilcrow" href="#section-13">¶</a>
|
234
|
+
</div>
|
235
|
+
<p>Make a request to API using client_id and private_key</p>
|
236
|
+
|
237
|
+
</div>
|
238
|
+
|
239
|
+
<div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload!(file_path, {})
|
240
|
+
<span class="keyword">when</span> <span class="string">'url'</span></pre></div></div>
|
241
|
+
|
242
|
+
</li>
|
243
|
+
|
244
|
+
|
245
|
+
<li id="section-14">
|
246
|
+
<div class="annotation">
|
247
|
+
|
248
|
+
<div class="pilwrap ">
|
249
|
+
<a class="pilcrow" href="#section-14">¶</a>
|
250
|
+
</div>
|
251
|
+
<p>Upload file from defined url</p>
|
252
|
+
|
253
|
+
</div>
|
254
|
+
|
255
|
+
<div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload_web!(settings.url)
|
256
|
+
<span class="keyword">else</span>
|
257
|
+
raise <span class="string">'Wrong GUID source.'</span>
|
258
|
+
<span class="keyword">end</span></pre></div></div>
|
259
|
+
|
260
|
+
</li>
|
261
|
+
|
262
|
+
|
263
|
+
<li id="section-15">
|
264
|
+
<div class="annotation">
|
265
|
+
|
266
|
+
<div class="pilwrap ">
|
267
|
+
<a class="pilcrow" href="#section-15">¶</a>
|
268
|
+
</div>
|
269
|
+
<p>Get all users from accaunt</p>
|
270
|
+
|
271
|
+
</div>
|
272
|
+
|
273
|
+
<div class="content"><div class='highlight'><pre> user = <span class="constant">GroupDocs::User</span>.get!
|
274
|
+
userGuid = <span class="keyword">nil</span>
|
275
|
+
users = user.users!
|
276
|
+
users.map <span class="keyword">do</span> |user|
|
277
|
+
email = user.primary_email</pre></div></div>
|
278
|
+
|
279
|
+
</li>
|
280
|
+
|
281
|
+
|
282
|
+
<li id="section-16">
|
283
|
+
<div class="annotation">
|
284
|
+
|
285
|
+
<div class="pilwrap ">
|
286
|
+
<a class="pilcrow" href="#section-16">¶</a>
|
287
|
+
</div>
|
288
|
+
<p>Check whether there is a user with entered email</p>
|
289
|
+
|
290
|
+
</div>
|
291
|
+
|
292
|
+
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.email == email</pre></div></div>
|
293
|
+
|
294
|
+
</li>
|
295
|
+
|
296
|
+
|
297
|
+
<li id="section-17">
|
298
|
+
<div class="annotation">
|
299
|
+
|
300
|
+
<div class="pilwrap ">
|
301
|
+
<a class="pilcrow" href="#section-17">¶</a>
|
302
|
+
</div>
|
303
|
+
<p>Get user GUID</p>
|
304
|
+
|
305
|
+
</div>
|
306
|
+
|
307
|
+
<div class="content"><div class='highlight'><pre> userGuid = user.guid
|
308
|
+
<span class="keyword">break</span>
|
309
|
+
<span class="keyword">end</span>
|
310
|
+
<span class="keyword">end</span></pre></div></div>
|
311
|
+
|
312
|
+
</li>
|
313
|
+
|
314
|
+
|
315
|
+
<li id="section-18">
|
316
|
+
<div class="annotation">
|
317
|
+
|
318
|
+
<div class="pilwrap ">
|
319
|
+
<a class="pilcrow" href="#section-18">¶</a>
|
320
|
+
</div>
|
321
|
+
<p>Check is user with entered email was founded in GroupDocs account, if not user will be created</p>
|
322
|
+
|
323
|
+
</div>
|
324
|
+
|
325
|
+
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> userGuid.<span class="keyword">nil</span>?
|
326
|
+
userNew = <span class="constant">GroupDocs::User</span>.new</pre></div></div>
|
327
|
+
|
328
|
+
</li>
|
329
|
+
|
330
|
+
|
331
|
+
<li id="section-19">
|
332
|
+
<div class="annotation">
|
333
|
+
|
334
|
+
<div class="pilwrap ">
|
335
|
+
<a class="pilcrow" href="#section-19">¶</a>
|
336
|
+
</div>
|
337
|
+
<p>Set email as entered email</p>
|
338
|
+
|
339
|
+
</div>
|
340
|
+
|
341
|
+
<div class="content"><div class='highlight'><pre> userNew.primary_email = settings.email</pre></div></div>
|
342
|
+
|
343
|
+
</li>
|
344
|
+
|
345
|
+
|
346
|
+
<li id="section-20">
|
347
|
+
<div class="annotation">
|
348
|
+
|
349
|
+
<div class="pilwrap ">
|
350
|
+
<a class="pilcrow" href="#section-20">¶</a>
|
351
|
+
</div>
|
352
|
+
<p>Set nick name as entered first name</p>
|
353
|
+
|
354
|
+
</div>
|
355
|
+
|
356
|
+
<div class="content"><div class='highlight'><pre> userNew.nickname = settings.email</pre></div></div>
|
357
|
+
|
358
|
+
</li>
|
359
|
+
|
360
|
+
|
361
|
+
<li id="section-21">
|
362
|
+
<div class="annotation">
|
363
|
+
|
364
|
+
<div class="pilwrap ">
|
365
|
+
<a class="pilcrow" href="#section-21">¶</a>
|
366
|
+
</div>
|
367
|
+
<p>Set first name as entered first name</p>
|
368
|
+
|
369
|
+
</div>
|
370
|
+
|
371
|
+
<div class="content"><div class='highlight'><pre> userNew.firstname = settings.first_name</pre></div></div>
|
372
|
+
|
373
|
+
</li>
|
374
|
+
|
375
|
+
|
376
|
+
<li id="section-22">
|
377
|
+
<div class="annotation">
|
378
|
+
|
379
|
+
<div class="pilwrap ">
|
380
|
+
<a class="pilcrow" href="#section-22">¶</a>
|
381
|
+
</div>
|
382
|
+
<p>Set last name as entered last name</p>
|
383
|
+
|
384
|
+
</div>
|
385
|
+
|
386
|
+
<div class="content"><div class='highlight'><pre> userNew.lastname = settings.last_name</pre></div></div>
|
387
|
+
|
388
|
+
</li>
|
389
|
+
|
390
|
+
|
391
|
+
<li id="section-23">
|
392
|
+
<div class="annotation">
|
393
|
+
|
394
|
+
<div class="pilwrap ">
|
395
|
+
<a class="pilcrow" href="#section-23">¶</a>
|
396
|
+
</div>
|
397
|
+
<p>Set roles</p>
|
398
|
+
|
399
|
+
</div>
|
400
|
+
|
401
|
+
<div class="content"><div class='highlight'><pre> userNew.roles = [{<span class="symbol">:id</span> => <span class="string">'3'</span>, <span class="symbol">:name</span> => <span class="string">'User'</span>}]</pre></div></div>
|
402
|
+
|
403
|
+
</li>
|
404
|
+
|
405
|
+
|
406
|
+
<li id="section-24">
|
407
|
+
<div class="annotation">
|
408
|
+
|
409
|
+
<div class="pilwrap ">
|
410
|
+
<a class="pilcrow" href="#section-24">¶</a>
|
411
|
+
</div>
|
412
|
+
<p>Update account</p>
|
413
|
+
|
414
|
+
</div>
|
415
|
+
|
416
|
+
<div class="content"><div class='highlight'><pre> new_user = <span class="constant">GroupDocs::User</span>.update_account!(userNew)
|
417
|
+
|
418
|
+
guid = new_user.guid</pre></div></div>
|
419
|
+
|
420
|
+
</li>
|
421
|
+
|
422
|
+
|
423
|
+
<li id="section-25">
|
424
|
+
<div class="annotation">
|
425
|
+
|
426
|
+
<div class="pilwrap ">
|
427
|
+
<a class="pilcrow" href="#section-25">¶</a>
|
428
|
+
</div>
|
429
|
+
<p>Create array with entered email for set_collaborators! method</p>
|
430
|
+
|
431
|
+
</div>
|
432
|
+
|
433
|
+
<div class="content"><div class='highlight'><pre> emails = [settings.email]
|
434
|
+
document = file.to_document</pre></div></div>
|
435
|
+
|
436
|
+
</li>
|
437
|
+
|
438
|
+
|
439
|
+
<li id="section-26">
|
440
|
+
<div class="annotation">
|
441
|
+
|
442
|
+
<div class="pilwrap ">
|
443
|
+
<a class="pilcrow" href="#section-26">¶</a>
|
444
|
+
</div>
|
445
|
+
<p>Make request to Ant api for set new user as annotation collaborator</p>
|
446
|
+
|
447
|
+
</div>
|
448
|
+
|
449
|
+
<div class="content"><div class='highlight'><pre> addCollaborator = document.set_collaborators!(emails)
|
450
|
+
getCollaborator = document.collaborators!
|
451
|
+
getCollaborator.each <span class="keyword">do</span> |reviewer|
|
452
|
+
reviewer.access_rights = <span class="string">%w(view)</span>
|
453
|
+
<span class="keyword">end</span>
|
454
|
+
setReviewers = document.set_reviewers! getCollaborator
|
455
|
+
<span class="keyword">if</span> setReviewers
|
456
|
+
<span class="keyword">case</span> settings.base_path
|
457
|
+
<span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
|
458
|
+
iframe = <span class="string">"https://stage-api-groupdocs.dynabic.com/document-annotation2/embed/<span class="subst">#{file.guid}</span>?&uid=<span class="subst">#{guid}</span>&download=true"</span>
|
459
|
+
<span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
|
460
|
+
iframe = <span class="string">"https://dev-apps.groupdocs.com//document-annotation2/embed/<span class="subst">#{file.guid}</span>?&uid=<span class="subst">#{guid}</span>&download=true"</span>
|
461
|
+
<span class="keyword">else</span>
|
462
|
+
iframe = <span class="string">"https://apps.groupdocs.com//document-annotation2/embed/<span class="subst">#{file.guid}</span>?&uid=<span class="subst">#{guid}</span>&download=true"</span>
|
463
|
+
<span class="keyword">end</span></pre></div></div>
|
464
|
+
|
465
|
+
</li>
|
466
|
+
|
467
|
+
|
468
|
+
<li id="section-27">
|
469
|
+
<div class="annotation">
|
470
|
+
|
471
|
+
<div class="pilwrap ">
|
472
|
+
<a class="pilcrow" href="#section-27">¶</a>
|
473
|
+
</div>
|
474
|
+
<p>Construct result string</p>
|
475
|
+
|
476
|
+
</div>
|
477
|
+
|
478
|
+
<div class="content"><div class='highlight'><pre> url = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> => iframe).prepare_and_sign_url
|
479
|
+
iframe = <span class="string">"<iframe src='<span class="subst">#{url}</span>' width='800' height='1000'></iframe>"</span>
|
480
|
+
<span class="keyword">end</span>
|
481
|
+
<span class="keyword">end</span>
|
482
|
+
|
483
|
+
<span class="keyword">rescue</span> <span class="constant">Exception</span> => e
|
484
|
+
err = e.message
|
485
|
+
<span class="keyword">end</span></pre></div></div>
|
486
|
+
|
487
|
+
</li>
|
488
|
+
|
489
|
+
|
490
|
+
<li id="section-28">
|
491
|
+
<div class="annotation">
|
492
|
+
|
493
|
+
<div class="pilwrap ">
|
494
|
+
<a class="pilcrow" href="#section-28">¶</a>
|
495
|
+
</div>
|
496
|
+
<p>set variables for template</p>
|
497
|
+
|
498
|
+
</div>
|
499
|
+
|
500
|
+
<div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample38</span>, <span class="symbol">:locals</span> => {<span class="symbol">:userId</span> => settings.client_id, <span class="symbol">:fileId</span> => file.guid, <span class="symbol">:privateKey</span> => settings.private_key, <span class="symbol">:iframe</span> => iframe, <span class="symbol">:email</span> => settings.email, <span class="symbol">:firstName</span> => settings.first_name, <span class="symbol">:lastName</span> => settings.last_name, <span class="symbol">:err</span> => err}
|
501
|
+
<span class="keyword">end</span></pre></div></div>
|
502
|
+
|
503
|
+
</li>
|
504
|
+
|
505
|
+
</ul>
|
506
|
+
</div>
|
507
|
+
</body>
|
508
|
+
</html>
|