groupdocs 1.5.8 → 1.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/CHANGELOG.md +9 -0
  2. data/examples/api-samples/public/docs/sample01.html +34 -15
  3. data/examples/api-samples/public/docs/sample02.html +36 -15
  4. data/examples/api-samples/public/docs/sample03.html +55 -34
  5. data/examples/api-samples/public/docs/sample04.html +33 -14
  6. data/examples/api-samples/public/docs/sample05.html +51 -33
  7. data/examples/api-samples/public/docs/sample06.html +86 -40
  8. data/examples/api-samples/public/docs/sample07.html +32 -13
  9. data/examples/api-samples/public/docs/sample08.html +39 -20
  10. data/examples/api-samples/public/docs/sample09.html +93 -39
  11. data/examples/api-samples/public/docs/sample10.html +39 -21
  12. data/examples/api-samples/public/docs/sample11.html +133 -88
  13. data/examples/api-samples/public/docs/sample12.html +33 -14
  14. data/examples/api-samples/public/docs/sample13.html +14 -7
  15. data/examples/api-samples/public/docs/sample14.html +37 -18
  16. data/examples/api-samples/public/docs/sample15.html +29 -10
  17. data/examples/api-samples/public/docs/sample16.html +58 -25
  18. data/examples/api-samples/public/docs/sample17.html +71 -38
  19. data/examples/api-samples/public/docs/sample18.html +98 -71
  20. data/examples/api-samples/public/docs/sample19.html +74 -42
  21. data/examples/api-samples/public/docs/sample20.html +39 -21
  22. data/examples/api-samples/public/docs/sample21.html +113 -69
  23. data/examples/api-samples/public/docs/sample22.html +89 -43
  24. data/examples/api-samples/public/docs/sample23.html +50 -32
  25. data/examples/api-samples/public/docs/sample24.html +64 -31
  26. data/examples/api-samples/public/docs/sample25.html +107 -60
  27. data/examples/api-samples/public/docs/sample26.html +29 -10
  28. data/examples/api-samples/public/docs/sample27.html +107 -61
  29. data/examples/api-samples/public/docs/sample28.html +158 -9
  30. data/examples/api-samples/public/docs/sample29.html +13 -8
  31. data/examples/api-samples/public/docs/sample30.html +34 -15
  32. data/examples/api-samples/public/docs/sample31.html +107 -76
  33. data/examples/api-samples/public/docs/sample32.html +104 -40
  34. data/examples/api-samples/public/docs/sample33.html +85 -36
  35. data/examples/api-samples/public/docs/sample34.html +30 -11
  36. data/examples/api-samples/public/docs/sample35.html +90 -27
  37. data/examples/api-samples/public/docs/sample36.html +36 -16
  38. data/examples/api-samples/public/docs/sample37.html +144 -265
  39. data/examples/api-samples/public/docs/sample38.html +113 -64
  40. data/examples/api-samples/public/docs/sample39.html +118 -45
  41. data/examples/api-samples/public/docs/sample40.html +81 -46
  42. data/examples/api-samples/public/docs/sample41.html +562 -90
  43. data/examples/api-samples/public/docs/sample42.html +94 -39
  44. data/examples/api-samples/public/docs/sample43.html +669 -0
  45. data/examples/api-samples/samples/sample01.rb +17 -10
  46. data/examples/api-samples/samples/sample02.rb +21 -12
  47. data/examples/api-samples/samples/sample03.rb +35 -29
  48. data/examples/api-samples/samples/sample04.rb +19 -12
  49. data/examples/api-samples/samples/sample05.rb +24 -17
  50. data/examples/api-samples/samples/sample06.rb +38 -32
  51. data/examples/api-samples/samples/sample07.rb +19 -12
  52. data/examples/api-samples/samples/sample08.rb +22 -15
  53. data/examples/api-samples/samples/sample09.rb +31 -29
  54. data/examples/api-samples/samples/sample10.rb +22 -15
  55. data/examples/api-samples/samples/sample11.rb +78 -81
  56. data/examples/api-samples/samples/sample12.rb +19 -21
  57. data/examples/api-samples/samples/sample13.rb +19 -21
  58. data/examples/api-samples/samples/sample14.rb +18 -12
  59. data/examples/api-samples/samples/sample15.rb +17 -10
  60. data/examples/api-samples/samples/sample16.rb +25 -17
  61. data/examples/api-samples/samples/sample17.rb +31 -23
  62. data/examples/api-samples/samples/sample18.rb +60 -55
  63. data/examples/api-samples/samples/sample19.rb +48 -42
  64. data/examples/api-samples/samples/sample20.rb +20 -13
  65. data/examples/api-samples/samples/sample21.rb +62 -54
  66. data/examples/api-samples/samples/sample22.rb +37 -31
  67. data/examples/api-samples/samples/sample23.rb +24 -17
  68. data/examples/api-samples/samples/sample24.rb +29 -22
  69. data/examples/api-samples/samples/sample25.rb +47 -40
  70. data/examples/api-samples/samples/sample26.rb +16 -9
  71. data/examples/api-samples/samples/sample27.rb +46 -39
  72. data/examples/api-samples/samples/sample28.rb +42 -11
  73. data/examples/api-samples/samples/sample29.rb +13 -8
  74. data/examples/api-samples/samples/sample30.rb +19 -12
  75. data/examples/api-samples/samples/sample31.rb +63 -58
  76. data/examples/api-samples/samples/sample32.rb +45 -42
  77. data/examples/api-samples/samples/sample33.rb +36 -25
  78. data/examples/api-samples/samples/sample34.rb +16 -9
  79. data/examples/api-samples/samples/sample35.rb +66 -53
  80. data/examples/api-samples/samples/sample36.rb +19 -15
  81. data/examples/api-samples/samples/sample37.rb +61 -99
  82. data/examples/api-samples/samples/sample38.rb +51 -43
  83. data/examples/api-samples/samples/sample39.rb +78 -62
  84. data/examples/api-samples/samples/sample40.rb +48 -38
  85. data/examples/api-samples/samples/sample41.rb +189 -67
  86. data/examples/api-samples/samples/sample42.rb +37 -29
  87. data/examples/api-samples/samples/sample43.rb +127 -0
  88. data/examples/api-samples/views/_others_samples.haml +4 -2
  89. data/examples/api-samples/views/index.haml +4 -2
  90. data/examples/api-samples/views/sample11.haml +1 -1
  91. data/examples/api-samples/views/sample28.haml +8 -0
  92. data/examples/api-samples/views/sample31.haml +1 -6
  93. data/examples/api-samples/views/sample39.haml +7 -2
  94. data/examples/api-samples/views/sample41.haml +78 -33
  95. data/examples/api-samples/views/sample42.haml +0 -1
  96. data/examples/api-samples/views/sample43.haml +91 -0
  97. data/lib/groupdocs/api/helpers/access_rights_helper.rb +6 -5
  98. data/lib/groupdocs/api/helpers/url_helper.rb +2 -1
  99. data/lib/groupdocs/document.rb +3 -3
  100. data/lib/groupdocs/version.rb +1 -1
  101. metadata +5 -2
