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
@@ -83,9 +83,7 @@
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?
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?</pre></div></div>
89
87
 
90
88
  </li>
91
89
 
@@ -96,6 +94,27 @@
96
94
  <div class="pilwrap ">
97
95
  <a class="pilcrow" href="#section-5">&#182;</a>
98
96
  </div>
97
+ <p>Prepare base path</p>
98
+
99
+ </div>
100
+
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>
108
+
109
+ </li>
110
+
111
+
112
+ <li id="section-6">
113
+ <div class="annotation">
114
+
115
+ <div class="pilwrap ">
116
+ <a class="pilcrow" href="#section-6">&#182;</a>
117
+ </div>
99
118
  <p>Configure your access to API server</p>
100
119
 
101
120
  </div>
@@ -107,27 +126,27 @@
107
126
  </li>
108
127
 
109
128
 
110
- <li id="section-6">
129
+ <li id="section-7">
111
130
  <div class="annotation">
112
131
 
113
132
  <div class="pilwrap ">
114
- <a class="pilcrow" href="#section-6">&#182;</a>
133
+ <a class="pilcrow" href="#section-7">&#182;</a>
115
134
  </div>
116
135
  <p>Optionally specify API server and version</p>
117
136
 
118
137
  </div>
119
138
 
120
- <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
139
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
121
140
  <span class="keyword">end</span></pre></div></div>
122
141
 
123
142
  </li>
124
143
 
125
144
 
126
- <li id="section-7">
145
+ <li id="section-8">
127
146
  <div class="annotation">
128
147
 
129
148
  <div class="pilwrap ">
130
- <a class="pilcrow" href="#section-7">&#182;</a>
149
+ <a class="pilcrow" href="#section-8">&#182;</a>
131
150
  </div>
132
151
  <p>Create new Folder</p>
133
152
 
@@ -145,13 +164,13 @@
145
164
  </li>
146
165
 
147
166
 
148
- <li id="section-8">
167
+ <li id="section-9">
149
168
  <div class="annotation">
150
169
 
151
170
  <div class="pilwrap ">
152
- <a class="pilcrow" href="#section-8">&#182;</a>
171
+ <a class="pilcrow" href="#section-9">&#182;</a>
153
172
  </div>
154
- <p>set variables for template</p>
173
+ <p>Set variables for template</p>
155
174
 
156
175
  </div>
157
176
 
@@ -85,9 +85,7 @@
85
85
 
86
86
  </div>
87
87
 
88
- <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?
89
-
90
- <span class="keyword">if</span> settings.path.empty? <span class="keyword">then</span> settings.path == <span class="string">'https://api.groupdocs.com'</span> <span class="keyword">end</span></pre></div></div>
88
+ <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?</pre></div></div>
91
89
 
92
90
  </li>
93
91
 
@@ -98,11 +96,17 @@
98
96
  <div class="pilwrap ">
99
97
  <a class="pilcrow" href="#section-5">&#182;</a>
100
98
  </div>
101
- <p>clean version if it contains</p>
99
+ <p>Prepare base path</p>
102
100
 
103
101
  </div>
104
102
 
105
- <div class="content"><div class='highlight'><pre> path = settings.path.gsub(<span class="regexp">/\/v2.0/</span>, <span class="string">''</span>)</pre></div></div>
103
+ <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.base_path.empty?
104
+ base_path = <span class="string">'https://api.groupdocs.com'</span>
105
+ <span class="keyword">elsif</span> settings.base_path.match(<span class="string">'/v2.0'</span>)
106
+ base_path = settings.base_path.split(<span class="string">'/v2.0'</span>)[<span class="number">0</span>]
107
+ <span class="keyword">else</span>
108
+ base_path = settings.base_path
109
+ <span class="keyword">end</span></pre></div></div>
106
110
 
107
111
  </li>
108
112
 
@@ -130,11 +134,11 @@
130
134
  <div class="pilwrap ">
131
135
  <a class="pilcrow" href="#section-7">&#182;</a>
132
136
  </div>
133
- <p>optionally specify API server and version</p>
137
+ <p>Optionally specify API server and version</p>
134
138
 
135
139
  </div>
136
140
 
137
- <div class="content"><div class='highlight'><pre> groupdocs.api_server = path <span class="comment"># default is 'https://api.groupdocs.com' https://dev-api-groupdocs.dynabic.com/v2.0</span>
141
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
138
142
 
139
143
  <span class="keyword">end</span></pre></div></div>
140
144
 
@@ -378,9 +382,7 @@
378
382
  set <span class="symbol">:path</span>, params[<span class="symbol">:basePath</span>]
379
383
  set <span class="symbol">:file_id</span>, params[<span class="symbol">:fileId</span>]
380
384
 
381
- <span class="keyword">begin</span>
382
-
383
- <span class="keyword">if</span> settings.path.empty? <span class="keyword">then</span> settings.path == <span class="string">'https://api.groupdocs.com'</span> <span class="keyword">end</span></pre></div></div>
385
+ <span class="keyword">begin</span></pre></div></div>
384
386
 
385
387
  </li>
386
388
 
@@ -391,11 +393,17 @@
391
393
  <div class="pilwrap ">
392
394
  <a class="pilcrow" href="#section-21">&#182;</a>
393
395
  </div>
394
- <p>clean version if it contains</p>
396
+ <p>Prepare base path</p>
395
397
 
