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
@@ -342,9 +342,7 @@
342
342
 
343
343
  </div>
344
344
 
345
- <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.sourceFileId.empty? <span class="keyword">or</span> settings.targetFileId.empty?
346
-
347
- <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>
345
+ <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.sourceFileId.empty? <span class="keyword">or</span> settings.targetFileId.empty?</pre></div></div>
348
346
 
349
347
  </li>
350
348
 
@@ -355,6 +353,27 @@
355
353
  <div class="pilwrap ">
356
354
  <a class="pilcrow" href="#section-20">&#182;</a>
357
355
  </div>
356
+ <p>Prepare base path</p>
357
+
358
+ </div>
359
+
360
+ <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.base_path.empty?
361
+ base_path = <span class="string">'https://api.groupdocs.com'</span>
362
+ <span class="keyword">elsif</span> settings.base_path.match(<span class="string">'/v2.0'</span>)
363
+ base_path = settings.base_path.split(<span class="string">'/v2.0'</span>)[<span class="number">0</span>]
364
+ <span class="keyword">else</span>
365
+ base_path = settings.base_path
366
+ <span class="keyword">end</span></pre></div></div>
367
+
368
+ </li>
369
+
370
+
371
+ <li id="section-21">
372
+ <div class="annotation">
373
+
374
+ <div class="pilwrap ">
375
+ <a class="pilcrow" href="#section-21">&#182;</a>
376
+ </div>
358
377
  <p>Configure your access to API server</p>
359
378
 
360
379
  </div>
@@ -366,27 +385,27 @@
366
385
  </li>
367
386
 
368
387
 
369
- <li id="section-21">
388
+ <li id="section-22">
370
389
  <div class="annotation">
371
390
 
372
391
  <div class="pilwrap ">
373
- <a class="pilcrow" href="#section-21">&#182;</a>
392
+ <a class="pilcrow" href="#section-22">&#182;</a>
374
393
  </div>
375
394
  <p>Optionally specify API server and version</p>
376
395
 
377
396
  </div>
378
397
 
379
- <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
398
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
380
399
  <span class="keyword">end</span></pre></div></div>
381
400
 
382
401
  </li>
383
402
 
384
403
 
385
- <li id="section-22">
404
+ <li id="section-23">
386
405
  <div class="annotation">
387
406
 
388
407
  <div class="pilwrap ">
389
- <a class="pilcrow" href="#section-22">&#182;</a>
408
+ <a class="pilcrow" href="#section-23">&#182;</a>
390
409
  </div>
391
410
  <p>Write client and private key to the file for callback job</p>
392
411
 
@@ -398,13 +417,13 @@
398
417
  </li>
399
418
 
400
419
 
401
- <li id="section-23">
420
+ <li id="section-24">
402
421
  <div class="annotation">
403
422
 
404
423
  <div class="pilwrap ">
405
- <a class="pilcrow" href="#section-23">&#182;</a>
424
+ <a class="pilcrow" href="#section-24">&#182;</a>
406
425
  </div>
407
- <p>white space is required</p>
426
+ <p>White space is required</p>
408
427
 
409
428
  </div>
410
429
 
@@ -416,11 +435,11 @@
416
435
  </li>
417
436
 
418
437
 
419
- <li id="section-24">
438
+ <li id="section-25">
420
439
  <div class="annotation">
421
440
 
422
441
  <div class="pilwrap ">
423
- <a class="pilcrow" href="#section-24">&#182;</a>
442
+ <a class="pilcrow" href="#section-25">&#182;</a>
424
443
  </div>
425
444
  <p>Make a request to API using client_id and private_key</p>
426
445
 
@@ -434,11 +453,11 @@
434
453
  </li>
435
454
 
436
455
 
437
- <li id="section-25">
456
+ <li id="section-26">
438
457
  <div class="annotation">
439
458
 
440
459
  <div class="pilwrap ">
441
- <a class="pilcrow" href="#section-25">&#182;</a>
460
+ <a class="pilcrow" href="#section-26">&#182;</a>
442
461
  </div>
443
462
  <p>Get source and target documents by file ID</p>
444
463
 
@@ -470,11 +489,11 @@
470
489
  </li>
471
490
 
472
491
 
473
- <li id="section-26">
492
+ <li id="section-27">
474
493
  <div class="annotation">
475
494
 
476
495
  <div class="pilwrap ">