@@ -82,8 +82,7 @@
82
82
  <div class="pilwrap ">
83
83
  <a class="pilcrow" href="#section-4">&#182;</a>
84
84
  </div>
85
- <p>raise params.to_yaml
86
- Set download path</p>
85
+ <p>Set download path</p>
87
86
 
88
87
  </div>
89
88
 
@@ -108,7 +107,6 @@ Set download path</p>
108
107
  <span class="constant">Dir::</span>mkdir(downloads_path)
109
108
  <span class="keyword">end</span>
110
109
 
111
-
112
110
  <span class="keyword">begin</span></pre></div></div>
113
111
 
114
112
  </li>
@@ -120,13 +118,11 @@ Set download path</p>
120
118
  <div class="pilwrap ">
121
119
  <a class="pilcrow" href="#section-6">&#182;</a>
122
120
  </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>
121
+ <p>Check required variables</p>
125
122
 
126
123
  </div>
127
124
 
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>
125
+ <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.first_name.empty? <span class="keyword">or</span> settings.last_name.empty?</pre></div></div>
130
126
 
131
127
  </li>
132
128
 
@@ -137,6 +133,27 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
137
133
  <div class="pilwrap ">
138
134
  <a class="pilcrow" href="#section-7">&#182;</a>
139
135
  </div>