396
398
  </div>
397
399
 
398
- <div class="content"><div class='highlight'><pre> path = settings.path.gsub(<span class="regexp">/\/v2.0/</span>, <span class="string">''</span>)</pre></div></div>
400
+ <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.base_path.empty?
401
+ base_path = <span class="string">'https://api.groupdocs.com'</span>
402
+ <span class="keyword">elsif</span> settings.base_path.match(<span class="string">'/v2.0'</span>)
403
+ base_path = settings.base_path.split(<span class="string">'/v2.0'</span>)[<span class="number">0</span>]
404
+ <span class="keyword">else</span>
405
+ base_path = settings.base_path
406
+ <span class="keyword">end</span></pre></div></div>
399
407
 
400
408
  </li>
401
409
 
@@ -423,12 +431,11 @@
423
431
  <div class="pilwrap ">
424
432
  <a class="pilcrow" href="#section-23">&#182;</a>
425
433
  </div>
426
- <p>optionally specify API server and version</p>
434
+ <p>Optionally specify API server and version</p>
427
435
 
428
436
  </div>
429
437
 
430
- <div class="content"><div class='highlight'><pre> groupdocs.api_server = path <span class="comment"># default is 'https://api.groupdocs.com'</span>
431
- groupdocs.api_version = <span class="string">'2.0'</span> <span class="comment"># default is '2.0'</span>
438
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
432
439
  <span class="keyword">end</span></pre></div></div>
433
440
 
434
441
  </li>
@@ -638,18 +645,74 @@ Merge template PDF FIle with the data provided via dynamically created HTML form
638
645
 
639
646
  </div>
640
647
 
641
- <div class="content"><div class='highlight'><pre> guid = document[<span class="symbol">:inputs</span>][<span class="number">0</span>].outputs[<span class="number">0</span>].guid
642
-
643
- <span class="keyword">case</span> path
644
-
645
- <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
646
- iframe = <span class="string">"&lt;iframe width='100%' height='600' frameborder='0' src='http://stage-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{guid}</span>'&gt;&lt;/iframe&gt;"</span>
647
- <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
648
- iframe = <span class="string">"&lt;iframe width='100%' height='600' frameborder='0' src='http://dev-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{guid}</span>'&gt;&lt;/iframe&gt;"</span>
649
- <span class="keyword">else</span>
650
- iframe = <span class="string">"&lt;iframe width='100%' height='600' frameborder='0' src='https://apps.groupdocs.com/document-viewer/embed/<span class="subst">#{guid}</span>'&gt;&lt;/iframe&gt;"</span>
651
- <span class="keyword">end</span>
652
-
648
+ <div class="content"><div class='highlight'><pre> guid = document[<span class="symbol">:inputs</span>][<span class="number">0</span>].outputs[<span class="number">0</span>].guid</pre></div></div>
649
+
650
+ </li>
651
+
652
+
653
+ <li id="section-35">
654
+ <div class="annotation">
655
+
656
+ <div class="pilwrap ">
657
+ <a class="pilcrow" href="#section-35">&#182;</a>
658
+ </div>
659
+ <p>Prepare to sign url</p>
660
+
661
+ </div>
662
+
663
+ <div class="content"><div class='highlight'><pre> iframe = <span class="string">"/document-viewer/embed/<span class="subst">#{guid}</span>"</span></pre></div></div>
664
+
665
+ </li>
666
+
667
+
668
+ <li id="section-36">
669
+ <div class="annotation">
670
+
671
+ <div class="pilwrap ">
672
+ <a class="pilcrow" href="#section-36">&#182;</a>
673
+ </div>
674
+ <p>Construct result string</p>
675
+
676
+ </div>
677
+
678
+ <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>
679
+
680
+ </li>
681
+
682
+
683
+ <li id="section-37">
684
+ <div class="annotation">
685
+
686
+ <div class="pilwrap ">
687
+ <a class="pilcrow" href="#section-37">&#182;</a>
688
+ </div>
689
+ <p>Generate iframe URL</p>
690
+
691
+ </div>
692
+
693
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> base_path
694
+ <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
695
+ iframe = <span class="string">"https://stage-api-groupdocs.dynabic.com<span class="subst">#{url}</span>"</span>
696
+ <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
697
+ iframe = <span class="string">"https://dev-apps.groupdocs.com<span class="subst">#{url}</span>"</span>
698
+ <span class="keyword">else</span>
699
+ iframe = <span class="string">"https://apps.groupdocs.com<span class="subst">#{url}</span>"</span>
700
+ <span class="keyword">end</span></pre></div></div>
701
+
702
+ </li>
703
+
704
+
705
+ <li id="section-38">
706
+ <div class="annotation">
707
+
708
+ <div class="pilwrap ">
709
+ <a class="pilcrow" href="#section-38">&#182;</a>
710
+ </div>
711
+ <p>Make iframe</p>
712
+
713
+ </div>
714
+
715
+ <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>
653
716
 
654
717
  <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e
655
718
  err = e.message
@@ -118,9 +118,7 @@
118
118
 
119
119
  </div>
120
120
 
121
- <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?
122
-
123
- <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>
121
+ <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?</pre></div></div>
124
122
 
125
123
  </li>
126
124
 
@@ -131,6 +129,27 @@
131
129
  <div class="pilwrap ">