477
- <a class="pilcrow" href="#section-26">&#182;</a>
496
+ <a class="pilcrow" href="#section-27">&#182;</a>
478
497
  </div>
479
498
  <p>Get job by ID</p>
480
499
 
@@ -485,11 +504,11 @@
485
504
  </li>
486
505
 
487
506
 
488
- <li id="section-27">
507
+ <li id="section-28">
489
508
  <div class="annotation">
490
509
 
491
510
  <div class="pilwrap ">
492
- <a class="pilcrow" href="#section-27">&#182;</a>
511
+ <a class="pilcrow" href="#section-28">&#182;</a>
493
512
  </div>
494
513
  <p>Get all job documents</p>
495
514
 
@@ -500,11 +519,11 @@
500
519
  </li>
501
520
 
502
521
 
503
- <li id="section-28">
522
+ <li id="section-29">
504
523
  <div class="annotation">
505
524
 
506
525
  <div class="pilwrap ">
507
- <a class="pilcrow" href="#section-28">&#182;</a>
526
+ <a class="pilcrow" href="#section-29">&#182;</a>
508
527
  </div>
509
528
  <p>Get compared file giud</p>
510
529
 
@@ -515,56 +534,69 @@
515
534
  </li>
516
535
 
517
536
 
518
- <li id="section-29">
537
+ <li id="section-30">
519
538
  <div class="annotation">
520
539
 
521
540
  <div class="pilwrap ">
522
- <a class="pilcrow" href="#section-29">&#182;</a>
541
+ <a class="pilcrow" href="#section-30">&#182;</a>
523
542
  </div>
524
- <p>Get url from request</p>
543
+ <p>Prepare to sign url</p>
525
544
 
526
545
  </div>
527
546
 
528
- <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.base_path
547
+ <div class="content"><div class='highlight'><pre> iframe = <span class="string">"/document-viewer/embed/<span class="subst">#{guid}</span>"</span></pre></div></div>
548
+
549
+ </li>
550
+
551
+
552
+ <li id="section-31">
553
+ <div class="annotation">
554
+
555
+ <div class="pilwrap ">
556
+ <a class="pilcrow" href="#section-31">&#182;</a>
557
+ </div>
558
+ <p>Construct result string</p>
529
559
 
530
- <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
531
- url = <span class="string">"http://stage-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{guid}</span>"</span>
532
- <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
533
- url = <span class="string">"http://dev-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{guid}</span>"</span>
534
- <span class="keyword">else</span>
535
- url = <span class="string">"https://apps.groupdocs.com/document-viewer/embed/<span class="subst">#{guid}</span>"</span>
536
- <span class="keyword">end</span></pre></div></div>
560
+ </div>
561
+
562
+ <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>
537
563
 
538
564
  </li>
539
565
 
540
566
 
541
- <li id="section-30">
567
+ <li id="section-32">
542
568
  <div class="annotation">
543
569
 
544
570
  <div class="pilwrap ">
545
- <a class="pilcrow" href="#section-30">&#182;</a>
571
+ <a class="pilcrow" href="#section-32">&#182;</a>
546
572
  </div>
547
- <p>Add the signature to url request</p>
573
+ <p>Generate iframe URL</p>
548
574
 
549
575
  </div>
550
576
 
551
- <div class="content"><div class='highlight'><pre> iframe = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> =&gt; url).prepare_and_sign_url</pre></div></div>
577
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.base_path
578
+ <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
579
+ iframe = <span class="string">"https://stage-api-groupdocs.dynabic.com<span class="subst">#{url}</span>"</span>
580
+ <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
581
+ iframe = <span class="string">"https://dev-apps.groupdocs.com<span class="subst">#{url}</span>"</span>
582
+ <span class="keyword">else</span>
583
+ iframe = <span class="string">"https://apps.groupdocs.com<span class="subst">#{url}</span>"</span>
584
+ <span class="keyword">end</span></pre></div></div>
552
585
 
553
586
  </li>
554
587
 
555
588
 
556
- <li id="section-31">
589
+ <li id="section-33">
557
590
  <div class="annotation">
558
591
 
559
592
  <div class="pilwrap ">
560
- <a class="pilcrow" href="#section-31">&#182;</a>
593
+ <a class="pilcrow" href="#section-33">&#182;</a>
561
594
  </div>
562
595
  <p>Construct result iframe</p>
563
596
 
564
597
  </div>