136
+ <p>Prepare base path</p>
137
+
138
+ </div>
139
+
140
+ <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.base_path.empty?
141
+ base_path = <span class="string">'https://api.groupdocs.com'</span>
142
+ <span class="keyword">elsif</span> settings.base_path.match(<span class="string">'/v2.0'</span>)
143
+ base_path = settings.base_path.split(<span class="string">'/v2.0'</span>)[<span class="number">0</span>]
144
+ <span class="keyword">else</span>
145
+ base_path = settings.base_path
146
+ <span class="keyword">end</span></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>
140
157
  <p>Configure your access to API server</p>
141
158
 
142
159
  </div>
@@ -148,27 +165,28 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
148
165
  </li>
149
166
 
150
167
 
151
- <li id="section-8">
168
+ <li id="section-9">
152
169
  <div class="annotation">
153
170
 
154
171
  <div class="pilwrap ">
155
- <a class="pilcrow" href="#section-8">&#182;</a>
172
+ <a class="pilcrow" href="#section-9">&#182;</a>
156
173
  </div>
157
174
  <p>Optionally specify API server and version</p>
158
175
 
159
176
  </div>
160
177
 
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>
178
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
179
+ <span class="keyword">end</span>
180
+ file = <span class="keyword">nil</span></pre></div></div>
163
181
 
164
182
  </li>
165
183
 
166
184
 
167
- <li id="section-9">
185
+ <li id="section-10">
168
186
  <div class="annotation">
169
187
 
170
188
  <div class="pilwrap ">
171
- <a class="pilcrow" href="#section-9">&#182;</a>
189
+ <a class="pilcrow" href="#section-10">&#182;</a>
172
190
  </div>
173
191
  <p>Get document by file GUID</p>
174
192
 
@@ -180,11 +198,11 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
180
198
  </li>
181
199
 
182
200
 
183
- <li id="section-10">
201
+ <li id="section-11">
184
202
  <div class="annotation">
185
203
 
186
204
  <div class="pilwrap ">
187
- <a class="pilcrow" href="#section-10">&#182;</a>
205
+ <a class="pilcrow" href="#section-11">&#182;</a>
188
206
  </div>
189
207
  <p>Create instance of File</p>
190
208
 
@@ -196,11 +214,11 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
196
214
  </li>
197
215
 
198
216
 
199
- <li id="section-11">
217
+ <li id="section-12">
200
218
  <div class="annotation">
201
219
 
202
220
  <div class="pilwrap ">
203
- <a class="pilcrow" href="#section-11">&#182;</a>
221
+ <a class="pilcrow" href="#section-12">&#182;</a>
204
222
  </div>
205
223
  <p>Construct path</p>
206
224
 
@@ -211,11 +229,11 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
211
229
  </li>
212
230
 
213
231
 
214
- <li id="section-12">
232
+ <li id="section-13">
215
233
  <div class="annotation">
216
234
 
217
235
  <div class="pilwrap ">
218
- <a class="pilcrow" href="#section-12">&#182;</a>
236
+ <a class="pilcrow" href="#section-13">&#182;</a>
219
237
  </div>
220
238
  <p>Open file</p>
221
239
 
@@ -226,11 +244,11 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
226
244
  </li>
227
245
 
228
246
 
229
- <li id="section-13">
247
+ <li id="section-14">
230
248
  <div class="annotation">
231
249
 
232
250
  <div class="pilwrap ">
233
- <a class="pilcrow" href="#section-13">&#182;</a>
251
+ <a class="pilcrow" href="#section-14">&#182;</a>
234
252
  </div>
235
253
  <p>Make a request to API using client_id and private_key</p>
236
254
 
@@ -242,11 +260,11 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
242
260
  </li>
243
261
 
244
262
 
245
- <li id="section-14">
263
+ <li id="section-15">
246
264
  <div class="annotation">
247
265
 
248
266
  <div class="pilwrap ">
249
- <a class="pilcrow" href="#section-14">&#182;</a>
267
+ <a class="pilcrow" href="#section-15">&#182;</a>
250
268
  </div>
251
269
  <p>Upload file from defined url</p>
252
270
 
@@ -260,11 +278,11 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
260
278
  </li>
261
279
 
262
280
 
263
- <li id="section-15">
281
+ <li id="section-16">
264
282
  <div class="annotation">
265
283
 
266
284
  <div class="pilwrap ">
267
- <a class="pilcrow" href="#section-15">&#182;</a>
285
+ <a class="pilcrow" href="#section-16">&#182;</a>
268
286
  </div>
269
287
  <p>Get all users from accaunt</p>
270
288
 
@@ -279,11 +297,11 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
279
297
  </li>
280
298
 