132
130
  <a class="pilcrow" href="#section-7">&#182;</a>
133
131
  </div>
132
+ <p>Prepare base path</p>
133
+
134
+ </div>
135
+
136
+ <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.base_path.empty?
137
+ base_path = <span class="string">'https://api.groupdocs.com'</span>
138
+ <span class="keyword">elsif</span> settings.base_path.match(<span class="string">'/v2.0'</span>)
139
+ base_path = settings.base_path.split(<span class="string">'/v2.0'</span>)[<span class="number">0</span>]
140
+ <span class="keyword">else</span>
141
+ base_path = settings.base_path
142
+ <span class="keyword">end</span></pre></div></div>
143
+
144
+ </li>
145
+
146
+
147
+ <li id="section-8">
148
+ <div class="annotation">
149
+
150
+ <div class="pilwrap ">
151
+ <a class="pilcrow" href="#section-8">&#182;</a>
152
+ </div>
134
153
  <p>Configure your access to API server</p>
135
154
 
136
155
  </div>
@@ -142,27 +161,27 @@
142
161
  </li>
143
162
 
144
163
 
145
- <li id="section-8">
164
+ <li id="section-9">
146
165
  <div class="annotation">
147
166
 
148
167
  <div class="pilwrap ">
149
- <a class="pilcrow" href="#section-8">&#182;</a>
168
+ <a class="pilcrow" href="#section-9">&#182;</a>
150
169
  </div>
151
170
  <p>Optionally specify API server and version</p>
152
171
 
153
172
  </div>
154
173
 
155
- <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
174
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
156
175
  <span class="keyword">end</span></pre></div></div>
157
176
 
158
177
  </li>
159
178
 
160
179
 
161
- <li id="section-9">
180
+ <li id="section-10">
162
181
  <div class="annotation">
163
182
 
164
183
  <div class="pilwrap ">
165
- <a class="pilcrow" href="#section-9">&#182;</a>
184
+ <a class="pilcrow" href="#section-10">&#182;</a>
166
185
  </div>
167
186
  <p>Get envelope from GroupDocs Storage</p>
168
187
 
@@ -173,11 +192,11 @@
173
192
  </li>
174
193
 
175
194
 
176
- <li id="section-10">
195
+ <li id="section-11">
177
196
  <div class="annotation">
178
197
 
179
198
  <div class="pilwrap ">
180
- <a class="pilcrow" href="#section-10">&#182;</a>
199
+ <a class="pilcrow" href="#section-11">&#182;</a>
181
200
  </div>
182
201
  <p>Download signed files</p>
183
202
 
@@ -188,11 +207,11 @@
188
207
  </li>
189
208
 
190
209
 
191
- <li id="section-11">
210
+ <li id="section-12">
192
211
  <div class="annotation">
193
212
 
194
213
  <div class="pilwrap ">
195
- <a class="pilcrow" href="#section-11">&#182;</a>
214
+ <a class="pilcrow" href="#section-12">&#182;</a>
196
215
  </div>
197
216
  <p>Get file name</p>
198
217
 
@@ -200,6 +219,7 @@
200
219
 
201
220
  <div class="content"><div class='highlight'><pre> file = path.split(<span class="string">'/'</span>).last
202
221
 
222
+ message = <span class="string">"&lt;span style=\"color:green\"&gt;Files from the envelope were downloaded to server's local folder. You can check them &lt;a href=\"/downloads/<span class="subst">#{file}</span>\"&gt;here&lt;/a&gt;&lt;/span&gt;"</span>
203
223
  <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e
204
224
  err = e.message
205
225
  <span class="keyword">end</span></pre></div></div>
@@ -207,17 +227,17 @@
207
227
  </li>
208
228
 
209
229
 
210
- <li id="section-12">
230
+ <li id="section-13">
211
231
  <div class="annotation">
212
232
 
213
233
  <div class="pilwrap ">
214
- <a class="pilcrow" href="#section-12">&#182;</a>
234
+ <a class="pilcrow" href="#section-13">&#182;</a>
215
235
  </div>
216
- <p>set variables for template</p>
236
+ <p>Set variables for template</p>
217
237
 
218
238
  </div>
219
239
 
220
- <div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample36</span>, <span class="symbol">:locals</span> =&gt; {<span class="symbol">:userId</span> =&gt; settings.client_id, <span class="symbol">:privateKey</span> =&gt; settings.private_key, <span class="symbol">:fileName</span> =&gt; file, <span class="symbol">:err</span> =&gt; err}
240
+ <div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample36</span>, <span class="symbol">:locals</span> =&gt; {<span class="symbol">:userId</span> =&gt; settings.client_id, <span class="symbol">:privateKey</span> =&gt; settings.private_key, <span class="symbol">:envelopeGuid</span> =&gt; settings.envelope, <span class="symbol">:message</span> =&gt; message, <span class="symbol">:err</span> =&gt; err}
221
241
  <span class="keyword">end</span></pre></div></div>
222
242
 
223
243
  </li>
@@ -61,199 +61,46 @@
61
61
 
62
62
  </div>
63
63
 
