groupdocs 1.5.7 → 1.5.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +51 -0
- data/examples/api-samples/Gemfile +1 -1
- data/examples/api-samples/Gemfile.lock +43 -0
- data/examples/api-samples/public/docs/{sample2.html → sample01.html} +39 -19
- data/examples/api-samples/public/docs/{sample3.html → sample02.html} +28 -22
- data/examples/api-samples/public/docs/sample03.html +285 -0
- data/examples/api-samples/public/docs/{sample4.html → sample04.html} +30 -36
- data/examples/api-samples/public/docs/{sample5.html → sample05.html} +68 -31
- data/examples/api-samples/public/docs/sample06.html +299 -0
- data/examples/api-samples/public/docs/{sample7.html → sample07.html} +53 -18
- data/examples/api-samples/public/docs/{sample8.html → sample08.html} +64 -41
- data/examples/api-samples/public/docs/sample09.html +260 -0
- data/examples/api-samples/public/docs/sample10.html +67 -28
- data/examples/api-samples/public/docs/sample11.html +171 -55
- data/examples/api-samples/public/docs/sample12.html +53 -17
- data/examples/api-samples/public/docs/sample13.html +52 -16
- data/examples/api-samples/public/docs/sample14.html +51 -8
- data/examples/api-samples/public/docs/sample15.html +46 -10
- data/examples/api-samples/public/docs/sample16.html +81 -7
- data/examples/api-samples/public/docs/sample17.html +103 -15
- data/examples/api-samples/public/docs/sample18.html +117 -41
- data/examples/api-samples/public/docs/sample19.html +410 -36
- data/examples/api-samples/public/docs/sample20.html +46 -10
- data/examples/api-samples/public/docs/sample21.html +504 -45
- data/examples/api-samples/public/docs/sample22.html +166 -28
- data/examples/api-samples/public/docs/sample23.html +61 -25
- data/examples/api-samples/public/docs/sample24.html +100 -12
- data/examples/api-samples/public/docs/sample25.html +123 -49
- data/examples/api-samples/public/docs/sample26.html +41 -8
- data/examples/api-samples/public/docs/sample27.html +125 -50
- data/examples/api-samples/public/docs/sample28.html +27 -9
- data/examples/api-samples/public/docs/sample29.html +10 -10
- data/examples/api-samples/public/docs/sample30.html +70 -14
- data/examples/api-samples/public/docs/sample31.html +108 -67
- data/examples/api-samples/public/docs/sample32.html +71 -99
- data/examples/api-samples/public/docs/sample33.html +107 -32
- data/examples/api-samples/public/docs/{sample1.html → sample34.html} +58 -18
- data/examples/api-samples/public/docs/sample35.html +666 -0
- data/examples/api-samples/public/docs/{sample6.html → sample36.html} +56 -37
- data/examples/api-samples/public/docs/sample37.html +815 -0
- data/examples/api-samples/public/docs/sample38.html +508 -0
- data/examples/api-samples/public/docs/sample39.html +921 -0
- data/examples/api-samples/public/docs/sample40.html +510 -0
- data/examples/api-samples/public/docs/sample41.html +452 -0
- data/examples/api-samples/public/docs/sample42.html +311 -0
- data/examples/api-samples/public/templates/test_all_fields2.pdf +0 -0
- data/examples/api-samples/samples/sample01.rb +37 -0
- data/examples/api-samples/samples/sample02.rb +41 -0
- data/examples/api-samples/samples/sample03.rb +73 -0
- data/examples/api-samples/samples/sample04.rb +47 -0
- data/examples/api-samples/samples/{sample5.rb → sample05.rb} +26 -14
- data/examples/api-samples/samples/sample06.rb +80 -0
- data/examples/api-samples/samples/sample07.rb +52 -0
- data/examples/api-samples/samples/sample08.rb +69 -0
- data/examples/api-samples/samples/sample09.rb +83 -0
- data/examples/api-samples/samples/sample10.rb +29 -15
- data/examples/api-samples/samples/sample11.rb +89 -37
- data/examples/api-samples/samples/sample12.rb +22 -11
- data/examples/api-samples/samples/sample13.rb +22 -10
- data/examples/api-samples/samples/sample14.rb +23 -5
- data/examples/api-samples/samples/sample15.rb +18 -7
- data/examples/api-samples/samples/sample16.rb +28 -4
- data/examples/api-samples/samples/sample17.rb +31 -5
- data/examples/api-samples/samples/sample18.rb +36 -8
- data/examples/api-samples/samples/sample19.rb +138 -18
- data/examples/api-samples/samples/sample20.rb +14 -3
- data/examples/api-samples/samples/sample21.rb +162 -23
- data/examples/api-samples/samples/sample22.rb +73 -22
- data/examples/api-samples/samples/sample23.rb +17 -6
- data/examples/api-samples/samples/sample24.rb +34 -7
- data/examples/api-samples/samples/sample25.rb +37 -12
- data/examples/api-samples/samples/sample26.rb +12 -5
- data/examples/api-samples/samples/sample27.rb +38 -12
- data/examples/api-samples/samples/sample28.rb +25 -6
- data/examples/api-samples/samples/sample29.rb +12 -12
- data/examples/api-samples/samples/sample30.rb +27 -15
- data/examples/api-samples/samples/sample31.rb +44 -33
- data/examples/api-samples/samples/sample32.rb +43 -41
- data/examples/api-samples/samples/sample33.rb +42 -14
- data/examples/api-samples/samples/sample34.rb +40 -0
- data/examples/api-samples/samples/sample35.rb +224 -0
- data/examples/api-samples/samples/sample36.rb +58 -0
- data/examples/api-samples/samples/sample37.rb +229 -0
- data/examples/api-samples/samples/sample38.rb +128 -0
- data/examples/api-samples/samples/sample39.rb +252 -0
- data/examples/api-samples/samples/sample40.rb +164 -0
- data/examples/api-samples/samples/sample41.rb +118 -0
- data/examples/api-samples/samples/sample42.rb +97 -0
- data/examples/api-samples/views/_others_samples.haml +25 -11
- data/examples/api-samples/views/index.haml +23 -11
- data/examples/api-samples/views/popup.haml +32 -0
- data/examples/api-samples/views/{sample1.haml → sample01.haml} +12 -7
- data/examples/api-samples/views/{sample2.haml → sample02.haml} +20 -15
- data/examples/api-samples/views/sample03.haml +83 -0
- data/examples/api-samples/views/sample04.haml +49 -0
- data/examples/api-samples/views/{sample5.haml → sample05.haml} +19 -14
- data/examples/api-samples/views/sample06.haml +53 -0
- data/examples/api-samples/views/sample07.haml +47 -0
- data/examples/api-samples/views/{sample8.haml → sample08.haml} +17 -12
- data/examples/api-samples/views/{sample9.haml → sample09.haml} +19 -4
- data/examples/api-samples/views/sample10.haml +18 -13
- data/examples/api-samples/views/sample11.haml +48 -19
- data/examples/api-samples/views/sample12.haml +26 -21
- data/examples/api-samples/views/sample13.haml +18 -12
- data/examples/api-samples/views/sample14.haml +21 -15
- data/examples/api-samples/views/sample15.haml +16 -9
- data/examples/api-samples/views/sample16.haml +18 -5
- data/examples/api-samples/views/sample17.haml +14 -9
- data/examples/api-samples/views/sample18.haml +13 -7
- data/examples/api-samples/views/sample19.haml +37 -8
- data/examples/api-samples/views/sample20.haml +13 -8
- data/examples/api-samples/views/sample21.haml +71 -13
- data/examples/api-samples/views/sample22.haml +53 -16
- data/examples/api-samples/views/sample23.haml +9 -4
- data/examples/api-samples/views/sample24.haml +9 -4
- data/examples/api-samples/views/sample25.haml +18 -13
- data/examples/api-samples/views/sample26.haml +8 -3
- data/examples/api-samples/views/sample27.haml +20 -14
- data/examples/api-samples/views/sample28.haml +16 -10
- data/examples/api-samples/views/sample29.haml +4 -4
- data/examples/api-samples/views/sample30.haml +16 -10
- data/examples/api-samples/views/sample31.haml +39 -32
- data/examples/api-samples/views/sample32.haml +25 -36
- data/examples/api-samples/views/sample33.haml +14 -17
- data/examples/api-samples/views/sample34.haml +48 -0
- data/examples/api-samples/views/sample35.haml +95 -0
- data/examples/api-samples/views/sample36.haml +64 -0
- data/examples/api-samples/views/sample37.haml +124 -0
- data/examples/api-samples/views/sample38.haml +115 -0
- data/examples/api-samples/views/sample39.haml +236 -0
- data/examples/api-samples/views/sample40.haml +95 -0
- data/examples/api-samples/views/{sample4.haml → sample41.haml} +90 -72
- data/examples/api-samples/views/sample42.haml +59 -0
- data/lib/groupdocs/api/helpers/rest_helper.rb +13 -1
- data/lib/groupdocs/datasource.rb +2 -1
- data/lib/groupdocs/document.rb +101 -13
- data/lib/groupdocs/document/annotation.rb +28 -13
- data/lib/groupdocs/document/annotation/marker.rb +18 -0
- data/lib/groupdocs/document/annotation/reply.rb +9 -2
- data/lib/groupdocs/document/field.rb +5 -1
- data/lib/groupdocs/job.rb +12 -2
- data/lib/groupdocs/questionnaire.rb +174 -4
- data/lib/groupdocs/questionnaire/collector.rb +21 -0
- data/lib/groupdocs/questionnaire/question.rb +19 -0
- data/lib/groupdocs/questionnaire/question/answer.rb +5 -0
- data/lib/groupdocs/questionnaire/question/conditions.rb +20 -0
- data/lib/groupdocs/signature.rb +36 -308
- data/lib/groupdocs/signature/envelope.rb +146 -4
- data/lib/groupdocs/signature/field.rb +20 -1
- data/lib/groupdocs/signature/field/location.rb +18 -7
- data/lib/groupdocs/signature/form.rb +199 -10
- data/lib/groupdocs/signature/shared/document_methods.rb +38 -0
- data/lib/groupdocs/signature/shared/entity_methods.rb +0 -1
- data/lib/groupdocs/signature/shared/field_methods.rb +13 -38
- data/lib/groupdocs/signature/shared/recipient_methods.rb +8 -0
- data/lib/groupdocs/signature/template.rb +3 -1
- data/lib/groupdocs/storage.rb +4 -1
- data/lib/groupdocs/storage/file.rb +18 -1
- data/lib/groupdocs/subscription.rb +8 -3
- data/lib/groupdocs/user.rb +8 -0
- data/lib/groupdocs/version.rb +1 -1
- data/spec/groupdocs/document/annotation_spec.rb +1 -14
- data/spec/groupdocs/subscription_spec.rb +2 -2
- metadata +86 -32
- checksums.yaml +0 -15
- data/examples/api-samples/public/docs/sample9.html +0 -200
- data/examples/api-samples/samples/sample1.rb +0 -25
- data/examples/api-samples/samples/sample2.rb +0 -29
- data/examples/api-samples/samples/sample3.rb +0 -33
- data/examples/api-samples/samples/sample4.rb +0 -51
- data/examples/api-samples/samples/sample6.rb +0 -49
- data/examples/api-samples/samples/sample7.rb +0 -42
- data/examples/api-samples/samples/sample8.rb +0 -61
- data/examples/api-samples/samples/sample9.rb +0 -48
- data/examples/api-samples/views/sample3.haml +0 -44
- data/examples/api-samples/views/sample6.haml +0 -49
- data/examples/api-samples/views/sample7.haml +0 -42
@@ -63,9 +63,10 @@
|
|
63
63
|
|
64
64
|
</div>
|
65
65
|
|
66
|
-
<div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:
|
67
|
-
set <span class="symbol">:private_key</span>, params[<span class="symbol">:
|
66
|
+
<div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:clientId</span>]
|
67
|
+
set <span class="symbol">:private_key</span>, params[<span class="symbol">:privateKey</span>]
|
68
68
|
set <span class="symbol">:url</span>, params[<span class="symbol">:url</span>]
|
69
|
+
set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]
|
69
70
|
|
70
71
|
<span class="keyword">begin</span></pre></div></div>
|
71
72
|
|
@@ -78,11 +79,13 @@
|
|
78
79
|
<div class="pilwrap ">
|
79
80
|
<a class="pilcrow" href="#section-4">¶</a>
|
80
81
|
</div>
|
81
|
-
<p>
|
82
|
+
<p>Check required variables</p>
|
82
83
|
|
83
84
|
</div>
|
84
85
|
|
85
|
-
<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.url.<span class="keyword">nil</span
|
86
|
+
<div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.client_id.empty? <span class="keyword">or</span> settings.private_key.empty? <span class="keyword">or</span> settings.url.<span class="keyword">nil</span>?
|
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
89
|
|
87
90
|
</li>
|
88
91
|
|
@@ -93,11 +96,13 @@
|
|
93
96
|
<div class="pilwrap ">
|
94
97
|
<a class="pilcrow" href="#section-5">¶</a>
|
95
98
|
</div>
|
96
|
-
<p>
|
99
|
+
<p>Configure your access to API server</p>
|
97
100
|
|
98
101
|
</div>
|
99
102
|
|
100
|
-
<div class="content"><div class='highlight'><pre>
|
103
|
+
<div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
|
104
|
+
groupdocs.client_id = settings.client_id
|
105
|
+
groupdocs.private_key = settings.private_key</pre></div></div>
|
101
106
|
|
102
107
|
</li>
|
103
108
|
|
@@ -108,12 +113,95 @@
|
|
108
113
|
<div class="pilwrap ">
|
109
114
|
<a class="pilcrow" href="#section-6">¶</a>
|
110
115
|
</div>
|
111
|
-
<p>
|
116
|
+
<p>Optionally specify API server and version</p>
|
117
|
+
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
|
121
|
+
<span class="keyword">end</span></pre></div></div>
|
122
|
+
|
123
|
+
</li>
|
124
|
+
|
125
|
+
|
126
|
+
<li id="section-7">
|
127
|
+
<div class="annotation">
|
128
|
+
|
129
|
+
<div class="pilwrap ">
|
130
|
+
<a class="pilcrow" href="#section-7">¶</a>
|
131
|
+
</div>
|
132
|
+
<p>Upload web file</p>
|
133
|
+
|
134
|
+
</div>
|
135
|
+
|
136
|
+
<div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload_web!(settings.url, {<span class="symbol">:client_id</span> => settings.client_id, <span class="symbol">:private_key</span> => settings.private_key})</pre></div></div>
|
137
|
+
|
138
|
+
</li>
|
139
|
+
|
140
|
+
|
141
|
+
<li id="section-8">
|
142
|
+
<div class="annotation">
|
143
|
+
|
144
|
+
<div class="pilwrap ">
|
145
|
+
<a class="pilcrow" href="#section-8">¶</a>
|
146
|
+
</div>
|
147
|
+
<p>Construct result messages</p>
|
112
148
|
|
113
149
|
</div>
|
114
150
|
|
115
|
-
<div class="content"><div class='highlight'><pre> message = <span class="string">"<p>File was uploaded to GroupDocs. Here you can see your <strong> file in the GroupDocs Embedded Viewer.</p>"</span>
|
116
|
-
|
151
|
+
<div class="content"><div class='highlight'><pre> message = <span class="string">"<p>File was uploaded to GroupDocs. Here you can see your <strong> file in the GroupDocs Embedded Viewer.</p>"</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 url from request</p>
|
163
|
+
|
164
|
+
</div>
|
165
|
+
|
166
|
+
<div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.base_path
|
167
|
+
|
168
|
+
<span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
|
169
|
+
url = <span class="string">"http://stage-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{file.guid}</span>"</span>
|
170
|
+
<span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
|
171
|
+
url = <span class="string">"http://dev-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{file.guid}</span>"</span>
|
172
|
+
<span class="keyword">else</span>
|
173
|
+
url = <span class="string">"https://apps.groupdocs.com/document-viewer/embed/<span class="subst">#{file.guid}</span>"</span>
|
174
|
+
<span class="keyword">end</span></pre></div></div>
|
175
|
+
|
176
|
+
</li>
|
177
|
+
|
178
|
+
|
179
|
+
<li id="section-10">
|
180
|
+
<div class="annotation">
|
181
|
+
|
182
|
+
<div class="pilwrap ">
|
183
|
+
<a class="pilcrow" href="#section-10">¶</a>
|
184
|
+
</div>
|
185
|
+
<p>Add the signature to url te request</p>
|
186
|
+
|
187
|
+
</div>
|
188
|
+
|
189
|
+
<div class="content"><div class='highlight'><pre> iframe = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> => url).prepare_and_sign_url</pre></div></div>
|
190
|
+
|
191
|
+
</li>
|
192
|
+
|
193
|
+
|
194
|
+
<li id="section-11">
|
195
|
+
<div class="annotation">
|
196
|
+
|
197
|
+
<div class="pilwrap ">
|
198
|
+
<a class="pilcrow" href="#section-11">¶</a>
|
199
|
+
</div>
|
200
|
+
<p>Construct result iframe</p>
|
201
|
+
|
202
|
+
</div>
|
203
|
+
|
204
|
+
<div class="content"><div class='highlight'><pre> iframe = <span class="string">"<iframe src='<span class="subst">#{iframe}</span>' frameborder='0' width='720' height='600'></iframe>"</span>
|
117
205
|
|
118
206
|
<span class="keyword">rescue</span> <span class="constant">Exception</span> => e
|
119
207
|
err = e.message
|
@@ -122,13 +210,13 @@
|
|
122
210
|
</li>
|
123
211
|
|
124
212
|
|
125
|
-
<li id="section-
|
213
|
+
<li id="section-12">
|
126
214
|
<div class="annotation">
|
127
215
|
|
128
216
|
<div class="pilwrap ">
|
129
|
-
<a class="pilcrow" href="#section-
|
217
|
+
<a class="pilcrow" href="#section-12">¶</a>
|
130
218
|
</div>
|
131
|
-
<p>
|
219
|
+
<p>Set variables for template</p>
|
132
220
|
|
133
221
|
</div>
|
134
222
|
|
@@ -63,11 +63,12 @@
|
|
63
63
|
|
64
64
|
</div>
|
65
65
|
|
66
|
-
<div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:
|
67
|
-
set <span class="symbol">:private_key</span>, params[<span class="symbol">:
|
66
|
+
<div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:clientId</span>]
|
67
|
+
set <span class="symbol">:private_key</span>, params[<span class="symbol">:privateKey</span>]
|
68
68
|
set <span class="symbol">:source</span>, params[<span class="symbol">:source</span>]
|
69
69
|
set <span class="symbol">:file_id</span>, params[<span class="symbol">:fileId</span>]
|
70
|
-
set <span class="symbol">:url</span>, params[<span class="symbol">:url</span>]
|
70
|
+
set <span class="symbol">:url</span>, params[<span class="symbol">:url</span>]
|
71
|
+
set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]</pre></div></div>
|
71
72
|
|
72
73
|
</li>
|
73
74
|
|
@@ -118,7 +119,9 @@
|
|
118
119
|
|
119
120
|
</div>
|
120
121
|
|
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
|
+
<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?
|
123
|
+
|
124
|
+
<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>
|
122
125
|
|
123
126
|
</li>
|
124
127
|
|
@@ -129,12 +132,13 @@
|
|
129
132
|
<div class="pilwrap ">
|
130
133
|
<a class="pilcrow" href="#section-7">¶</a>
|
131
134
|
</div>
|
132
|
-
<p>
|
135
|
+
<p>Configure your access to API server</p>
|
133
136
|
|
134
137
|
</div>
|
135
138
|
|
136
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">
|
137
|
-
|
139
|
+
<div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
|
140
|
+
groupdocs.client_id = settings.client_id
|
141
|
+
groupdocs.private_key = settings.private_key</pre></div></div>
|
138
142
|
|
139
143
|
</li>
|
140
144
|
|
@@ -145,12 +149,12 @@
|
|
145
149
|
<div class="pilwrap ">
|
146
150
|
<a class="pilcrow" href="#section-8">¶</a>
|
147
151
|
</div>
|
148
|
-
<p>
|
152
|
+
<p>Optionally specify API server and version</p>
|
149
153
|
|
150
154
|
</div>
|
151
155
|
|
152
|
-
<div class="content"><div class='highlight'><pre>
|
153
|
-
<span class="keyword">
|
156
|
+
<div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
|
157
|
+
<span class="keyword">end</span></pre></div></div>
|
154
158
|
|
155
159
|
</li>
|
156
160
|
|
@@ -161,11 +165,12 @@
|
|
161
165
|
<div class="pilwrap ">
|
162
166
|
<a class="pilcrow" href="#section-9">¶</a>
|
163
167
|
</div>
|
164
|
-
<p>
|
168
|
+
<p>Get document by file GUID</p>
|
165
169
|
|
166
170
|
</div>
|
167
171
|
|
168
|
-
<div class="content"><div class='highlight'><pre>
|
172
|
+
<div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.source
|
173
|
+
<span class="keyword">when</span> <span class="string">'guid'</span></pre></div></div>
|
169
174
|
|
170
175
|
</li>
|
171
176
|
|
@@ -176,11 +181,12 @@
|
|
176
181
|
<div class="pilwrap ">
|
177
182
|
<a class="pilcrow" href="#section-10">¶</a>
|
178
183
|
</div>
|
179
|
-
<p>
|
184
|
+
<p>Create instance of File</p>
|
180
185
|
|
181
186
|
</div>
|
182
187
|
|
183
|
-
<div class="content"><div class='highlight'><pre> <span class="constant">File</span>.
|
188
|
+
<div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.new({<span class="symbol">:guid</span> => settings.file_id})
|
189
|
+
<span class="keyword">when</span> <span class="string">'local'</span></pre></div></div>
|
184
190
|
|
185
191
|
</li>
|
186
192
|
|
@@ -191,12 +197,11 @@
|
|
191
197
|
<div class="pilwrap ">
|
192
198
|
<a class="pilcrow" href="#section-11">¶</a>
|
193
199
|
</div>
|
194
|
-
<p>
|
200
|
+
<p>Construct path</p>
|
195
201
|
|
196
202
|
</div>
|
197
203
|
|
198
|
-
<div class="content"><div class='highlight'><pre>
|
199
|
-
<span class="keyword">when</span> <span class="string">'url'</span></pre></div></div>
|
204
|
+
<div class="content"><div class='highlight'><pre> file_path = <span class="string">"<span class="subst">#{<span class="constant">Dir</span>.tmpdir}</span>/<span class="subst">#{params[<span class="symbol">:file</span>][<span class="symbol">:filename</span>]}</span>"</span></pre></div></div>
|
200
205
|
|
201
206
|
</li>
|
202
207
|
|
@@ -207,14 +212,11 @@
|
|
207
212
|
<div class="pilwrap ">
|
208
213
|
<a class="pilcrow" href="#section-12">¶</a>
|
209
214
|
</div>
|
210
|
-
<p>
|
215
|
+
<p>Open file</p>
|
211
216
|
|
212
217
|
</div>
|
213
218
|
|
214
|
-
<div class="content"><div class='highlight'><pre>
|
215
|
-
<span class="keyword">else</span>
|
216
|
-
raise <span class="string">'Wrong GUID source.'</span>
|
217
|
-
<span class="keyword">end</span></pre></div></div>
|
219
|
+
<div class="content"><div class='highlight'><pre> <span class="constant">File</span>.open(file_path, <span class="string">'wb'</span>) { |f| f.write(params[<span class="symbol">:file</span>][<span class="symbol">:tempfile</span>].read) }</pre></div></div>
|
218
220
|
|
219
221
|
</li>
|
220
222
|
|
@@ -225,11 +227,12 @@
|
|
225
227
|
<div class="pilwrap ">
|
226
228
|
<a class="pilcrow" href="#section-13">¶</a>
|
227
229
|
</div>
|
228
|
-
<p>
|
230
|
+
<p>Make a request to API using client_id and private_key</p>
|
229
231
|
|
230
232
|
</div>
|
231
233
|
|
232
|
-
<div class="content"><div class='highlight'><pre>
|
234
|
+
<div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload!(file_path, {})
|
235
|
+
<span class="keyword">when</span> <span class="string">'url'</span></pre></div></div>
|
233
236
|
|
234
237
|
</li>
|
235
238
|
|
@@ -240,11 +243,14 @@
|
|
240
243
|
<div class="pilwrap ">
|
241
244
|
<a class="pilcrow" href="#section-14">¶</a>
|
242
245
|
</div>
|
243
|
-
<p>
|
246
|
+
<p>Upload file from defined url</p>
|
244
247
|
|
245
248
|
</div>
|
246
249
|
|
247
|
-
<div class="content"><div class='highlight'><pre>
|
250
|
+
<div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload_web!(settings.url)
|
251
|
+
<span class="keyword">else</span>
|
252
|
+
raise <span class="string">'Wrong GUID source.'</span>
|
253
|
+
<span class="keyword">end</span></pre></div></div>
|
248
254
|
|
249
255
|
</li>
|
250
256
|
|
@@ -255,11 +261,11 @@
|
|
255
261
|
<div class="pilwrap ">
|
256
262
|
<a class="pilcrow" href="#section-15">¶</a>
|
257
263
|
</div>
|
258
|
-
<p>
|
264
|
+
<p>Raise exception if something went wrong</p>
|
259
265
|
|
260
266
|
</div>
|
261
267
|
|
262
|
-
<div class="content"><div class='highlight'><pre>
|
268
|
+
<div class="content"><div class='highlight'><pre> raise <span class="string">'No such file'</span> <span class="keyword">unless</span> file.is_a?(<span class="constant">GroupDocs::Storage::File</span>)</pre></div></div>
|
263
269
|
|
264
270
|
</li>
|
265
271
|
|
@@ -270,11 +276,11 @@
|
|
270
276
|
<div class="pilwrap ">
|
271
277
|
<a class="pilcrow" href="#section-16">¶</a>
|
272
278
|
</div>
|
273
|
-
<p>
|
279
|
+
<p>Make GroupDocs::Storage::Document instance</p>
|
274
280
|
|
275
281
|
</div>
|
276
282
|
|
277
|
-
<div class="content"><div class='highlight'><pre>
|
283
|
+
<div class="content"><div class='highlight'><pre> document = file.to_document</pre></div></div>
|
278
284
|
|
279
285
|
</li>
|
280
286
|
|
@@ -285,11 +291,11 @@
|
|
285
291
|
<div class="pilwrap ">
|
286
292
|
<a class="pilcrow" href="#section-17">¶</a>
|
287
293
|
</div>
|
288
|
-
<p>Create
|
294
|
+
<p>Create datasource with fields</p>
|
289
295
|
|
290
296
|
</div>
|
291
297
|
|
292
|
-
<div class="content"><div class='highlight'><pre> datasource
|
298
|
+
<div class="content"><div class='highlight'><pre> datasource = <span class="constant">GroupDocs::DataSource</span>.new</pre></div></div>
|
293
299
|
|
294
300
|
</li>
|
295
301
|
|
@@ -300,11 +306,11 @@
|
|
300
306
|
<div class="pilwrap ">
|
301
307
|
<a class="pilcrow" href="#section-18">¶</a>
|
302
308
|
</div>
|
303
|
-
<p>
|
309
|
+
<p>Get arry of document's fields</p>
|
304
310
|
|
305
311
|
</div>
|
306
312
|
|
307
|
-
<div class="content"><div class='highlight'><pre>
|
313
|
+
<div class="content"><div class='highlight'><pre> fields = document.fields!()</pre></div></div>
|
308
314
|
|
309
315
|
</li>
|
310
316
|
|
@@ -315,12 +321,11 @@
|
|
315
321
|
<div class="pilwrap ">
|
316
322
|
<a class="pilcrow" href="#section-19">¶</a>
|
317
323
|
</div>
|
318
|
-
<p>
|
324
|
+
<p>Create Field instance and fill the fields</p>
|
319
325
|
|
320
326
|
</div>
|
321
327
|
|
322
|
-
<div class="content"><div class='highlight'><pre>
|
323
|
-
sleep <span class="number">10</span> <span class="comment"># wait for merge and convert</span></pre></div></div>
|
328
|
+
<div class="content"><div class='highlight'><pre> datasource.fields = fields.map { |field| <span class="constant">GroupDocs::DataSource::Field</span>.new(<span class="symbol">name:</span> field.name, <span class="symbol">type:</span> <span class="symbol">:text</span>, <span class="symbol">values:</span> <span class="string">%w(value1 value2)</span>) }</pre></div></div>
|
324
329
|
|
325
330
|
</li>
|
326
331
|
|
@@ -331,11 +336,11 @@
|
|
331
336
|
<div class="pilwrap ">
|
332
337
|
<a class="pilcrow" href="#section-20">¶</a>
|
333
338
|
</div>
|
334
|
-
<p>
|
339
|
+
<p>Adds datasource.</p>
|
335
340
|
|
336
341
|
</div>
|
337
342
|
|
338
|
-
<div class="content"><div class='highlight'><pre>
|
343
|
+
<div class="content"><div class='highlight'><pre> datasource.add!()</pre></div></div>
|
339
344
|
|
340
345
|
</li>
|
341
346
|
|
@@ -346,11 +351,12 @@
|
|
346
351
|
<div class="pilwrap ">
|
347
352
|
<a class="pilcrow" href="#section-21">¶</a>
|
348
353
|
</div>
|
349
|
-
<p>
|
354
|
+
<p>Creates new job to merge datasource into document.</p>
|
350
355
|
|
351
356
|
</div>
|
352
357
|
|
353
|
-
<div class="content"><div class='highlight'><pre>
|
358
|
+
<div class="content"><div class='highlight'><pre> job = document.datasource!(datasource, {<span class="symbol">:new_type</span> => <span class="string">'pdf'</span>})
|
359
|
+
sleep <span class="number">10</span> <span class="comment"># wait for merge and convert</span></pre></div></div>
|
354
360
|
|
355
361
|
</li>
|
356
362
|
|
@@ -361,11 +367,11 @@
|
|
361
367
|
<div class="pilwrap ">
|
362
368
|
<a class="pilcrow" href="#section-22">¶</a>
|
363
369
|
</div>
|
364
|
-
<p>
|
370
|
+
<p>Returns an hash of input and output documents associated to job.</p>
|
365
371
|
|
366
372
|
</div>
|
367
373
|
|
368
|
-
<div class="content"><div class='highlight'><pre>
|
374
|
+
<div class="content"><div class='highlight'><pre> document = job.documents!()</pre></div></div>
|
369
375
|
|
370
376
|
</li>
|
371
377
|
|
@@ -376,11 +382,11 @@
|
|
376
382
|
<div class="pilwrap ">
|
377
383
|
<a class="pilcrow" href="#section-23">¶</a>
|
378
384
|
</div>
|
379
|
-
<p>
|
385
|
+
<p>Download file</p>
|
380
386
|
|
381
387
|
</div>
|
382
388
|
|
383
|
-
<div class="content"><div class='highlight'><pre>
|
389
|
+
<div class="content"><div class='highlight'><pre> document[<span class="symbol">:inputs</span>][<span class="number">0</span>].outputs[<span class="number">0</span>].download!(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/downloads"</span>)</pre></div></div>
|
384
390
|
|
385
391
|
</li>
|
386
392
|
|
@@ -391,12 +397,80 @@
|
|
391
397
|
<div class="pilwrap ">
|
392
398
|
<a class="pilcrow" href="#section-24">¶</a>
|
393
399
|
</div>
|
400
|
+
<p>Set converted document GUID</p>
|
401
|
+
|
402
|
+
</div>
|
403
|
+
|
404
|
+
<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>
|
405
|
+
|
406
|
+
</li>
|
407
|
+
|
408
|
+
|
409
|
+
<li id="section-25">
|
410
|
+
<div class="annotation">
|
411
|
+
|
412
|
+
<div class="pilwrap ">
|
413
|
+
<a class="pilcrow" href="#section-25">¶</a>
|
414
|
+
</div>
|
415
|
+
<p>Set converted document Name</p>
|
416
|
+
|
417
|
+
</div>
|
418
|
+
|
419
|
+
<div class="content"><div class='highlight'><pre> file_name = document[<span class="symbol">:inputs</span>][<span class="number">0</span>].outputs[<span class="number">0</span>].name</pre></div></div>
|
420
|
+
|
421
|
+
</li>
|
422
|
+
|
423
|
+
|
424
|
+
<li id="section-26">
|
425
|
+
<div class="annotation">
|
426
|
+
|
427
|
+
<div class="pilwrap ">
|
428
|
+
<a class="pilcrow" href="#section-26">¶</a>
|
429
|
+
</div>
|
430
|
+
<p>Get url from request</p>
|
431
|
+
|
432
|
+
</div>
|
433
|
+
|
434
|
+
<div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.base_path
|
435
|
+
|
436
|
+
<span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
|
437
|
+
url = <span class="string">"http://stage-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{guid}</span>"</span>
|
438
|
+
<span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
|
439
|
+
url = <span class="string">"http://dev-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{guid}</span>"</span>
|
440
|
+
<span class="keyword">else</span>
|
441
|
+
url = <span class="string">"https://apps.groupdocs.com/document-viewer/embed/<span class="subst">#{guid}</span>"</span>
|
442
|
+
<span class="keyword">end</span></pre></div></div>
|
443
|
+
|
444
|
+
</li>
|
445
|
+
|
446
|
+
|
447
|
+
<li id="section-27">
|
448
|
+
<div class="annotation">
|
449
|
+
|
450
|
+
<div class="pilwrap ">
|
451
|
+
<a class="pilcrow" href="#section-27">¶</a>
|
452
|
+
</div>
|
453
|
+
<p>Add the signature to url the request</p>
|
454
|
+
|
455
|
+
</div>
|
456
|
+
|
457
|
+
<div class="content"><div class='highlight'><pre> iframe = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> => url).prepare_and_sign_url</pre></div></div>
|
458
|
+
|
459
|
+
</li>
|
460
|
+
|
461
|
+
|
462
|
+
<li id="section-28">
|
463
|
+
<div class="annotation">
|
464
|
+
|
465
|
+
<div class="pilwrap ">
|
466
|
+
<a class="pilcrow" href="#section-28">¶</a>
|
467
|
+
</div>
|
394
468
|
<p>Set iframe with document GUID or raise an error</p>
|
395
469
|
|
396
470
|
</div>
|
397
471
|
|
398
472
|
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> guid
|
399
|
-
iframe = <span class="string">"<iframe width='100%' height='600' frameborder='0' src='
|
473
|
+
iframe = <span class="string">"<iframe width='100%' height='600' frameborder='0' src='<span class="subst">#{iframe}</span>'></iframe>"</span>
|
400
474
|
<span class="keyword">else</span>
|
401
475
|
raise <span class="string">'File was not converted'</span>
|
402
476
|
<span class="keyword">end</span>
|
@@ -408,17 +482,17 @@
|
|
408
482
|
</li>
|
409
483
|
|
410
484
|
|
411
|
-
<li id="section-
|
485
|
+
<li id="section-29">
|
412
486
|
<div class="annotation">
|
413
487
|
|
414
488
|
<div class="pilwrap ">
|
415
|
-
<a class="pilcrow" href="#section-
|
489
|
+
<a class="pilcrow" href="#section-29">¶</a>
|
416
490
|
</div>
|
417
491
|
<p>set variables for template</p>
|
418
492
|
|
419
493
|
</div>
|
420
494
|
|
421
|
-
<div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample25</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">:iframe</span> => iframe, <span class="symbol">:
|
495
|
+
<div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample25</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">:iframe</span> => iframe, <span class="symbol">:fileName</span> => file_name, <span class="symbol">:err</span> => err}
|
422
496
|
<span class="keyword">end</span></pre></div></div>
|
423
497
|
|
424
498
|
</li>
|