281
299
 
282
- <li id="section-16">
300
+ <li id="section-17">
283
301
  <div class="annotation">
284
302
 
285
303
  <div class="pilwrap ">
286
- <a class="pilcrow" href="#section-16">&#182;</a>
304
+ <a class="pilcrow" href="#section-17">&#182;</a>
287
305
  </div>
288
306
  <p>Check whether there is a user with entered email</p>
289
307
 
@@ -294,11 +312,11 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
294
312
  </li>
295
313
 
296
314
 
297
- <li id="section-17">
315
+ <li id="section-18">
298
316
  <div class="annotation">
299
317
 
300
318
  <div class="pilwrap ">
301
- <a class="pilcrow" href="#section-17">&#182;</a>
319
+ <a class="pilcrow" href="#section-18">&#182;</a>
302
320
  </div>
303
321
  <p>Get user GUID</p>
304
322
 
@@ -312,11 +330,11 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
312
330
  </li>
313
331
 
314
332
 
315
- <li id="section-18">
333
+ <li id="section-19">
316
334
  <div class="annotation">
317
335
 
318
336
  <div class="pilwrap ">
319
- <a class="pilcrow" href="#section-18">&#182;</a>
337
+ <a class="pilcrow" href="#section-19">&#182;</a>
320
338
  </div>
321
339
  <p>Check is user with entered email was founded in GroupDocs account, if not user will be created</p>
322
340
 
@@ -328,11 +346,11 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
328
346
  </li>
329
347
 
330
348
 
331
- <li id="section-19">
349
+ <li id="section-20">
332
350
  <div class="annotation">
333
351
 
334
352
  <div class="pilwrap ">
335
- <a class="pilcrow" href="#section-19">&#182;</a>
353
+ <a class="pilcrow" href="#section-20">&#182;</a>
336
354
  </div>
337
355
  <p>Set email as entered email</p>
338
356
 
@@ -343,11 +361,11 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
343
361
  </li>
344
362
 
345
363
 
346
- <li id="section-20">
364
+ <li id="section-21">
347
365
  <div class="annotation">
348
366
 
349
367
  <div class="pilwrap ">
350
- <a class="pilcrow" href="#section-20">&#182;</a>
368
+ <a class="pilcrow" href="#section-21">&#182;</a>
351
369
  </div>
352
370
  <p>Set nick name as entered first name</p>
353
371
 
@@ -358,11 +376,11 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
358
376
  </li>
359
377
 
360
378
 
361
- <li id="section-21">
379
+ <li id="section-22">
362
380
  <div class="annotation">
363
381
 
364
382
  <div class="pilwrap ">
365
- <a class="pilcrow" href="#section-21">&#182;</a>
383
+ <a class="pilcrow" href="#section-22">&#182;</a>
366
384
  </div>
367
385
  <p>Set first name as entered first name</p>
368
386
 
@@ -373,11 +391,11 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
373
391
  </li>
374
392
 
375
393
 
376
- <li id="section-22">
394
+ <li id="section-23">
377
395
  <div class="annotation">
378
396
 
379
397
  <div class="pilwrap ">
380
- <a class="pilcrow" href="#section-22">&#182;</a>
398
+ <a class="pilcrow" href="#section-23">&#182;</a>
381
399
  </div>
382
400
  <p>Set last name as entered last name</p>
383
401
 
@@ -388,11 +406,11 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
388
406
  </li>
389
407
 
390
408
 
391
- <li id="section-23">
409
+ <li id="section-24">
392
410
  <div class="annotation">
393
411
 
394
412
  <div class="pilwrap ">
395
- <a class="pilcrow" href="#section-23">&#182;</a>
413
+ <a class="pilcrow" href="#section-24">&#182;</a>
396
414
  </div>
397
415
  <p>Set roles</p>
398
416
 
@@ -403,11 +421,11 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
403
421
  </li>
404
422
 
405
423
 
406
- <li id="section-24">
424
+ <li id="section-25">
407
425
  <div class="annotation">
408
426
 
409
427
  <div class="pilwrap ">
410
- <a class="pilcrow" href="#section-24">&#182;</a>
428
+ <a class="pilcrow" href="#section-25">&#182;</a>
411
429
  </div>
412
430
  <p>Update account</p>
413
431
 
@@ -420,11 +438,11 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
420
438
  </li>
421
439
 
422
440
 
