groupdocs 1.5.7 → 1.5.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. data/CHANGELOG.md +51 -0
  2. data/examples/api-samples/Gemfile +1 -1
  3. data/examples/api-samples/Gemfile.lock +43 -0
  4. data/examples/api-samples/public/docs/{sample2.html → sample01.html} +39 -19
  5. data/examples/api-samples/public/docs/{sample3.html → sample02.html} +28 -22
  6. data/examples/api-samples/public/docs/sample03.html +285 -0
  7. data/examples/api-samples/public/docs/{sample4.html → sample04.html} +30 -36
  8. data/examples/api-samples/public/docs/{sample5.html → sample05.html} +68 -31
  9. data/examples/api-samples/public/docs/sample06.html +299 -0
  10. data/examples/api-samples/public/docs/{sample7.html → sample07.html} +53 -18
  11. data/examples/api-samples/public/docs/{sample8.html → sample08.html} +64 -41
  12. data/examples/api-samples/public/docs/sample09.html +260 -0
  13. data/examples/api-samples/public/docs/sample10.html +67 -28
  14. data/examples/api-samples/public/docs/sample11.html +171 -55
  15. data/examples/api-samples/public/docs/sample12.html +53 -17
  16. data/examples/api-samples/public/docs/sample13.html +52 -16
  17. data/examples/api-samples/public/docs/sample14.html +51 -8
  18. data/examples/api-samples/public/docs/sample15.html +46 -10
  19. data/examples/api-samples/public/docs/sample16.html +81 -7
  20. data/examples/api-samples/public/docs/sample17.html +103 -15
  21. data/examples/api-samples/public/docs/sample18.html +117 -41
  22. data/examples/api-samples/public/docs/sample19.html +410 -36
  23. data/examples/api-samples/public/docs/sample20.html +46 -10
  24. data/examples/api-samples/public/docs/sample21.html +504 -45
  25. data/examples/api-samples/public/docs/sample22.html +166 -28
  26. data/examples/api-samples/public/docs/sample23.html +61 -25
  27. data/examples/api-samples/public/docs/sample24.html +100 -12
  28. data/examples/api-samples/public/docs/sample25.html +123 -49
  29. data/examples/api-samples/public/docs/sample26.html +41 -8
  30. data/examples/api-samples/public/docs/sample27.html +125 -50
  31. data/examples/api-samples/public/docs/sample28.html +27 -9
  32. data/examples/api-samples/public/docs/sample29.html +10 -10
  33. data/examples/api-samples/public/docs/sample30.html +70 -14
  34. data/examples/api-samples/public/docs/sample31.html +108 -67
  35. data/examples/api-samples/public/docs/sample32.html +71 -99
  36. data/examples/api-samples/public/docs/sample33.html +107 -32
  37. data/examples/api-samples/public/docs/{sample1.html → sample34.html} +58 -18
  38. data/examples/api-samples/public/docs/sample35.html +666 -0
  39. data/examples/api-samples/public/docs/{sample6.html → sample36.html} +56 -37
  40. data/examples/api-samples/public/docs/sample37.html +815 -0
  41. data/examples/api-samples/public/docs/sample38.html +508 -0
  42. data/examples/api-samples/public/docs/sample39.html +921 -0
  43. data/examples/api-samples/public/docs/sample40.html +510 -0
  44. data/examples/api-samples/public/docs/sample41.html +452 -0
  45. data/examples/api-samples/public/docs/sample42.html +311 -0
  46. data/examples/api-samples/public/templates/test_all_fields2.pdf +0 -0
  47. data/examples/api-samples/samples/sample01.rb +37 -0
  48. data/examples/api-samples/samples/sample02.rb +41 -0
  49. data/examples/api-samples/samples/sample03.rb +73 -0
  50. data/examples/api-samples/samples/sample04.rb +47 -0
  51. data/examples/api-samples/samples/{sample5.rb → sample05.rb} +26 -14
  52. data/examples/api-samples/samples/sample06.rb +80 -0
  53. data/examples/api-samples/samples/sample07.rb +52 -0
  54. data/examples/api-samples/samples/sample08.rb +69 -0
  55. data/examples/api-samples/samples/sample09.rb +83 -0
  56. data/examples/api-samples/samples/sample10.rb +29 -15
  57. data/examples/api-samples/samples/sample11.rb +89 -37
  58. data/examples/api-samples/samples/sample12.rb +22 -11
  59. data/examples/api-samples/samples/sample13.rb +22 -10
  60. data/examples/api-samples/samples/sample14.rb +23 -5
  61. data/examples/api-samples/samples/sample15.rb +18 -7
  62. data/examples/api-samples/samples/sample16.rb +28 -4
  63. data/examples/api-samples/samples/sample17.rb +31 -5
  64. data/examples/api-samples/samples/sample18.rb +36 -8
  65. data/examples/api-samples/samples/sample19.rb +138 -18
  66. data/examples/api-samples/samples/sample20.rb +14 -3
  67. data/examples/api-samples/samples/sample21.rb +162 -23
  68. data/examples/api-samples/samples/sample22.rb +73 -22
  69. data/examples/api-samples/samples/sample23.rb +17 -6
  70. data/examples/api-samples/samples/sample24.rb +34 -7
  71. data/examples/api-samples/samples/sample25.rb +37 -12
  72. data/examples/api-samples/samples/sample26.rb +12 -5
  73. data/examples/api-samples/samples/sample27.rb +38 -12
  74. data/examples/api-samples/samples/sample28.rb +25 -6
  75. data/examples/api-samples/samples/sample29.rb +12 -12
  76. data/examples/api-samples/samples/sample30.rb +27 -15
  77. data/examples/api-samples/samples/sample31.rb +44 -33
  78. data/examples/api-samples/samples/sample32.rb +43 -41
  79. data/examples/api-samples/samples/sample33.rb +42 -14
  80. data/examples/api-samples/samples/sample34.rb +40 -0
  81. data/examples/api-samples/samples/sample35.rb +224 -0
  82. data/examples/api-samples/samples/sample36.rb +58 -0
  83. data/examples/api-samples/samples/sample37.rb +229 -0
  84. data/examples/api-samples/samples/sample38.rb +128 -0
  85. data/examples/api-samples/samples/sample39.rb +252 -0
  86. data/examples/api-samples/samples/sample40.rb +164 -0
  87. data/examples/api-samples/samples/sample41.rb +118 -0
  88. data/examples/api-samples/samples/sample42.rb +97 -0
  89. data/examples/api-samples/views/_others_samples.haml +25 -11
  90. data/examples/api-samples/views/index.haml +23 -11
  91. data/examples/api-samples/views/popup.haml +32 -0
  92. data/examples/api-samples/views/{sample1.haml → sample01.haml} +12 -7
  93. data/examples/api-samples/views/{sample2.haml → sample02.haml} +20 -15
  94. data/examples/api-samples/views/sample03.haml +83 -0
  95. data/examples/api-samples/views/sample04.haml +49 -0
  96. data/examples/api-samples/views/{sample5.haml → sample05.haml} +19 -14
  97. data/examples/api-samples/views/sample06.haml +53 -0
  98. data/examples/api-samples/views/sample07.haml +47 -0
  99. data/examples/api-samples/views/{sample8.haml → sample08.haml} +17 -12
  100. data/examples/api-samples/views/{sample9.haml → sample09.haml} +19 -4
  101. data/examples/api-samples/views/sample10.haml +18 -13
  102. data/examples/api-samples/views/sample11.haml +48 -19
  103. data/examples/api-samples/views/sample12.haml +26 -21
  104. data/examples/api-samples/views/sample13.haml +18 -12
  105. data/examples/api-samples/views/sample14.haml +21 -15
  106. data/examples/api-samples/views/sample15.haml +16 -9
  107. data/examples/api-samples/views/sample16.haml +18 -5
  108. data/examples/api-samples/views/sample17.haml +14 -9
  109. data/examples/api-samples/views/sample18.haml +13 -7
  110. data/examples/api-samples/views/sample19.haml +37 -8
  111. data/examples/api-samples/views/sample20.haml +13 -8
  112. data/examples/api-samples/views/sample21.haml +71 -13
  113. data/examples/api-samples/views/sample22.haml +53 -16
  114. data/examples/api-samples/views/sample23.haml +9 -4
  115. data/examples/api-samples/views/sample24.haml +9 -4
  116. data/examples/api-samples/views/sample25.haml +18 -13
  117. data/examples/api-samples/views/sample26.haml +8 -3
  118. data/examples/api-samples/views/sample27.haml +20 -14
  119. data/examples/api-samples/views/sample28.haml +16 -10
  120. data/examples/api-samples/views/sample29.haml +4 -4
  121. data/examples/api-samples/views/sample30.haml +16 -10
  122. data/examples/api-samples/views/sample31.haml +39 -32
  123. data/examples/api-samples/views/sample32.haml +25 -36
  124. data/examples/api-samples/views/sample33.haml +14 -17
  125. data/examples/api-samples/views/sample34.haml +48 -0
  126. data/examples/api-samples/views/sample35.haml +95 -0
  127. data/examples/api-samples/views/sample36.haml +64 -0
  128. data/examples/api-samples/views/sample37.haml +124 -0
  129. data/examples/api-samples/views/sample38.haml +115 -0
  130. data/examples/api-samples/views/sample39.haml +236 -0
  131. data/examples/api-samples/views/sample40.haml +95 -0
  132. data/examples/api-samples/views/{sample4.haml → sample41.haml} +90 -72
  133. data/examples/api-samples/views/sample42.haml +59 -0
  134. data/lib/groupdocs/api/helpers/rest_helper.rb +13 -1
  135. data/lib/groupdocs/datasource.rb +2 -1
  136. data/lib/groupdocs/document.rb +101 -13
  137. data/lib/groupdocs/document/annotation.rb +28 -13
  138. data/lib/groupdocs/document/annotation/marker.rb +18 -0
  139. data/lib/groupdocs/document/annotation/reply.rb +9 -2
  140. data/lib/groupdocs/document/field.rb +5 -1
  141. data/lib/groupdocs/job.rb +12 -2
  142. data/lib/groupdocs/questionnaire.rb +174 -4
  143. data/lib/groupdocs/questionnaire/collector.rb +21 -0
  144. data/lib/groupdocs/questionnaire/question.rb +19 -0
  145. data/lib/groupdocs/questionnaire/question/answer.rb +5 -0
  146. data/lib/groupdocs/questionnaire/question/conditions.rb +20 -0
  147. data/lib/groupdocs/signature.rb +36 -308
  148. data/lib/groupdocs/signature/envelope.rb +146 -4
  149. data/lib/groupdocs/signature/field.rb +20 -1
  150. data/lib/groupdocs/signature/field/location.rb +18 -7
  151. data/lib/groupdocs/signature/form.rb +199 -10
  152. data/lib/groupdocs/signature/shared/document_methods.rb +38 -0
  153. data/lib/groupdocs/signature/shared/entity_methods.rb +0 -1
  154. data/lib/groupdocs/signature/shared/field_methods.rb +13 -38
  155. data/lib/groupdocs/signature/shared/recipient_methods.rb +8 -0
  156. data/lib/groupdocs/signature/template.rb +3 -1
  157. data/lib/groupdocs/storage.rb +4 -1
  158. data/lib/groupdocs/storage/file.rb +18 -1
  159. data/lib/groupdocs/subscription.rb +8 -3
  160. data/lib/groupdocs/user.rb +8 -0
  161. data/lib/groupdocs/version.rb +1 -1
  162. data/spec/groupdocs/document/annotation_spec.rb +1 -14
  163. data/spec/groupdocs/subscription_spec.rb +2 -2
  164. metadata +86 -32
  165. checksums.yaml +0 -15
  166. data/examples/api-samples/public/docs/sample9.html +0 -200
  167. data/examples/api-samples/samples/sample1.rb +0 -25
  168. data/examples/api-samples/samples/sample2.rb +0 -29
  169. data/examples/api-samples/samples/sample3.rb +0 -33
  170. data/examples/api-samples/samples/sample4.rb +0 -51
  171. data/examples/api-samples/samples/sample6.rb +0 -49
  172. data/examples/api-samples/samples/sample7.rb +0 -42
  173. data/examples/api-samples/samples/sample8.rb +0 -61
  174. data/examples/api-samples/samples/sample9.rb +0 -48
  175. data/examples/api-samples/views/sample3.haml +0 -44
  176. data/examples/api-samples/views/sample6.haml +0 -49
  177. 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">&#182;</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">&#182;</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">&#182;</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">&#182;</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">&#182;</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> &amp;&amp; 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">&#182;</a>