64
- <div class="content"><div class='highlight'><pre>post <span class="string">'/sample37/signature_callback'</span> <span class="keyword">do</span></pre></div></div>
65
-
66
- </li>
67
-
68
-
69
- <li id="section-4">
70
- <div class="annotation">
71
-
72
- <div class="pilwrap ">
73
- <a class="pilcrow" href="#section-4">&#182;</a>
74
- </div>
75
- <p>Get data json from callback</p>
76
-
77
- </div>
78
-
79
- <div class="content"><div class='highlight'><pre> data = <span class="constant">JSON</span>.parse(request.body.read)
80
- <span class="keyword">begin</span>
81
-
82
- raise <span class="string">'Empty params!'</span> <span class="keyword">if</span> data.empty?</pre></div></div>
83
-
84
- </li>
85
-
86
-
87
- <li id="section-5">
88
- <div class="annotation">
89
-
90
- <div class="pilwrap ">
91
- <a class="pilcrow" href="#section-5">&#182;</a>
92
- </div>
93
- <p>Set variables from data json</p>
94
-
95
- </div>
96
-
97
- <div class="content"><div class='highlight'><pre> source_id = data[<span class="string">'SourceId'</span>]
98
- event_type = data[<span class="string">'EventType'</span>]</pre></div></div>
99
-
100
- </li>
101
-
102
-
103
- <li id="section-6">
104
- <div class="annotation">
105
-
106
- <div class="pilwrap ">
107
- <a class="pilcrow" href="#section-6">&#182;</a>
108
- </div>
109
- <p>Set variables</p>
110
-
111
- </div>
112
-
113
- <div class="content"><div class='highlight'><pre> client_id = <span class="keyword">nil</span>
114
- private_key = <span class="keyword">nil</span>
115
-
116
- <span class="keyword">return</span> <span class="keyword">if</span> event_type != <span class="string">'JobCompleted'</span></pre></div></div>
117
-
118
- </li>
119
-
120
-
121
- <li id="section-7">
122
- <div class="annotation">
123
-
124
- <div class="pilwrap ">
125
- <a class="pilcrow" href="#section-7">&#182;</a>
126
- </div>
127
- <p>Set download path</p>
128
-
129
- </div>
130
-
131
- <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>
132
-
133
- </li>
134
-
135
-
136
- <li id="section-8">
137
- <div class="annotation">
138
-
139
- <div class="pilwrap ">
140
- <a class="pilcrow" href="#section-8">&#182;</a>
141
- </div>
142
- <p>Get private key and client_id from file user_info.txt</p>
143
-
144
- </div>
145
-
146
- <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> <span class="constant">File</span>.exist?(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/user_info.txt"</span>)
147
- contents = <span class="constant">File</span>.read(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/user_info.txt"</span>)
148
- contents = contents.split(<span class="string">' '</span>)
149
- client_id = contents[<span class="number">0</span>]
150
- private_key = contents[<span class="number">1</span>]
151
- <span class="keyword">end</span></pre></div></div>
152
-
153
- </li>
154
-
155
-
156
- <li id="section-9">
157
- <div class="annotation">
158
-
159
- <div class="pilwrap ">
160
- <a class="pilcrow" href="#section-9">&#182;</a>
161
- </div>
162
- <p>Get Envelope instance</p>
163
-
164
- </div>
165
-
166
- <div class="content"><div class='highlight'><pre> envelope = <span class="constant">GroupDocs::Signature::Envelope</span>.get!(source_id, {<span class="symbol">:client_id</span> =&gt; client_id, <span class="symbol">:private_key</span> =&gt; private_key})</pre></div></div>
167
-
168
- </li>
169
-
170
-
171
- <li id="section-10">
172
- <div class="annotation">
173
-
174
- <div class="pilwrap ">
175
- <a class="pilcrow" href="#section-10">&#182;</a>
176
- </div>
177
- <p>Get document by envelope</p>
178
-
179
- </div>
180
-
181
- <div class="content"><div class='highlight'><pre> envelope.signed_documents!(downloads_path, {<span class="symbol">:client_id</span> =&gt; client_id, <span class="symbol">:private_key</span> =&gt; private_key})
182
-
183
-
184
- <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e
185
- err = e.message
186
- <span class="keyword">end</span>
187
- <span class="keyword">end</span></pre></div></div>
188
-
189
- </li>
190
-
191
-
192
- <li id="section-11">
193
- <div class="annotation">
194
-
195
- <div class="pilwrap ">
196
- <a class="pilcrow" href="#section-11">&#182;</a>
197
- </div>
198
- <p>Route the handler url &quot;/sample37/check&quot;</p>
199
-
200
- </div>
201
-
202
- <div class="content"><div class='highlight'><pre>
203
- get <span class="string">'/sample37/check'</span> <span class="keyword">do</span></pre></div></div>
204
-
205
- </li>
206
-
207
-
208
- <li id="section-12">
209
- <div class="annotation">
210
-
211
- <div class="pilwrap ">
212
- <a class="pilcrow" href="#section-12">&#182;</a>
213
- </div>
214
- <p>Check is there download directory</p>
215
-
216
- </div>
217
-
218
- <div class="content"><div class='highlight'><pre> <span class="keyword">unless</span> <span class="constant">File</span>.directory?(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/downloads"</span>)
64
+ <div class="content"><div class='highlight'><pre>post <span class="string">'/sample37/signature_callback'</span> <span class="keyword">do</span>
65
+ <span class="keyword">unless</span> <span class="constant">File</span>.directory?(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/downloads"</span>)
219
66
  <span class="keyword">return</span> <span class="string">'Directory was not found.'</span>
220
67
  <span class="keyword">end</span></pre></div></div>
221
68
 
222
69
  </li>
223
70
 
224
71
 
225
- <li id="section-13">
72
+ <li id="section-4">
226
73
  <div class="annotation">
227
74
 
228
75
  <div class="pilwrap ">
229
- <a class="pilcrow" href="#section-13">&#182;</a>
76
+ <a class="pilcrow" href="#section-4">&#182;</a>
230
77
  </div>
231
78
  <p>Get file name from download directory</p>
232
79
 
233
80
  </div>
234
81
 
235
82
  <div class="content"><div class='highlight'><pre> name = <span class="keyword">nil</span>
236
-
83
+
237
84
  i = <span class="number">0</span></pre></div></div>
238
85
 
239
86
  </li>
240
87
 
241
88
 
242
- <li id="section-14">
89
+ <li id="section-5">
243
90
  <div class="annotation">
244
91
 
245
92
  <div class="pilwrap ">
246
- <a class="pilcrow" href="#section-14">&#182;</a>
93
+ <a class="pilcrow" href="#section-5">&#182;</a>
247
94
  </div>
248
95
  <p>Checking, if file exist</p>
249
96
 
250
97
  </div>
251
98
 
252
99
  <div class="content"><div class='highlight'><pre> <span class="keyword">while</span> i&lt;<span class="number">10</span> <span class="keyword">do</span>
253
- sleep(<span class="number">5</span>)
254
- <span class="constant">Dir</span>.entries(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/downloads"</span>).each <span class="keyword">do</span> |file|
255
- name = file <span class="keyword">if</span> file != <span class="string">'.'</span> &amp;&amp; file != <span class="string">'..'</span>
256
- <span class="keyword">end</span>
100
+ sleep(<span class="number">5</span>)
101
+ <span class="constant">Dir</span>.entries(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/downloads"</span>).each <span class="keyword">do</span> |file|
102
+ name = file <span class="keyword">if</span> file != <span class="string">'.'</span> &amp;&amp; file != <span class="string">'..'</span>
103
+ <span class="keyword">end</span>
257
104
  <span class="keyword">break</span> <span class="keyword">if</span> name
258
105
  i += <span class="number">1</span>
259
106
  <span class="keyword">end</span>
@@ -264,11 +111,11 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
264
111
  </li>
265
112
 
266
113
 
267
- <li id="section-15">
114
+ <li id="section-6">
268
115
  <div class="annotation">
269
116
 
270
117
  <div class="pilwrap ">
271
- <a class="pilcrow" href="#section-15">&#182;</a>
118
+ <a class="pilcrow" href="#section-6">&#182;</a>
272
119
  </div>
273
120
  <p>Route the handler url &quot;/sample37/downloads&quot;</p>
274
121
 
@@ -279,11 +126,11 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
279
126
  </li>
280
127
 
281
128
 
282
- <li id="section-16">
129
+ <li id="section-7">
283
130
  <div class="annotation">
284
131
 
285
132
  <div class="pilwrap ">
286
- <a class="pilcrow" href="#section-16">&#182;</a>
133
+ <a class="pilcrow" href="#section-7">&#182;</a>
287
134
  </div>
288
135
  <p>Send file with header to download it</p>
289
136
 
@@ -295,11 +142,11 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
295
142
  </li>
296
143
 
297
144
 
298
- <li id="section-17">
145
+ <li id="section-8">
299
146
  <div class="annotation">
300
147
 
301
148
  <div class="pilwrap ">
302
- <a class="pilcrow" href="#section-17">&#182;</a>
149
+ <a class="pilcrow" href="#section-8">&#182;</a>
303
150
  </div>
304
151
  <p>Route the handler url &quot;/sample37&quot;. The function block creates new envelope</p>
305
152
 
@@ -310,11 +157,11 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
310
157
  </li>
311
158
 
312
159
 
313
- <li id="section-18">
160
+ <li id="section-9">
314
161
  <div class="annotation">
315
162
 
316
163
  <div class="pilwrap ">
317
- <a class="pilcrow" href="#section-18">&#182;</a>
164
+ <a class="pilcrow" href="#section-9">&#182;</a>
318
165
  </div>
319
166
  <p>Set variables from form</p>
320
167
 
@@ -334,11 +181,11 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
334
181
  </li>
335
182
 
336
183
 
337
- <li id="section-19">
184
+ <li id="section-10">
338
185
  <div class="annotation">
339
186
 
340
187
  <div class="pilwrap ">
341
- <a class="pilcrow" href="#section-19">&#182;</a>
188
+ <a class="pilcrow" href="#section-10">&#182;</a>
342
189
  </div>
343
190
  <p>Set download path</p>
344
191
 
@@ -349,11 +196,11 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
349
196
  </li>
350
197
 
351
198
 
352
- <li id="section-20">
199
+ <li id="section-11">
353
200
  <div class="annotation">
354
201
 
355
202
  <div class="pilwrap ">
356
- <a class="pilcrow" href="#section-20">&#182;</a>
203
+ <a class="pilcrow" href="#section-11">&#182;</a>
357
204
  </div>
358
205
  <p>Remove all files from download directory or create folder if it not there</p>
359
206
 
@@ -370,28 +217,47 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
370
217
  </li>
371
218
 
372
219
 
373
- <li id="section-21">
220
+ <li id="section-12">
374
221
  <div class="annotation">
375
222
 
376
223
  <div class="pilwrap ">
377
- <a class="pilcrow" href="#section-21">&#182;</a>
224
+ <a class="pilcrow" href="#section-12">&#182;</a>
378
225
  </div>
379
226
  <p>Check required variables</p>
380
227
 
381
228
  </div>
382
229
 
383
- <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?
384
-
385
- <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>
230
+ <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>
386
231
 
387
232
  </li>
388
233
 
389
234
 
390
- <li id="section-22">
235
+ <li id="section-13">
391
236
  <div class="annotation">
392
237
 
393
238
  <div class="pilwrap ">
394
- <a class="pilcrow" href="#section-22">&#182;</a>
239
+ <a class="pilcrow" href="#section-13">&#182;</a>
240
+ </div>
241
+ <p>Prepare base path</p>
242
+
243
+ </div>
244
+
245
+ <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.base_path.empty?
246
+ base_path = <span class="string">'https://api.groupdocs.com'</span>
247
+ <span class="keyword">elsif</span> settings.base_path.match(<span class="string">'/v2.0'</span>)
248
+ base_path = settings.base_path.split(<span class="string">'/v2.0'</span>)[<span class="number">0</span>]
249
+ <span class="keyword">else</span>
250
+ base_path = settings.base_path
251
+ <span class="keyword">end</span></pre></div></div>
252
+
253
+ </li>
254
+
255
+
256
+ <li id="section-14">
257
+ <div class="annotation">
258
+
259
+ <div class="pilwrap ">
260
+ <a class="pilcrow" href="#section-14">&#182;</a>
395
261
  </div>
396
262
  <p>Configure your access to API server</p>
397
263
 
@@ -404,27 +270,27 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
404
270
  </li>
405
271
 
406
272
 
407
- <li id="section-23">
273
+ <li id="section-15">
408
274
  <div class="annotation">
409
275
 
410
276
  <div class="pilwrap ">
411
- <a class="pilcrow" href="#section-23">&#182;</a>
277
+ <a class="pilcrow" href="#section-15">&#182;</a>
412
278
  </div>
413
279
  <p>Optionally specify API server and version</p>
414
280
 
415
281
  </div>
416
282
 
417
- <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
283
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
418
284
  <span class="keyword">end</span></pre></div></div>
419
285
 
420
286
  </li>
421
287
 
422
288
 
423
- <li id="section-24">
289
+ <li id="section-16">
424
290
  <div class="annotation">
425
291
 
426
292
  <div class="pilwrap ">
427
- <a class="pilcrow" href="#section-24">&#182;</a>
293
+ <a class="pilcrow" href="#section-16">&#182;</a>
428
294
  </div>
429
295
  <p>Write client and private key to the file for callback job</p>
430
296
 
@@ -436,13 +302,13 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
436
302
  </li>
437
303
 
438
304
 
439
- <li id="section-25">
305
+ <li id="section-17">
440
306
  <div class="annotation">
441
307
 
442
308
  <div class="pilwrap ">
443
- <a class="pilcrow" href="#section-25">&#182;</a>
309
+ <a class="pilcrow" href="#section-17">&#182;</a>
444
310
  </div>
445
- <p>white space is required</p>
311
+ <p>White space is required</p>
446
312
 
447
313
  </div>
448
314
 
@@ -456,13 +322,13 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
456
322
  </li>
457
323
 
458
324
 
459
- <li id="section-26">
325
+ <li id="section-18">
460
326
  <div class="annotation">
461
327
 
462
328
  <div class="pilwrap ">
463
- <a class="pilcrow" href="#section-26">&#182;</a>
329
+ <a class="pilcrow" href="#section-18">&#182;</a>
464
330
  </div>
465
- <p>get document by file GUID</p>
331
+ <p>Get document by file GUID</p>
466
332
 
467
333
  </div>
468
334
 
@@ -472,11 +338,11 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
472
338
  </li>
473
339
 
474
340
 
475
- <li id="section-27">
341
+ <li id="section-19">
476
342
  <div class="annotation">
477
343
 
478
344
  <div class="pilwrap ">
479
- <a class="pilcrow" href="#section-27">&#182;</a>
345
+ <a class="pilcrow" href="#section-19">&#182;</a>
480
346
  </div>
481
347
  <p>Create instance of File</p>
482
348
 
@@ -489,13 +355,13 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
489
355
  </li>
490
356
 
491
357
 
492
- <li id="section-28">
358
+ <li id="section-20">
493
359
  <div class="annotation">
494
360
 
495
361
  <div class="pilwrap ">
496
- <a class="pilcrow" href="#section-28">&#182;</a>
362
+ <a class="pilcrow" href="#section-20">&#182;</a>
497
363
  </div>
498
- <p>construct path</p>
364
+ <p>Construct path</p>
499
365
 
500
366
  </div>
501
367
 
@@ -504,13 +370,13 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
504
370
  </li>
505
371
 
506
372
 
507
- <li id="section-29">
373
+ <li id="section-21">
508
374
  <div class="annotation">
509
375
 
510
376
  <div class="pilwrap ">
511
- <a class="pilcrow" href="#section-29">&#182;</a>
377
+ <a class="pilcrow" href="#section-21">&#182;</a>
512
378
  </div>
513
- <p>open file</p>
379
+ <p>Open file</p>
514
380
 
515
381
  </div>
516
382
 
@@ -519,27 +385,28 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
519
385
  </li>
520
386
 
521
387
 
522
- <li id="section-30">
388
+ <li id="section-22">
523
389
  <div class="annotation">
524
390
 
525
391
  <div class="pilwrap ">
526
- <a class="pilcrow" href="#section-30">&#182;</a>
392
+ <a class="pilcrow" href="#section-22">&#182;</a>
527
393
  </div>
528
- <p>make a request to API using client_id and private_key</p>
394
+ <p>Make a request to API using client_id and private_key</p>
529
395
 
530
396
  </div>
531
397
 
532
- <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload!(file_path, {}).to_document
398
+ <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload!(file_path).to_document
399
+
533
400
  <span class="keyword">when</span> <span class="string">'url'</span></pre></div></div>
534
401
 
535
402
  </li>
536
403
 
537
404
 
538
- <li id="section-31">
405
+ <li id="section-23">
539
406
  <div class="annotation">
540
407
 
541
408
  <div class="pilwrap ">
542
- <a class="pilcrow" href="#section-31">&#182;</a>
409
+ <a class="pilcrow" href="#section-23">&#182;</a>
543
410
  </div>
544
411
  <p>Upload file from defined url</p>
545
412
 
@@ -555,13 +422,13 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
555
422
  </li>
556
423
 
557
424
 
558
- <li id="section-32">
425
+ <li id="section-24">
559
426
  <div class="annotation">
560
427
 
561
428
  <div class="pilwrap ">
562
- <a class="pilcrow" href="#section-32">&#182;</a>
429
+ <a class="pilcrow" href="#section-24">&#182;</a>
563
430
  </div>
564
- <p>create envelope using user id and entered by user name</p>
431
+ <p>Create envelope using user id and entered by user name</p>
565
432
 
566
433
  </div>
567
434
 
@@ -573,11 +440,11 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
573
440
  </li>
574
441
 
575
442
 
576
- <li id="section-33">
443
+ <li id="section-25">
577
444
  <div class="annotation">
578
445
 
579
446
  <div class="pilwrap ">
580
- <a class="pilcrow" href="#section-33">&#182;</a>
447
+ <a class="pilcrow" href="#section-25">&#182;</a>
581
448
  </div>
582
449
  <p>Add uploaded document to envelope</p>
583
450
 
@@ -588,11 +455,11 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
588
455
  </li>
589
456
 
590
457
 
591
- <li id="section-34">
458
+ <li id="section-26">
592
459
  <div class="annotation">
593
460
 
594
461
  <div class="pilwrap ">
595
- <a class="pilcrow" href="#section-34">&#182;</a>
462
+ <a class="pilcrow" href="#section-26">&#182;</a>
596
463
  </div>
597
464
  <p>Get role list for current user</p>
598
465
 
@@ -603,11 +470,11 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
603
470
  </li>
604
471
 
605
472
 
606
- <li id="section-35">
473
+ <li id="section-27">
607
474
  <div class="annotation">
608
475
 
609
476
  <div class="pilwrap ">
610
- <a class="pilcrow" href="#section-35">&#182;</a>
477
+ <a class="pilcrow" href="#section-27">&#182;</a>
611
478
  </div>
612
479
  <p>Create new recipient</p>
613
480
 
@@ -622,41 +489,26 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
622
489
  </li>
623
490
 
624
491
 
625
- <li id="section-36">
492
+ <li id="section-28">
626
493
  <div class="annotation">
627
494
 
628
495
  <div class="pilwrap ">
629
- <a class="pilcrow" href="#section-36">&#182;</a>
496
+ <a class="pilcrow" href="#section-28">&#182;</a>
630
497
  </div>
631
498
  <p>Add recipient to envelope</p>
632
499
 
633
500
  </div>
634
501
 
635
- <div class="content"><div class='highlight'><pre> add = envelope.add_recipient!(recipient)</pre></div></div>
636
-
637
- </li>
638
-
639
-
640
- <li id="section-37">
641
- <div class="annotation">
642
-
643
- <div class="pilwrap ">
644
- <a class="pilcrow" href="#section-37">&#182;</a>
645
- </div>
646
- <p>Get recipient id</p>
647
-
648
- </div>
649
-
650
- <div class="content"><div class='highlight'><pre> recipient.id = add.id</pre></div></div>
502
+ <div class="content"><div class='highlight'><pre> recipient = envelope.add_recipient!(recipient)</pre></div></div>
651
503
 
652
504
  </li>
653
505
 
654
506
 
655
- <li id="section-38">
507
+ <li id="section-29">
656
508
  <div class="annotation">
657
509
 
658
510
  <div class="pilwrap ">
659
- <a class="pilcrow" href="#section-38">&#182;</a>
511
+ <a class="pilcrow" href="#section-29">&#182;</a>
660
512
  </div>
661
513
  <p>Get document id</p>
662
514
 
@@ -667,11 +519,11 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
667
519
  </li>
668
520
 
669
521
 
670
- <li id="section-39">
522
+ <li id="section-30">
671
523
  <div class="annotation">
672
524
 
673
525
  <div class="pilwrap ">
674
- <a class="pilcrow" href="#section-39">&#182;</a>
526
+ <a class="pilcrow" href="#section-30">&#182;</a>
675
527
  </div>
676
528
  <p>Get field and add the location to field</p>
677
529
 
@@ -684,11 +536,11 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
684
536
  </li>
685
537
 
686
538
 
687
- <li id="section-40">
539
+ <li id="section-31">
688
540
  <div class="annotation">
689
541
 
690
542
  <div class="pilwrap ">
691
- <a class="pilcrow" href="#section-40">&#182;</a>
543
+ <a class="pilcrow" href="#section-31">&#182;</a>
692
544
  </div>
693
545
  <p>Add field to envelope</p>
694
546
 
@@ -699,11 +551,11 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
699
551
  </li>
700
552
 
701
553
 
702
- <li id="section-41">
554
+ <li id="section-32">
703
555
  <div class="annotation">
704
556
 
705
557
  <div class="pilwrap ">
706
- <a class="pilcrow" href="#section-41">&#182;</a>
558
+ <a class="pilcrow" href="#section-32">&#182;</a>
707
559
  </div>
708
560
  <p>Send envelop</p>
709
561
 
@@ -714,11 +566,11 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
714
566
  </li>
715
567
 
716
568
 
717
- <li id="section-42">
569
+ <li id="section-33">
718
570
  <div class="annotation">
719
571
 
720
572
  <div class="pilwrap ">
721
- <a class="pilcrow" href="#section-42">&#182;</a>
573
+ <a class="pilcrow" href="#section-33">&#182;</a>
722
574
  </div>
723
575
  <p>Write client and private key to the file for callback job</p>
724
576
 
@@ -730,13 +582,13 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
730
582
  </li>
731
583
 
732
584
 
733
- <li id="section-43">
585
+ <li id="section-34">
734
586
  <div class="annotation">
735
587
 
736
588
  <div class="pilwrap ">
737
- <a class="pilcrow" href="#section-43">&#182;</a>
589
+ <a class="pilcrow" href="#section-34">&#182;</a>
738
590
  </div>
739
- <p>white space is required</p>
591
+ <p>White space is required</p>
740
592
 
741
593
  </div>
742
594
 
@@ -749,43 +601,70 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
749
601
  </li>
750
602
 
751
603
 
752
- <li id="section-44">
604
+ <li id="section-35">
753
605
  <div class="annotation">
754
606
 
755
607
  <div class="pilwrap ">
756
- <a class="pilcrow" href="#section-44">&#182;</a>
608
+ <a class="pilcrow" href="#section-35">&#182;</a>
757
609
  </div>
758
- <p>Get url from request</p>
610
+ <p>Prepare to sign url</p>
759
611
 
760
612
  </div>
761
613
 
762
- <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.base_path
763
-
614
+ <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>
615
+
616
+ </li>
617
+
618
+
619
+ <li id="section-36">
620
+ <div class="annotation">
621
+
622
+ <div class="pilwrap ">
623
+ <a class="pilcrow" href="#section-36">&#182;</a>
624
+ </div>
625
+ <p>Construct result string</p>
626
+
627
+ </div>
628
+
629
+ <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>
630
+
631
+ </li>
632
+
633
+
634
+ <li id="section-37">
635
+ <div class="annotation">
636
+
637
+ <div class="pilwrap ">
638
+ <a class="pilcrow" href="#section-37">&#182;</a>
639
+ </div>
640
+ <p>Generate iframe URL</p>
641
+
642
+ </div>
643
+
644
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> base_path
764
645
  <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
765
- 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>
646
+ iframe = <span class="string">"https://stage-api-groupdocs.dynabic.com<span class="subst">#{url}</span>"</span>
766
647
  <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
767
- 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>
648
+ iframe = <span class="string">"https://dev-apps.groupdocs.com<span class="subst">#{url}</span>"</span>
768
649
  <span class="keyword">else</span>
769
- url = <span class="string">"https://apps.groupdocs.com/signature/signembed/<span class="subst">#{envelope.id}</span>/<span class="subst">#{recipient.id}</span>"</span>
770
- <span class="keyword">end</span>
771
-
772
-
773
- iframe = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> =&gt; url).prepare_and_sign_url</pre></div></div>
650
+ iframe = <span class="string">"https://apps.groupdocs.com<span class="subst">#{url}</span>"</span>
651
+ <span class="keyword">end</span></pre></div></div>
774
652
 
775
653
  </li>
776
654
 
777
655
 
778
- <li id="section-45">
656
+ <li id="section-38">
779
657
  <div class="annotation">
780
658
 
781
659
  <div class="pilwrap ">
782
- <a class="pilcrow" href="#section-45">&#182;</a>
660
+ <a class="pilcrow" href="#section-38">&#182;</a>
783
661
  </div>
784
662
  <p>Make iframe</p>
785
663
 
786
664
  </div>
787
665
 
788
- <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>
666
+ <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>
667
+
789
668
  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>
790
669
  <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e
791
670
  err = e.message
@@ -794,11 +673,11 @@ get <span class="string">'/sample37/check'</span> <span class="keyword">do</span
794
673
  </li>
795
674
 
796
675
 
797
- <li id="section-46">
676
+ <li id="section-39">
798
677
  <div class="annotation">
799
678
 
800
679
  <div class="pilwrap ">
801
- <a class="pilcrow" href="#section-46">&#182;</a>
680
+ <a class="pilcrow" href="#section-39">&#182;</a>
802
681
  </div>
803
682
  <p>Set variables for template</p>
804
683