423
- <li id="section-25">
441
+ <li id="section-26">
424
442
  <div class="annotation">
425
443
 
426
444
  <div class="pilwrap ">
427
- <a class="pilcrow" href="#section-25">&#182;</a>
445
+ <a class="pilcrow" href="#section-26">&#182;</a>
428
446
  </div>
429
447
  <p>Create array with entered email for set_collaborators! method</p>
430
448
 
@@ -436,11 +454,11 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
436
454
  </li>
437
455
 
438
456
 
439
- <li id="section-26">
457
+ <li id="section-27">
440
458
  <div class="annotation">
441
459
 
442
460
  <div class="pilwrap ">
443
- <a class="pilcrow" href="#section-26">&#182;</a>
461
+ <a class="pilcrow" href="#section-27">&#182;</a>
444
462
  </div>
445
463
  <p>Make request to Ant api for set new user as annotation collaborator</p>
446
464
 
@@ -452,31 +470,62 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
452
470
  reviewer.access_rights = <span class="string">%w(view)</span>
453
471
  <span class="keyword">end</span>
454
472
  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>
473
+
474
+ <span class="keyword">if</span> setReviewers</pre></div></div>
464
475
 
465
476
  </li>
466
477
 
467
478
 
468
- <li id="section-27">
479
+ <li id="section-28">
469
480
  <div class="annotation">
470
481
 
471
482
  <div class="pilwrap ">
472
- <a class="pilcrow" href="#section-27">&#182;</a>
483
+ <a class="pilcrow" href="#section-28">&#182;</a>
484
+ </div>
485
+ <p>Add user GUID as &quot;uid&quot; parameter to the iframe URL</p>
486
+
487
+ </div>
488
+
489
+ <div class="content"><div class='highlight'><pre> iframe = <span class="string">"/document-annotation2/embed/<span class="subst">#{file.guid}</span>?&amp;uid=<span class="subst">#{guid}</span>&amp;download=true"</span></pre></div></div>
490
+
491
+ </li>
492
+
493
+
494
+ <li id="section-29">
495
+ <div class="annotation">
496
+
497
+ <div class="pilwrap ">
498
+ <a class="pilcrow" href="#section-29">&#182;</a>
473
499
  </div>
474
500
  <p>Construct result string</p>
475
501
 
476
502
  </div>
477
503
 
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>
504
+ <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</pre></div></div>
505
+
506
+ </li>
507
+
508
+
509
+ <li id="section-30">
510
+ <div class="annotation">
511
+
512
+ <div class="pilwrap ">
513
+ <a class="pilcrow" href="#section-30">&#182;</a>
514
+ </div>
515
+ <p>Generate iframe URL</p>
516
+
517
+ </div>
518
+
519
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> base_path
520
+ <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
521
+ iframe = <span class="string">"https://stage-api-groupdocs.dynabic.com<span class="subst">#{url}</span>"</span>
522
+ <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
523
+ iframe = <span class="string">"https://dev-apps.groupdocs.com<span class="subst">#{url}</span>"</span>
524
+ <span class="keyword">else</span>
525
+ iframe = <span class="string">"https://apps.groupdocs.com<span class="subst">#{url}</span>"</span>
526
+ <span class="keyword">end</span>
527
+
528
+ iframe = <span class="string">"&lt;iframe src='<span class="subst">#{iframe}</span>' width='800' height='1000'&gt;&lt;/iframe&gt;"</span>
480
529
  <span class="keyword">end</span>
481
530
  <span class="keyword">end</span>
482
531
 
@@ -487,17 +536,17 @@ raise &#39;Please enter all required parameters&#39; if settings.client_id.empty
487
536
  </li>
488
537
 
489
538
 
490
- <li id="section-28">
539
+ <li id="section-31">
491
540
  <div class="annotation">
492
541
 
493
542
  <div class="pilwrap ">
494
- <a class="pilcrow" href="#section-28">&#182;</a>
543
+ <a class="pilcrow" href="#section-31">&#182;</a>
495
544
  </div>
496
- <p>set variables for template</p>
545
+ <p>Set variables for template</p>
497
546
 
498
547
  </div>
499
548
 
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}
549
+ <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; settings.file_id, <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
550
  <span class="keyword">end</span></pre></div></div>
502
551
 
503
552
  </li>
@@ -549,7 +549,7 @@
549
549
  <div class="pilwrap ">
550
550
  <a class="pilcrow" href="#section-32">&#182;</a>