565
598
 
566
- <div class="content"><div class='highlight'><pre> iframe = <span class="string">"&lt;iframe src='<span class="subst">#{iframe}</span>' frameborder='0' width='100%' height='600'&gt;&lt;/iframe&gt;"</span>
567
-
599
+ <div class="content"><div class='highlight'><pre> iframe = <span class="string">"&lt;iframe id='downloadframe' src='<span class="subst">#{iframe}</span>' width='800' height='1000'&gt;&lt;/iframe&gt;"</span>
568
600
  <span class="keyword">end</span>
569
601
 
570
602
  <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e
@@ -574,11 +606,11 @@
574
606
  </li>
575
607
 
576
608
 
577
- <li id="section-32">
609
+ <li id="section-34">
578
610
  <div class="annotation">
579
611
 
580
612
  <div class="pilwrap ">
581
- <a class="pilcrow" href="#section-32">&#182;</a>
613
+ <a class="pilcrow" href="#section-34">&#182;</a>
582
614
  </div>
583
615
  <p>Set variables for template</p>
584
616
 
@@ -59,7 +59,7 @@
59
59
  <div class="pilwrap ">
60
60
  <a class="pilcrow" href="#section-3">&#182;</a>
61
61
  </div>
62
- <p>set variables</p>
62
+ <p>Set variables</p>
63
63
 
64
64
  </div>
65
65
 
@@ -79,13 +79,11 @@
79
79
  <div class="pilwrap ">
80
80
  <a class="pilcrow" href="#section-4">&#182;</a>
81
81
  </div>
82
- <p>check required variables</p>
82
+ <p>Check required variables</p>
83
83
 
84
84
  </div>
85
85
 
86
- <div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.client_id.empty? <span class="keyword">or</span> settings.private_key.empty? <span class="keyword">or</span> settings.resultFileId.empty?
87
-
88
- <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>
86
+ <div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.client_id.empty? <span class="keyword">or</span> settings.private_key.empty? <span class="keyword">or</span> settings.resultFileId.empty?</pre></div></div>
89
87
 
90
88
  </li>
91
89
 
@@ -96,13 +94,17 @@
96
94
  <div class="pilwrap ">
97
95
  <a class="pilcrow" href="#section-5">&#182;</a>
98
96
  </div>
99
- <p>Configure your access to API server</p>
97
+ <p>Prepare base path</p>
100
98
 
101
99
  </div>
102
100
 
103
- <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
104
- groupdocs.client_id = settings.client_id
105
- groupdocs.private_key = settings.private_key</pre></div></div>
101
+ <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.base_path.empty?
102
+ base_path = <span class="string">'https://api.groupdocs.com'</span>
103
+ <span class="keyword">elsif</span> settings.base_path.match(<span class="string">'/v2.0'</span>)
104
+ base_path = settings.base_path.split(<span class="string">'/v2.0'</span>)[<span class="number">0</span>]
105
+ <span class="keyword">else</span>
106
+ base_path = settings.base_path
107
+ <span class="keyword">end</span></pre></div></div>
106
108
 
107
109
  </li>
108
110
 
@@ -113,12 +115,13 @@
113
115
  <div class="pilwrap ">
114
116
  <a class="pilcrow" href="#section-6">&#182;</a>
115
117
  </div>
116
- <p>Optionally specify API server and version</p>
118
+ <p>Configure your access to API server</p>
117
119
 
118
120
  </div>
119
121
 
120
- <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
121
- <span class="keyword">end</span></pre></div></div>
122
+ <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
123
+ groupdocs.client_id = settings.client_id
124
+ groupdocs.private_key = settings.private_key</pre></div></div>
122
125
 
123
126
  </li>
124
127
 
@@ -129,11 +132,12 @@
129
132
  <div class="pilwrap ">
130
133
  <a class="pilcrow" href="#section-7">&#182;</a>
131
134
  </div>
132
- <p>construct new storage file</p>
135
+ <p>Optionally specify API server and version</p>
133
136
 
134
137
  </div>
135
138
 
136
- <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.new(<span class="symbol">guid:</span> settings.resultFileId)</pre></div></div>
139
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
140
+ <span class="keyword">end</span></pre></div></div>
137
141
 
138
142
  </li>
139
143
 
@@ -144,11 +148,11 @@
144
148
  <div class="pilwrap ">
145
149
  <a class="pilcrow" href="#section-8">&#182;</a>
