groupdocs 1.5.8 → 1.5.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +9 -0
- data/examples/api-samples/public/docs/sample01.html +34 -15
- data/examples/api-samples/public/docs/sample02.html +36 -15
- data/examples/api-samples/public/docs/sample03.html +55 -34
- data/examples/api-samples/public/docs/sample04.html +33 -14
- data/examples/api-samples/public/docs/sample05.html +51 -33
- data/examples/api-samples/public/docs/sample06.html +86 -40
- data/examples/api-samples/public/docs/sample07.html +32 -13
- data/examples/api-samples/public/docs/sample08.html +39 -20
- data/examples/api-samples/public/docs/sample09.html +93 -39
- data/examples/api-samples/public/docs/sample10.html +39 -21
- data/examples/api-samples/public/docs/sample11.html +133 -88
- data/examples/api-samples/public/docs/sample12.html +33 -14
- data/examples/api-samples/public/docs/sample13.html +14 -7
- data/examples/api-samples/public/docs/sample14.html +37 -18
- data/examples/api-samples/public/docs/sample15.html +29 -10
- data/examples/api-samples/public/docs/sample16.html +58 -25
- data/examples/api-samples/public/docs/sample17.html +71 -38
- data/examples/api-samples/public/docs/sample18.html +98 -71
- data/examples/api-samples/public/docs/sample19.html +74 -42
- data/examples/api-samples/public/docs/sample20.html +39 -21
- data/examples/api-samples/public/docs/sample21.html +113 -69
- data/examples/api-samples/public/docs/sample22.html +89 -43
- data/examples/api-samples/public/docs/sample23.html +50 -32
- data/examples/api-samples/public/docs/sample24.html +64 -31
- data/examples/api-samples/public/docs/sample25.html +107 -60
- data/examples/api-samples/public/docs/sample26.html +29 -10
- data/examples/api-samples/public/docs/sample27.html +107 -61
- data/examples/api-samples/public/docs/sample28.html +158 -9
- data/examples/api-samples/public/docs/sample29.html +13 -8
- data/examples/api-samples/public/docs/sample30.html +34 -15
- data/examples/api-samples/public/docs/sample31.html +107 -76
- data/examples/api-samples/public/docs/sample32.html +104 -40
- data/examples/api-samples/public/docs/sample33.html +85 -36
- data/examples/api-samples/public/docs/sample34.html +30 -11
- data/examples/api-samples/public/docs/sample35.html +90 -27
- data/examples/api-samples/public/docs/sample36.html +36 -16
- data/examples/api-samples/public/docs/sample37.html +144 -265
- data/examples/api-samples/public/docs/sample38.html +113 -64
- data/examples/api-samples/public/docs/sample39.html +118 -45
- data/examples/api-samples/public/docs/sample40.html +81 -46
- data/examples/api-samples/public/docs/sample41.html +562 -90
- data/examples/api-samples/public/docs/sample42.html +94 -39
- data/examples/api-samples/public/docs/sample43.html +669 -0
- data/examples/api-samples/samples/sample01.rb +17 -10
- data/examples/api-samples/samples/sample02.rb +21 -12
- data/examples/api-samples/samples/sample03.rb +35 -29
- data/examples/api-samples/samples/sample04.rb +19 -12
- data/examples/api-samples/samples/sample05.rb +24 -17
- data/examples/api-samples/samples/sample06.rb +38 -32
- data/examples/api-samples/samples/sample07.rb +19 -12
- data/examples/api-samples/samples/sample08.rb +22 -15
- data/examples/api-samples/samples/sample09.rb +31 -29
- data/examples/api-samples/samples/sample10.rb +22 -15
- data/examples/api-samples/samples/sample11.rb +78 -81
- data/examples/api-samples/samples/sample12.rb +19 -21
- data/examples/api-samples/samples/sample13.rb +19 -21
- data/examples/api-samples/samples/sample14.rb +18 -12
- data/examples/api-samples/samples/sample15.rb +17 -10
- data/examples/api-samples/samples/sample16.rb +25 -17
- data/examples/api-samples/samples/sample17.rb +31 -23
- data/examples/api-samples/samples/sample18.rb +60 -55
- data/examples/api-samples/samples/sample19.rb +48 -42
- data/examples/api-samples/samples/sample20.rb +20 -13
- data/examples/api-samples/samples/sample21.rb +62 -54
- data/examples/api-samples/samples/sample22.rb +37 -31
- data/examples/api-samples/samples/sample23.rb +24 -17
- data/examples/api-samples/samples/sample24.rb +29 -22
- data/examples/api-samples/samples/sample25.rb +47 -40
- data/examples/api-samples/samples/sample26.rb +16 -9
- data/examples/api-samples/samples/sample27.rb +46 -39
- data/examples/api-samples/samples/sample28.rb +42 -11
- data/examples/api-samples/samples/sample29.rb +13 -8
- data/examples/api-samples/samples/sample30.rb +19 -12
- data/examples/api-samples/samples/sample31.rb +63 -58
- data/examples/api-samples/samples/sample32.rb +45 -42
- data/examples/api-samples/samples/sample33.rb +36 -25
- data/examples/api-samples/samples/sample34.rb +16 -9
- data/examples/api-samples/samples/sample35.rb +66 -53
- data/examples/api-samples/samples/sample36.rb +19 -15
- data/examples/api-samples/samples/sample37.rb +61 -99
- data/examples/api-samples/samples/sample38.rb +51 -43
- data/examples/api-samples/samples/sample39.rb +78 -62
- data/examples/api-samples/samples/sample40.rb +48 -38
- data/examples/api-samples/samples/sample41.rb +189 -67
- data/examples/api-samples/samples/sample42.rb +37 -29
- data/examples/api-samples/samples/sample43.rb +127 -0
- data/examples/api-samples/views/_others_samples.haml +4 -2
- data/examples/api-samples/views/index.haml +4 -2
- data/examples/api-samples/views/sample11.haml +1 -1
- data/examples/api-samples/views/sample28.haml +8 -0
- data/examples/api-samples/views/sample31.haml +1 -6
- data/examples/api-samples/views/sample39.haml +7 -2
- data/examples/api-samples/views/sample41.haml +78 -33
- data/examples/api-samples/views/sample42.haml +0 -1
- data/examples/api-samples/views/sample43.haml +91 -0
- data/lib/groupdocs/api/helpers/access_rights_helper.rb +6 -5
- data/lib/groupdocs/api/helpers/url_helper.rb +2 -1
- data/lib/groupdocs/document.rb +3 -3
- data/lib/groupdocs/version.rb +1 -1
- 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">¶</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">¶</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-
|
129
|
+
<li id="section-7">
|
111
130
|
<div class="annotation">
|
112
131
|
|
113
132
|
<div class="pilwrap ">
|
114
|
-
<a class="pilcrow" href="#section-
|
133
|
+
<a class="pilcrow" href="#section-7">¶</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 =
|
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-
|
145
|
+
<li id="section-8">
|
127
146
|
<div class="annotation">
|
128
147
|
|
129
148
|
<div class="pilwrap ">
|
130
|
-
<a class="pilcrow" href="#section-
|
149
|
+
<a class="pilcrow" href="#section-8">¶</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-
|
167
|
+
<li id="section-9">
|
149
168
|
<div class="annotation">
|
150
169
|
|
151
170
|
<div class="pilwrap ">
|
152
|
-
<a class="pilcrow" href="#section-
|
171
|
+
<a class="pilcrow" href="#section-9">¶</a>
|
153
172
|
</div>
|
154
|
-
<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">¶</a>
|
100
98
|
</div>
|
101
|
-
<p>
|
99
|
+
<p>Prepare base path</p>
|
102
100
|
|
103
101
|
</div>
|
104
102
|
|
105
|
-
<div class="content"><div class='highlight'><pre>
|
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">¶</a>
|
132
136
|
</div>
|
133
|
-
<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 =
|
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">¶</a>
|
393
395
|
</div>
|
394
|
-
<p>
|
396
|
+
<p>Prepare base path</p>
|
395
397
|
|
396
398
|
</div>
|
397
399
|
|
398
|
-
<div class="content"><div class='highlight'><pre>
|
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">¶</a>
|
425
433
|
</div>
|
426
|
-
<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 =
|
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
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
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">¶</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">¶</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> => 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">¶</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">¶</a>
|
710
|
+
</div>
|
711
|
+
<p>Make iframe</p>
|
712
|
+
|
713
|
+
</div>
|
714
|
+
|
715
|
+
<div class="content"><div class='highlight'><pre> iframe = <span class="string">"<iframe id='downloadframe' src='<span class="subst">#{iframe}</span>' width='800' height='1000'></iframe>"</span>
|
653
716
|
|
654
717
|
<span class="keyword">rescue</span> <span class="constant">Exception</span> => 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">¶</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">¶</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-
|
164
|
+
<li id="section-9">
|
146
165
|
<div class="annotation">
|
147
166
|
|
148
167
|
<div class="pilwrap ">
|
149
|
-
<a class="pilcrow" href="#section-
|
168
|
+
<a class="pilcrow" href="#section-9">¶</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 =
|
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-
|
180
|
+
<li id="section-10">
|
162
181
|
<div class="annotation">
|
163
182
|
|
164
183
|
<div class="pilwrap ">
|
165
|
-
<a class="pilcrow" href="#section-
|
184
|
+
<a class="pilcrow" href="#section-10">¶</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-
|
195
|
+
<li id="section-11">
|
177
196
|
<div class="annotation">
|
178
197
|
|
179
198
|
<div class="pilwrap ">
|
180
|
-
<a class="pilcrow" href="#section-
|
199
|
+
<a class="pilcrow" href="#section-11">¶</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-
|
210
|
+
<li id="section-12">
|
192
211
|
<div class="annotation">
|
193
212
|
|
194
213
|
<div class="pilwrap ">
|
195
|
-
<a class="pilcrow" href="#section-
|
214
|
+
<a class="pilcrow" href="#section-12">¶</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">"<span style=\"color:green\">Files from the envelope were downloaded to server's local folder. You can check them <a href=\"/downloads/<span class="subst">#{file}</span>\">here</a></span>"</span>
|
203
223
|
<span class="keyword">rescue</span> <span class="constant">Exception</span> => 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-
|
230
|
+
<li id="section-13">
|
211
231
|
<div class="annotation">
|
212
232
|
|
213
233
|
<div class="pilwrap ">
|
214
|
-
<a class="pilcrow" href="#section-
|
234
|
+
<a class="pilcrow" href="#section-13">¶</a>
|
215
235
|
</div>
|
216
|
-
<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> => {<span class="symbol">:userId</span> => settings.client_id, <span class="symbol">:privateKey</span> => settings.private_key, <span class="symbol">:
|
240
|
+
<div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample36</span>, <span class="symbol">:locals</span> => {<span class="symbol">:userId</span> => settings.client_id, <span class="symbol">:privateKey</span> => settings.private_key, <span class="symbol">:envelopeGuid</span> => settings.envelope, <span class="symbol">:message</span> => message, <span class="symbol">:err</span> => 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
|
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">¶</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">¶</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">¶</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">¶</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">¶</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">¶</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> => client_id, <span class="symbol">:private_key</span> => 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">¶</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> => client_id, <span class="symbol">:private_key</span> => private_key})
|
182
|
-
|
183
|
-
|
184
|
-
<span class="keyword">rescue</span> <span class="constant">Exception</span> => 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">¶</a>
|
197
|
-
</div>
|
198
|
-
<p>Route the handler url "/sample37/check"</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">¶</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-
|
72
|
+
<li id="section-4">
|
226
73
|
<div class="annotation">
|
227
74
|
|
228
75
|
<div class="pilwrap ">
|
229
|
-
<a class="pilcrow" href="#section-
|
76
|
+
<a class="pilcrow" href="#section-4">¶</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-
|
89
|
+
<li id="section-5">
|
243
90
|
<div class="annotation">
|
244
91
|
|
245
92
|
<div class="pilwrap ">
|
246
|
-
<a class="pilcrow" href="#section-
|
93
|
+
<a class="pilcrow" href="#section-5">¶</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<<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> && 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> && 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-
|
114
|
+
<li id="section-6">
|
268
115
|
<div class="annotation">
|
269
116
|
|
270
117
|
<div class="pilwrap ">
|
271
|
-
<a class="pilcrow" href="#section-
|
118
|
+
<a class="pilcrow" href="#section-6">¶</a>
|
272
119
|
</div>
|
273
120
|
<p>Route the handler url "/sample37/downloads"</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-
|
129
|
+
<li id="section-7">
|
283
130
|
<div class="annotation">
|
284
131
|
|
285
132
|
<div class="pilwrap ">
|
286
|
-
<a class="pilcrow" href="#section-
|
133
|
+
<a class="pilcrow" href="#section-7">¶</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-
|
145
|
+
<li id="section-8">
|
299
146
|
<div class="annotation">
|
300
147
|
|
301
148
|
<div class="pilwrap ">
|
302
|
-
<a class="pilcrow" href="#section-
|
149
|
+
<a class="pilcrow" href="#section-8">¶</a>
|
303
150
|
</div>
|
304
151
|
<p>Route the handler url "/sample37". 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-
|
160
|
+
<li id="section-9">
|
314
161
|
<div class="annotation">
|
315
162
|
|
316
163
|
<div class="pilwrap ">
|
317
|
-
<a class="pilcrow" href="#section-
|
164
|
+
<a class="pilcrow" href="#section-9">¶</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-
|
184
|
+
<li id="section-10">
|
338
185
|
<div class="annotation">
|
339
186
|
|
340
187
|
<div class="pilwrap ">
|
341
|
-
<a class="pilcrow" href="#section-
|
188
|
+
<a class="pilcrow" href="#section-10">¶</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-
|
199
|
+
<li id="section-11">
|
353
200
|
<div class="annotation">
|
354
201
|
|
355
202
|
<div class="pilwrap ">
|
356
|
-
<a class="pilcrow" href="#section-
|
203
|
+
<a class="pilcrow" href="#section-11">¶</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-
|
220
|
+
<li id="section-12">
|
374
221
|
<div class="annotation">
|
375
222
|
|
376
223
|
<div class="pilwrap ">
|
377
|
-
<a class="pilcrow" href="#section-
|
224
|
+
<a class="pilcrow" href="#section-12">¶</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-
|
235
|
+
<li id="section-13">
|
391
236
|
<div class="annotation">
|
392
237
|
|
393
238
|
<div class="pilwrap ">
|
394
|
-
<a class="pilcrow" href="#section-
|
239
|
+
<a class="pilcrow" href="#section-13">¶</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">¶</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-
|
273
|
+
<li id="section-15">
|
408
274
|
<div class="annotation">
|
409
275
|
|
410
276
|
<div class="pilwrap ">
|
411
|
-
<a class="pilcrow" href="#section-
|
277
|
+
<a class="pilcrow" href="#section-15">¶</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 =
|
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-
|
289
|
+
<li id="section-16">
|
424
290
|
<div class="annotation">
|
425
291
|
|
426
292
|
<div class="pilwrap ">
|
427
|
-
<a class="pilcrow" href="#section-
|
293
|
+
<a class="pilcrow" href="#section-16">¶</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-
|
305
|
+
<li id="section-17">
|
440
306
|
<div class="annotation">
|
441
307
|
|
442
308
|
<div class="pilwrap ">
|
443
|
-
<a class="pilcrow" href="#section-
|
309
|
+
<a class="pilcrow" href="#section-17">¶</a>
|
444
310
|
</div>
|
445
|
-
<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-
|
325
|
+
<li id="section-18">
|
460
326
|
<div class="annotation">
|
461
327
|
|
462
328
|
<div class="pilwrap ">
|
463
|
-
<a class="pilcrow" href="#section-
|
329
|
+
<a class="pilcrow" href="#section-18">¶</a>
|
464
330
|
</div>
|
465
|
-
<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-
|
341
|
+
<li id="section-19">
|
476
342
|
<div class="annotation">
|
477
343
|
|
478
344
|
<div class="pilwrap ">
|
479
|
-
<a class="pilcrow" href="#section-
|
345
|
+
<a class="pilcrow" href="#section-19">¶</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-
|
358
|
+
<li id="section-20">
|
493
359
|
<div class="annotation">
|
494
360
|
|
495
361
|
<div class="pilwrap ">
|
496
|
-
<a class="pilcrow" href="#section-
|
362
|
+
<a class="pilcrow" href="#section-20">¶</a>
|
497
363
|
</div>
|
498
|
-
<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-
|
373
|
+
<li id="section-21">
|
508
374
|
<div class="annotation">
|
509
375
|
|
510
376
|
<div class="pilwrap ">
|
511
|
-
<a class="pilcrow" href="#section-
|
377
|
+
<a class="pilcrow" href="#section-21">¶</a>
|
512
378
|
</div>
|
513
|
-
<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-
|
388
|
+
<li id="section-22">
|
523
389
|
<div class="annotation">
|
524
390
|
|
525
391
|
<div class="pilwrap ">
|
526
|
-
<a class="pilcrow" href="#section-
|
392
|
+
<a class="pilcrow" href="#section-22">¶</a>
|
527
393
|
</div>
|
528
|
-
<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
|
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-
|
405
|
+
<li id="section-23">
|
539
406
|
<div class="annotation">
|
540
407
|
|
541
408
|
<div class="pilwrap ">
|
542
|
-
<a class="pilcrow" href="#section-
|
409
|
+
<a class="pilcrow" href="#section-23">¶</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-
|
425
|
+
<li id="section-24">
|
559
426
|
<div class="annotation">
|
560
427
|
|
561
428
|
<div class="pilwrap ">
|
562
|
-
<a class="pilcrow" href="#section-
|
429
|
+
<a class="pilcrow" href="#section-24">¶</a>
|
563
430
|
</div>
|
564
|
-
<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-
|
443
|
+
<li id="section-25">
|
577
444
|
<div class="annotation">
|
578
445
|
|
579
446
|
<div class="pilwrap ">
|
580
|
-
<a class="pilcrow" href="#section-
|
447
|
+
<a class="pilcrow" href="#section-25">¶</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-
|
458
|
+
<li id="section-26">
|
592
459
|
<div class="annotation">
|
593
460
|
|
594
461
|
<div class="pilwrap ">
|
595
|
-
<a class="pilcrow" href="#section-
|
462
|
+
<a class="pilcrow" href="#section-26">¶</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-
|
473
|
+
<li id="section-27">
|
607
474
|
<div class="annotation">
|
608
475
|
|
609
476
|
<div class="pilwrap ">
|
610
|
-
<a class="pilcrow" href="#section-
|
477
|
+
<a class="pilcrow" href="#section-27">¶</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-
|
492
|
+
<li id="section-28">
|
626
493
|
<div class="annotation">
|
627
494
|
|
628
495
|
<div class="pilwrap ">
|
629
|
-
<a class="pilcrow" href="#section-
|
496
|
+
<a class="pilcrow" href="#section-28">¶</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>
|
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">¶</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-
|
507
|
+
<li id="section-29">
|
656
508
|
<div class="annotation">
|
657
509
|
|
658
510
|
<div class="pilwrap ">
|
659
|
-
<a class="pilcrow" href="#section-
|
511
|
+
<a class="pilcrow" href="#section-29">¶</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-
|
522
|
+
<li id="section-30">
|
671
523
|
<div class="annotation">
|
672
524
|
|
673
525
|
<div class="pilwrap ">
|
674
|
-
<a class="pilcrow" href="#section-
|
526
|
+
<a class="pilcrow" href="#section-30">¶</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-
|
539
|
+
<li id="section-31">
|
688
540
|
<div class="annotation">
|
689
541
|
|
690
542
|
<div class="pilwrap ">
|
691
|
-
<a class="pilcrow" href="#section-
|
543
|
+
<a class="pilcrow" href="#section-31">¶</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-
|
554
|
+
<li id="section-32">
|
703
555
|
<div class="annotation">
|
704
556
|
|
705
557
|
<div class="pilwrap ">
|
706
|
-
<a class="pilcrow" href="#section-
|
558
|
+
<a class="pilcrow" href="#section-32">¶</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-
|
569
|
+
<li id="section-33">
|
718
570
|
<div class="annotation">
|
719
571
|
|
720
572
|
<div class="pilwrap ">
|
721
|
-
<a class="pilcrow" href="#section-
|
573
|
+
<a class="pilcrow" href="#section-33">¶</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-
|
585
|
+
<li id="section-34">
|
734
586
|
<div class="annotation">
|
735
587
|
|
736
588
|
<div class="pilwrap ">
|
737
|
-
<a class="pilcrow" href="#section-
|
589
|
+
<a class="pilcrow" href="#section-34">¶</a>
|
738
590
|
</div>
|
739
|
-
<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-
|
604
|
+
<li id="section-35">
|
753
605
|
<div class="annotation">
|
754
606
|
|
755
607
|
<div class="pilwrap ">
|
756
|
-
<a class="pilcrow" href="#section-
|
608
|
+
<a class="pilcrow" href="#section-35">¶</a>
|
757
609
|
</div>
|
758
|
-
<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="
|
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">¶</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> => 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">¶</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
|
-
|
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
|
-
|
648
|
+
iframe = <span class="string">"https://dev-apps.groupdocs.com<span class="subst">#{url}</span>"</span>
|
768
649
|
<span class="keyword">else</span>
|
769
|
-
|
770
|
-
<span class="keyword">end</span>
|
771
|
-
|
772
|
-
|
773
|
-
iframe = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> => 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-
|
656
|
+
<li id="section-38">
|
779
657
|
<div class="annotation">
|
780
658
|
|
781
659
|
<div class="pilwrap ">
|
782
|
-
<a class="pilcrow" href="#section-
|
660
|
+
<a class="pilcrow" href="#section-38">¶</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">"<iframe src='<span class="subst">#{iframe}</span>'
|
666
|
+
<div class="content"><div class='highlight'><pre> iframe = <span class="string">"<iframe id='downloadframe' src='<span class="subst">#{iframe}</span>' width='800' height='1000'></iframe>"</span>
|
667
|
+
|
789
668
|
message = <span class="string">"<p>File was uploaded to GroupDocs. Here you can see your <strong><span class="subst">#{name}</span></strong> file in the GroupDocs Embedded Viewer.</p>"</span>
|
790
669
|
<span class="keyword">rescue</span> <span class="constant">Exception</span> => 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-
|
676
|
+
<li id="section-39">
|
798
677
|
<div class="annotation">
|
799
678
|
|
800
679
|
<div class="pilwrap ">
|
801
|
-
<a class="pilcrow" href="#section-
|
680
|
+
<a class="pilcrow" href="#section-39">¶</a>
|
802
681
|
</div>
|
803
682
|
<p>Set variables for template</p>
|
804
683
|
|