551
551
  </div>
552
- <p>set variables</p>
552
+ <p>Set variables</p>
553
553
 
554
554
  </div>
555
555
 
@@ -558,7 +558,8 @@
558
558
  set <span class="symbol">:name</span>, params[<span class="symbol">:name</span>]
559
559
  set <span class="symbol">:email</span>, params[<span class="symbol">:email</span>]
560
560
  set <span class="symbol">:callback</span>, params[<span class="symbol">:callbackUrl</span>]
561
- set <span class="symbol">:last_name</span>, params[<span class="symbol">:lastName</span>]</pre></div></div>
561
+ set <span class="symbol">:last_name</span>, params[<span class="symbol">:lastName</span>]
562
+ set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]</pre></div></div>
562
563
 
563
564
  </li>
564
565
 
@@ -605,7 +606,7 @@
605
606
  <div class="pilwrap ">
606
607
  <a class="pilcrow" href="#section-35">&#182;</a>
607
608
  </div>
608
- <p>check required variables</p>
609
+ <p>Check required variables</p>
609
610
 
610
611
  </div>
611
612
 
@@ -620,23 +621,60 @@
620
621
  <div class="pilwrap ">
621
622
  <a class="pilcrow" href="#section-36">&#182;</a>
622
623
  </div>
624
+ <p>Prepare base path</p>
625
+
626
+ </div>
627
+
628
+ <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.base_path.empty?
629
+ base_path = <span class="string">'https://api.groupdocs.com'</span>
630
+ <span class="keyword">elsif</span> settings.base_path.match(<span class="string">'/v2.0'</span>)
631
+ base_path = settings.base_path.split(<span class="string">'/v2.0'</span>)[<span class="number">0</span>]
632
+ <span class="keyword">else</span>
633
+ base_path = settings.base_path
634
+ <span class="keyword">end</span></pre></div></div>
635
+
636
+ </li>
637
+
638
+
639
+ <li id="section-37">
640
+ <div class="annotation">
641
+
642
+ <div class="pilwrap ">
643
+ <a class="pilcrow" href="#section-37">&#182;</a>
644
+ </div>
623
645
  <p>Configure your access to API server</p>
624
646
 
625
647
  </div>
626
648
 
627
649
  <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
628
650
  groupdocs.client_id = settings.client_id
629
- groupdocs.private_key = settings.private_key
651
+ groupdocs.private_key = settings.private_key</pre></div></div>
652
+
653
+ </li>
654
+
655
+
656
+ <li id="section-38">
657
+ <div class="annotation">
658
+
659
+ <div class="pilwrap ">
660
+ <a class="pilcrow" href="#section-38">&#182;</a>
661
+ </div>
662
+ <p>Optionally specify API server and version</p>
663
+
664
+ </div>
665
+
666
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="comment">#Default is 'https://api.groupdocs.com'</span>
667
+
630
668
  <span class="keyword">end</span></pre></div></div>
631
669
 
632
670
  </li>
633
671
 
634
672
 
635
- <li id="section-37">
673
+ <li id="section-39">
636
674
  <div class="annotation">
637
675
 
638
676
  <div class="pilwrap ">
639
- <a class="pilcrow" href="#section-37">&#182;</a>
677
+ <a class="pilcrow" href="#section-39">&#182;</a>
640
678
  </div>
641
679
  <p>Write client and private key to the file for callback job</p>
642
680
 
@@ -648,13 +686,13 @@
648
686
  </li>
649
687
 
650
688
 
651
- <li id="section-38">
689
+ <li id="section-40">
652
690
  <div class="annotation">
653
691
 
654
692
  <div class="pilwrap ">
655
- <a class="pilcrow" href="#section-38">&#182;</a>
693
+ <a class="pilcrow" href="#section-40">&#182;</a>
656
694
  </div>
657
- <p>white space is required</p>
695
+ <p>White space is required</p>
658
696
 
659
697
  </div>
660
698
 
@@ -666,11 +704,11 @@
666
704
  </li>
667
705
 
668
706
 
669
- <li id="section-39">
707
+ <li id="section-41">
670
708
  <div class="annotation">
671
709
 
672
710
  <div class="pilwrap ">
673
- <a class="pilcrow" href="#section-39">&#182;</a>
711
+ <a class="pilcrow" href="#section-41">&#182;</a>
674
712
  </div>