146
150
  </div>
147
- <p>construct new document</p>
151
+ <p>Construct new storage file</p>
148
152
 
149
153
  </div>
150
154
 
151
- <div class="content"><div class='highlight'><pre> document = <span class="constant">GroupDocs::Document</span>.new(<span class="symbol">file:</span> file)</pre></div></div>
155
+ <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.new(<span class="symbol">guid:</span> settings.resultFileId)</pre></div></div>
152
156
 
153
157
  </li>
154
158
 
@@ -159,12 +163,26 @@
159
163
  <div class="pilwrap ">
160
164
  <a class="pilcrow" href="#section-9">&#182;</a>
161
165
  </div>
162
- <p>get compare changes</p>
166
+ <p>Construct new document</p>
163
167
 
164
168
  </div>
165
169
 
166
- <div class="content"><div class='highlight'><pre> changes = document.changes!()
170
+ <div class="content"><div class='highlight'><pre> document = <span class="constant">GroupDocs::Document</span>.new(<span class="symbol">file:</span> file)</pre></div></div>
171
+
172
+ </li>
173
+
174
+
175
+ <li id="section-10">
176
+ <div class="annotation">
177
+
178
+ <div class="pilwrap ">
179
+ <a class="pilcrow" href="#section-10">&#182;</a>
180
+ </div>
181
+ <p>Get compare changes</p>
167
182
 
183
+ </div>
184
+
185
+ <div class="content"><div class='highlight'><pre> changes = document.changes!()
168
186
  result = <span class="string">''</span>
169
187
  result += <span class="string">"&lt;table class='border'&gt;"</span>
170
188
  result += <span class="string">"&lt;tr&gt;&lt;td&gt;&lt;font color='green'&gt;Change Name&lt;/font&gt;&lt;/td&gt;&lt;td&gt;&lt;font color='green'&gt;Change&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;"</span>
@@ -191,13 +209,13 @@
191
209
  </li>
192
210
 
193
211
 
194
- <li id="section-10">
212
+ <li id="section-11">
195
213
  <div class="annotation">
196
214
 
197
215
  <div class="pilwrap ">
198
- <a class="pilcrow" href="#section-10">&#182;</a>
216
+ <a class="pilcrow" href="#section-11">&#182;</a>
199
217
  </div>
200
- <p>set variables for template</p>
218
+ <p>Set variables for template</p>
201
219
 
202
220
  </div>
203
221
 
@@ -282,7 +282,7 @@
282
282
  <div class="pilwrap ">
283
283
  <a class="pilcrow" href="#section-16">&#182;</a>
284
284
  </div>
285
- <p>set variables</p>
285
+ <p>Set variables</p>
286
286
 
287
287
  </div>
288
288
 
@@ -346,9 +346,7 @@
346
346
 
347
347
  </div>
348
348
 
349
- <div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.client_id.empty? <span class="keyword">or</span> settings.private_key.empty? <span class="keyword">or</span> settings.email.empty? <span class="keyword">or</span> settings.name.empty? <span class="keyword">or</span> settings.lastName.empty?
350
-
351
- <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>
349
+ <div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.client_id.empty? <span class="keyword">or</span> settings.private_key.empty? <span class="keyword">or</span> settings.email.empty? <span class="keyword">or</span> settings.name.empty? <span class="keyword">or</span> settings.lastName.empty?</pre></div></div>
352
350
 
353
351
  </li>
354
352
 
@@ -359,6 +357,27 @@
359
357
  <div class="pilwrap ">
360
358
  <a class="pilcrow" href="#section-20">&#182;</a>
361
359
  </div>
360
+ <p>Prepare base path</p>
361
+
362
+ </div>
363
+
364
+ <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.base_path.empty?
365
+ base_path = <span class="string">'https://api.groupdocs.com'</span>
366
+ <span class="keyword">elsif</span> settings.base_path.match(<span class="string">'/v2.0'</span>)
367
+ base_path = settings.base_path.split(<span class="string">'/v2.0'</span>)[<span class="number">0</span>]
368
+ <span class="keyword">else</span>
369
+ base_path = settings.base_path
370
+ <span class="keyword">end</span></pre></div></div>
371
+
372
+ </li>
373
+
374
+
375
+ <li id="section-21">
376
+ <div class="annotation">
377
+
378
+ <div class="pilwrap ">
379
+ <a class="pilcrow" href="#section-21">&#182;</a>
380
+ </div>
362
381
  <p>Configure your access to API server</p>