122
+ </div>
123
+ <p>Check required variables
124
+ raise &#39;Please enter all required parameters&#39; 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">&#182;</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">&#182;</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">&#182;</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">&#182;</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> =&gt; 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">&#182;</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">&#182;</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">&#182;</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">&#182;</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">&#182;</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">&#182;</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">&#182;</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">&#182;</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">&#182;</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">&#182;</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">&#182;</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">&#182;</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">&#182;</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> =&gt; <span class="string">'3'</span>, <span class="symbol">:name</span> =&gt; <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">&#182;</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">&#182;</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">&#182;</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>?&amp;uid=<span class="subst">#{guid}</span>&amp;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>?&amp;uid=<span class="subst">#{guid}</span>&amp;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>?&amp;uid=<span class="subst">#{guid}</span>&amp;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">&#182;</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> =&gt; iframe).prepare_and_sign_url
479
+ iframe = <span class="string">"&lt;iframe src='<span class="subst">#{url}</span>' width='800' height='1000'&gt;&lt;/iframe&gt;"</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> =&gt; 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">&#182;</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> =&gt; {<span class="symbol">:userId</span> =&gt; settings.client_id, <span class="symbol">:fileId</span> =&gt; file.guid, <span class="symbol">:privateKey</span> =&gt; settings.private_key, <span class="symbol">:iframe</span> =&gt; iframe, <span class="symbol">:email</span> =&gt; settings.email, <span class="symbol">:firstName</span> =&gt; settings.first_name, <span class="symbol">:lastName</span> =&gt; settings.last_name, <span class="symbol">:err</span> =&gt; err}
501
+ <span class="keyword">end</span></pre></div></div>
502
+
503
+ </li>
504
+
505
+ </ul>
506
+ </div>
507
+ </body>
508
+ </html>