675
713
  <p>Construct path</p>
676
714
 
@@ -681,11 +719,11 @@
681
719
  </li>
682
720
 
683
721
 
684
- <li id="section-40">
722
+ <li id="section-42">
685
723
  <div class="annotation">
686
724
 
687
725
  <div class="pilwrap ">
688
- <a class="pilcrow" href="#section-40">&#182;</a>
726
+ <a class="pilcrow" href="#section-42">&#182;</a>
689
727
  </div>
690
728
  <p>Open file</p>
691
729
 
@@ -696,11 +734,11 @@
696
734
  </li>
697
735
 
698
736
 
699
- <li id="section-41">
737
+ <li id="section-43">
700
738
  <div class="annotation">
701
739
 
702
740
  <div class="pilwrap ">
703
- <a class="pilcrow" href="#section-41">&#182;</a>
741
+ <a class="pilcrow" href="#section-43">&#182;</a>
704
742
  </div>
705
743
  <p>Make a request to API using client_id and private_key</p>
706
744
 
@@ -712,13 +750,13 @@
712
750
  </li>
713
751
 
714
752
 
715
- <li id="section-42">
753
+ <li id="section-44">
716
754
  <div class="annotation">
717
755
 
718
756
  <div class="pilwrap ">
719
- <a class="pilcrow" href="#section-42">&#182;</a>
757
+ <a class="pilcrow" href="#section-44">&#182;</a>
720
758
  </div>
721
- <p>create envelope using user id and entered by user name</p>
759
+ <p>Create envelope using user id and entered by user name</p>
722
760
 
723
761
  </div>
724
762
 
@@ -730,11 +768,11 @@
730
768
  </li>
731
769
 
732
770
 
733
- <li id="section-43">
771
+ <li id="section-45">
734
772
  <div class="annotation">
735
773
 
736
774
  <div class="pilwrap ">
737
- <a class="pilcrow" href="#section-43">&#182;</a>
775
+ <a class="pilcrow" href="#section-45">&#182;</a>
738
776
  </div>
739
777
  <p>Add uploaded document to envelope</p>
740
778
 
@@ -745,11 +783,11 @@
745
783
  </li>
746
784
 
747
785
 
748
- <li id="section-44">
786
+ <li id="section-46">
749
787
  <div class="annotation">
750
788
 
751
789
  <div class="pilwrap ">
752
- <a class="pilcrow" href="#section-44">&#182;</a>
790
+ <a class="pilcrow" href="#section-46">&#182;</a>
753
791
  </div>
754
792
  <p>Get role list for current user</p>
755
793
 
@@ -760,11 +798,11 @@
760
798
  </li>
761
799
 
762
800
 
763
- <li id="section-45">
801
+ <li id="section-47">
764
802
  <div class="annotation">
765
803
 
766
804
  <div class="pilwrap ">
767
- <a class="pilcrow" href="#section-45">&#182;</a>
805
+ <a class="pilcrow" href="#section-47">&#182;</a>
768
806
  </div>
769
807
  <p>Create new recipient</p>
770
808
 
@@ -779,11 +817,11 @@
779
817
  </li>
780
818
 
781
819
 
782
- <li id="section-46">
820
+ <li id="section-48">
783
821
  <div class="annotation">
784
822
 
785
823
  <div class="pilwrap ">
786
- <a class="pilcrow" href="#section-46">&#182;</a>
824
+ <a class="pilcrow" href="#section-48">&#182;</a>
787
825
  </div>
788
826
  <p>Add recipient to envelope</p>
789
827
 
@@ -794,11 +832,11 @@
794
832
  </li>
795
833
 
796
834
 
797
- <li id="section-47">
835
+ <li id="section-49">
798
836
  <div class="annotation">
799
837
 
800
838
  <div class="pilwrap ">
801
- <a class="pilcrow" href="#section-47">&#182;</a>
839
+ <a class="pilcrow" href="#section-49">&#182;</a>
802
840
  </div>
803
841
  <p>Get document id</p>
804
842
 
@@ -809,11 +847,11 @@
809
847
  </li>
810
848
 
811
849
 
812
- <li id="section-48">
850
+ <li id="section-50">
813
851
  <div class="annotation">
814
852
 
815
853
  <div class="pilwrap ">
816
- <a class="pilcrow" href="#section-48">&#182;</a>
854
+ <a class="pilcrow" href="#section-50">&#182;</a>
817
855
  </div>