363
382
 
364
383
  </div>
@@ -370,27 +389,27 @@
370
389
  </li>
371
390
 
372
391
 
373
- <li id="section-21">
392
+ <li id="section-22">
374
393
  <div class="annotation">
375
394
 
376
395
  <div class="pilwrap ">
377
- <a class="pilcrow" href="#section-21">&#182;</a>
396
+ <a class="pilcrow" href="#section-22">&#182;</a>
378
397
  </div>
379
398
  <p>Optionally specify API server and version</p>
380
399
 
381
400
  </div>
382
401
 
383
- <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
402
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
384
403
  <span class="keyword">end</span></pre></div></div>
385
404
 
386
405
  </li>
387
406
 
388
407
 
389
- <li id="section-22">
408
+ <li id="section-23">
390
409
  <div class="annotation">
391
410
 
392
411
  <div class="pilwrap ">
393
- <a class="pilcrow" href="#section-22">&#182;</a>
412
+ <a class="pilcrow" href="#section-23">&#182;</a>
394
413
  </div>
395
414
  <p>Write client and private key to the file for callback job</p>
396
415
 
@@ -402,13 +421,13 @@
402
421
  </li>
403
422
 
404
423
 
405
- <li id="section-23">
424
+ <li id="section-24">
406
425
  <div class="annotation">
407
426
 
408
427
  <div class="pilwrap ">
409
- <a class="pilcrow" href="#section-23">&#182;</a>
428
+ <a class="pilcrow" href="#section-24">&#182;</a>
410
429
  </div>
411
- <p>white space is required</p>
430
+ <p>White space is required</p>
412
431
 
413
432
  </div>
414
433
 
@@ -422,13 +441,13 @@
422
441
  </li>
423
442
 
424
443
 
425
- <li id="section-24">
444
+ <li id="section-25">
426
445
  <div class="annotation">
427
446
 
428
447
  <div class="pilwrap ">
429
- <a class="pilcrow" href="#section-24">&#182;</a>
448
+ <a class="pilcrow" href="#section-25">&#182;</a>
430
449
  </div>
431
- <p>get document by file GUID</p>
450
+ <p>Get document by file GUID</p>
432
451
 
433
452
  </div>
434
453
 
@@ -438,11 +457,11 @@
438
457
  </li>
439
458
 
440
459
 
441
- <li id="section-25">
460
+ <li id="section-26">
442
461
  <div class="annotation">
443
462
 
444
463
  <div class="pilwrap ">
445
- <a class="pilcrow" href="#section-25">&#182;</a>
464
+ <a class="pilcrow" href="#section-26">&#182;</a>
446
465
  </div>
447
466
  <p>Create instance of File</p>
448
467
 
@@ -455,13 +474,13 @@
455
474
  </li>
456
475
 
457
476
 
458
- <li id="section-26">
477
+ <li id="section-27">
459
478
  <div class="annotation">
460
479
 
461
480
  <div class="pilwrap ">
462
- <a class="pilcrow" href="#section-26">&#182;</a>
481
+ <a class="pilcrow" href="#section-27">&#182;</a>
463
482
  </div>
464
- <p>construct path</p>
483
+ <p>Construct path</p>
465
484
 
466
485
  </div>
467
486
 
@@ -470,13 +489,13 @@
470
489
  </li>
471
490
 
472
491
 
473
- <li id="section-27">
492
+ <li id="section-28">
474
493
  <div class="annotation">
475
494
 
476
495
  <div class="pilwrap ">
477
- <a class="pilcrow" href="#section-27">&#182;</a>
496
+ <a class="pilcrow" href="#section-28">&#182;</a>
478
497
  </div>
479
- <p>open file</p>
498
+ <p>Open file</p>
480
499
 
481
500
  </div>
482
501
 
@@ -485,13 +504,13 @@
485
504
  </li>
486
505
 
487
506
 
488
- <li id="section-28">
507
+ <li id="section-29">
489
508
  <div class="annotation">
490
509
 
491
510
  <div class="pilwrap ">
492
- <a class="pilcrow" href="#section-28">&#182;</a>
511
+ <a class="pilcrow" href="#section-29">&#182;</a>
493
512
  </div>
494
- <p>make a request to API using client_id and private_key</p>
513
+ <p>Make a request to API using client_id and private_key</p>
495
514
 
496
515
  </div>
497
516
 
@@ -501,11 +520,11 @@
501
520
  </li>
502
521
 
503
522
 
504
- <li id="section-29">
523
+ <li id="section-30">
505
524
  <div class="annotation">
506
525
 
507
526
  <div class="pilwrap ">
508
- <a class="pilcrow" href="#section-29">&#182;</a>
527
+ <a class="pilcrow" href="#section-30">&#182;</a>
509
528
  </div>
510
529
  <p>Upload file from defined url</p>
511
530
 
@@ -521,13 +540,13 @@
521
540
  </li>
522
541
 
523
542
 
524
- <li id="section-30">
543
+ <li id="section-31">
525
544
  <div class="annotation">
526
545
 
527
546
  <div class="pilwrap ">
528
- <a class="pilcrow" href="#section-30">&#182;</a>
547
+ <a class="pilcrow" href="#section-31">&#182;</a>
529
548
  </div>
530
- <p>create envelope using user id and entered by user name</p>
549
+ <p>Create envelope using user id and entered by user name</p>
531
550
 
532
551
  </div>
533
552
 
@@ -539,11 +558,11 @@
539
558
  </li>
540
559
 
541
560
 
542
- <li id="section-31">
561
+ <li id="section-32">
543
562
  <div class="annotation">
544
563
 
545
564
  <div class="pilwrap ">
546
- <a class="pilcrow" href="#section-31">&#182;</a>
565
+ <a class="pilcrow" href="#section-32">&#182;</a>
547
566
  </div>
548
567
  <p>Add uploaded document to envelope</p>
549
568
 
@@ -554,11 +573,11 @@
554
573
  </li>
555
574
 
556
575
 
557
- <li id="section-32">
576
+ <li id="section-33">
558
577
  <div class="annotation">
559
578
 
560
579
  <div class="pilwrap ">
561
- <a class="pilcrow" href="#section-32">&#182;</a>
580
+ <a class="pilcrow" href="#section-33">&#182;</a>
562
581
  </div>
563
582
  <p>Get role list for current user</p>
564
583
 
@@ -569,11 +588,11 @@
569
588
  </li>
570
589
 
571
590
 
572
- <li id="section-33">
591
+ <li id="section-34">
573
592
  <div class="annotation">
574
593
 
575
594
  <div class="pilwrap ">
576
- <a class="pilcrow" href="#section-33">&#182;</a>
595
+ <a class="pilcrow" href="#section-34">&#182;</a>
577
596
  </div>
578
597
  <p>Create new recipient</p>
579
598
 
@@ -588,32 +607,17 @@
588
607
  </li>
589
608
 
590
609
 
591
- <li id="section-34">
592
- <div class="annotation">
593
-
594
- <div class="pilwrap ">
595
- <a class="pilcrow" href="#section-34">&#182;</a>
596
- </div>
597
- <p>Add recipient to envelope</p>
598
-
599
- </div>
600
-
601
- <div class="content"><div class='highlight'><pre> add = envelope.add_recipient!(recipient)</pre></div></div>
602
-
603
- </li>
604
-
605
-
606
610
  <li id="section-35">
607
611
  <div class="annotation">
608
612
 
609
613
  <div class="pilwrap ">
610
614
  <a class="pilcrow" href="#section-35">&#182;</a>
611
615
  </div>
612
- <p>Get recipient id</p>
616
+ <p>Add recipient to envelope</p>
613
617
 
614
618
  </div>
615
619
 
616
- <div class="content"><div class='highlight'><pre> recipient.id = add[<span class="symbol">:recipient</span>][<span class="symbol">:id</span>]</pre></div></div>
620
+ <div class="content"><div class='highlight'><pre> recipient = envelope.add_recipient!(recipient)</pre></div></div>
617
621
 
618
622
  </li>
619
623
 
@@ -686,38 +690,78 @@
686
690
  <div class="pilwrap ">
687
691
  <a class="pilcrow" href="#section-40">&#182;</a>
688
692
  </div>
689
- <p>Get url from request</p>
693
+ <p>Prepare to sign url</p>
690
694
 
691
695
  </div>
692
696
 