818
856
  <p>Get field and add the location to field</p>
819
857
 
@@ -826,11 +864,11 @@
826
864
  </li>
827
865
 
828
866
 
829
- <li id="section-49">
867
+ <li id="section-51">
830
868
  <div class="annotation">
831
869
 
832
870
  <div class="pilwrap ">
833
- <a class="pilcrow" href="#section-49">&#182;</a>
871
+ <a class="pilcrow" href="#section-51">&#182;</a>
834
872
  </div>
835
873
  <p>Add field to envelope</p>
836
874
 
@@ -841,11 +879,11 @@
841
879
  </li>
842
880
 
843
881
 
844
- <li id="section-50">
882
+ <li id="section-52">
845
883
  <div class="annotation">
846
884
 
847
885
  <div class="pilwrap ">
848
- <a class="pilcrow" href="#section-50">&#182;</a>
886
+ <a class="pilcrow" href="#section-52">&#182;</a>
849
887
  </div>
850
888
  <p>Send envelop</p>
851
889
 
@@ -856,28 +894,63 @@
856
894
  </li>
857
895
 
858
896
 
859
- <li id="section-51">
897
+ <li id="section-53">
860
898
  <div class="annotation">
861
899
 
862
900
  <div class="pilwrap ">
863
- <a class="pilcrow" href="#section-51">&#182;</a>
901
+ <a class="pilcrow" href="#section-53">&#182;</a>
864
902
  </div>
865
- <p>Get url from request</p>
903
+ <p>Prepare to sign url</p>
866
904
 
867
905
  </div>
868
906
 
869
- <div class="content"><div class='highlight'><pre> url = <span class="string">"https://apps.groupdocs.com/signature/signembed/<span class="subst">#{envelope.id}</span>/<span class="subst">#{recipient.id}</span>"</span>
870
-
871
- iframe = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> =&gt; url).prepare_and_sign_url</pre></div></div>
907
+ <div class="content"><div class='highlight'><pre> iframe = <span class="string">"/signature2/signembed/<span class="subst">#{envelope.id}</span>/<span class="subst">#{recipient.id}</span>"</span></pre></div></div>
872
908
 
873
909
  </li>
874
910
 
875
911
 
876
- <li id="section-52">
912
+ <li id="section-54">
877
913
  <div class="annotation">
878
914
 
879
915
  <div class="pilwrap ">
880
- <a class="pilcrow" href="#section-52">&#182;</a>
916
+ <a class="pilcrow" href="#section-54">&#182;</a>
917
+ </div>
918
+ <p>Construct result string</p>
919
+
920
+ </div>
921
+
922
+ <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</pre></div></div>
923
+
924
+ </li>
925
+
926
+
927
+ <li id="section-55">
928
+ <div class="annotation">
929
+
930
+ <div class="pilwrap ">
931
+ <a class="pilcrow" href="#section-55">&#182;</a>
932
+ </div>
933
+ <p>Generate iframe URL</p>
934
+
935
+ </div>
936
+
937
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> base_path
938
+ <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
939
+ iframe = <span class="string">"https://stage-api-groupdocs.dynabic.com<span class="subst">#{url}</span>"</span>
940
+ <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
941
+ iframe = <span class="string">"https://dev-apps.groupdocs.com<span class="subst">#{url}</span>"</span>
942
+ <span class="keyword">else</span>
943
+ iframe = <span class="string">"https://apps.groupdocs.com<span class="subst">#{url}</span>"</span>
944
+ <span class="keyword">end</span></pre></div></div>
945
+
946
+ </li>
947
+
948
+
949
+ <li id="section-56">
950
+ <div class="annotation">
951
+
952
+ <div class="pilwrap ">
953
+ <a class="pilcrow" href="#section-56">&#182;</a>
881
954
  </div>
882
955
  <p>Make iframe</p>
883
956
 
@@ -893,13 +966,13 @@
893
966
  </li>
894
967
 
895
968
 
896
- <li id="section-53">
969
+ <li id="section-57">
897
970
  <div class="annotation">
898
971
 
899
972
  <div class="pilwrap ">
900
- <a class="pilcrow" href="#section-53">&#182;</a>
973
+ <a class="pilcrow" href="#section-57">&#182;</a>
901
974
  </div>
902
- <p>set variables for template</p>
975
+ <p>Set variables for template</p>
903
976
 
904
977
  </div>
905
978