693
- <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.base_path
697
+ <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>
698
+
699
+ </li>
700
+
701
+
702
+ <li id="section-41">
703
+ <div class="annotation">
704
+
705
+ <div class="pilwrap ">
706
+ <a class="pilcrow" href="#section-41">&#182;</a>
707
+ </div>
708
+ <p>Construct result string</p>
694
709
 
710
+ </div>
711
+
712
+ <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>
713
+
714
+ </li>
715
+
716
+
717
+ <li id="section-42">
718
+ <div class="annotation">
719
+
720
+ <div class="pilwrap ">
721
+ <a class="pilcrow" href="#section-42">&#182;</a>
722
+ </div>
723
+ <p>Generate iframe URL</p>
724
+
725
+ </div>
726
+
727
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> base_path
695
728
  <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
696
- url = <span class="string">"http://stage-apps-groupdocs.dynabic.com/signature/signembed/<span class="subst">#{envelope.id}</span>/<span class="subst">#{recipient.id}</span>"</span>
729
+ iframe = <span class="string">"https://stage-api-groupdocs.dynabic.com<span class="subst">#{url}</span>"</span>
697
730
  <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
698
- url = <span class="string">"http://dev-apps-groupdocs.dynabic.com/signature/signembed/<span class="subst">#{envelope.id}</span>/<span class="subst">#{recipient.id}</span>"</span>
731
+ iframe = <span class="string">"https://dev-apps.groupdocs.com<span class="subst">#{url}</span>"</span>
699
732
  <span class="keyword">else</span>
700
- url = <span class="string">"https://apps.groupdocs.com/signature/signembed/<span class="subst">#{envelope.id}</span>/<span class="subst">#{recipient.id}</span>"</span>
701
- <span class="keyword">end</span>
702
-
703
-
704
- iframe = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> =&gt; url).prepare_and_sign_url</pre></div></div>
733
+ iframe = <span class="string">"https://apps.groupdocs.com<span class="subst">#{url}</span>"</span>
734
+ <span class="keyword">end</span></pre></div></div>
705
735
 
706
736
  </li>
707
737
 
708
738
 
709
- <li id="section-41">
739
+ <li id="section-43">
710
740
  <div class="annotation">
711
741
 
712
742
  <div class="pilwrap ">
713
- <a class="pilcrow" href="#section-41">&#182;</a>
743
+ <a class="pilcrow" href="#section-43">&#182;</a>
714
744
  </div>
715
745
  <p>Make iframe</p>
716
746
 
717
747
  </div>
718
748
 
719
- <div class="content"><div class='highlight'><pre> iframe = <span class="string">"&lt;iframe src='<span class="subst">#{iframe}</span>' frameborder='0' width='720' height='600'&gt;&lt;/iframe&gt;"</span>
720
- message = <span class="string">"&lt;p&gt;File was uploaded to GroupDocs. Here you can see your &lt;strong&gt;<span class="subst">#{name}</span>&lt;/strong&gt; file in the GroupDocs Embedded Viewer.&lt;/p&gt;"</span>
749
+ <div class="content"><div class='highlight'><pre> iframe = <span class="string">"&lt;iframe id='downloadframe' src='<span class="subst">#{iframe}</span>' width='800' height='1000'&gt;&lt;/iframe&gt;"</span></pre></div></div>
750
+
751
+ </li>
752
+
753
+
754
+ <li id="section-44">
755
+ <div class="annotation">
756
+
757
+ <div class="pilwrap ">
758
+ <a class="pilcrow" href="#section-44">&#182;</a>
759
+ </div>
760
+ <p>Create message</p>
761
+
762
+ </div>
763
+
764
+ <div class="content"><div class='highlight'><pre> message = <span class="string">"&lt;p&gt;File was uploaded to GroupDocs. Here you can see your &lt;strong&gt;<span class="subst">#{name}</span>&lt;/strong&gt; file in the GroupDocs Embedded Viewer.&lt;/p&gt;"</span>
721
765
  <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e
722
766
  err = e.message
723
767
  <span class="keyword">end</span></pre></div></div>
@@ -725,11 +769,11 @@
725
769
  </li>
726
770
 
727
771
 
728
- <li id="section-42">
772
+ <li id="section-45">
729
773
  <div class="annotation">
730
774
 
731
775
  <div class="pilwrap ">
732
- <a class="pilcrow" href="#section-42">&#182;</a>
776
+ <a class="pilcrow" href="#section-45">&#182;</a>
733
777
  </div>
734
778
  <p>Set variables for template</p>
735
779