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
@@ -49,9 +49,9 @@
|
|
49
49
|
</div>
|
50
50
|
|
51
51
|
<div class="content"><div class='highlight'><pre>post <span class="string">'/sample26'</span> <span class="keyword">do</span>
|
52
|
-
set <span class="symbol">:email</span>, params[<span class="symbol">:
|
52
|
+
set <span class="symbol">:email</span>, params[<span class="symbol">:login</span>]
|
53
53
|
set <span class="symbol">:password</span>, params[<span class="symbol">:password</span>]
|
54
|
-
|
54
|
+
set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]
|
55
55
|
|
56
56
|
<span class="keyword">begin</span></pre></div></div>
|
57
57
|
|
@@ -64,11 +64,13 @@
|
|
64
64
|
<div class="pilwrap ">
|
65
65
|
<a class="pilcrow" href="#section-3">¶</a>
|
66
66
|
</div>
|
67
|
-
<p>
|
67
|
+
<p>Check required variables</p>
|
68
68
|
|
69
69
|
</div>
|
70
70
|
|
71
|
-
<div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.email.empty? <span class="keyword">or</span> settings.password.empty
|
71
|
+
<div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.email.empty? <span class="keyword">or</span> settings.password.empty?
|
72
|
+
|
73
|
+
<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>
|
72
74
|
|
73
75
|
</li>
|
74
76
|
|
@@ -79,7 +81,38 @@
|
|
79
81
|
<div class="pilwrap ">
|
80
82
|
<a class="pilcrow" href="#section-4">¶</a>
|
81
83
|
</div>
|
82
|
-
<p>
|
84
|
+
<p>Configure your access to API server</p>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|</pre></div></div>
|
89
|
+
|
90
|
+
</li>
|
91
|
+
|
92
|
+
|
93
|
+
<li id="section-5">
|
94
|
+
<div class="annotation">
|
95
|
+
|
96
|
+
<div class="pilwrap ">
|
97
|
+
<a class="pilcrow" href="#section-5">¶</a>
|
98
|
+
</div>
|
99
|
+
<p>Optionally specify API server and version</p>
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
<div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
|
104
|
+
<span class="keyword">end</span></pre></div></div>
|
105
|
+
|
106
|
+
</li>
|
107
|
+
|
108
|
+
|
109
|
+
<li id="section-6">
|
110
|
+
<div class="annotation">
|
111
|
+
|
112
|
+
<div class="pilwrap ">
|
113
|
+
<a class="pilcrow" href="#section-6">¶</a>
|
114
|
+
</div>
|
115
|
+
<p>Make a request to API using email and password</p>
|
83
116
|
|
84
117
|
</div>
|
85
118
|
|
@@ -92,13 +125,13 @@
|
|
92
125
|
</li>
|
93
126
|
|
94
127
|
|
95
|
-
<li id="section-
|
128
|
+
<li id="section-7">
|
96
129
|
<div class="annotation">
|
97
130
|
|
98
131
|
<div class="pilwrap ">
|
99
|
-
<a class="pilcrow" href="#section-
|
132
|
+
<a class="pilcrow" href="#section-7">¶</a>
|
100
133
|
</div>
|
101
|
-
<p>
|
134
|
+
<p>Set variables for template</p>
|
102
135
|
|
103
136
|
</div>
|
104
137
|
|
@@ -59,19 +59,20 @@
|
|
59
59
|
<div class="pilwrap ">
|
60
60
|
<a class="pilcrow" href="#section-3">¶</a>
|
61
61
|
</div>
|
62
|
-
<p>
|
62
|
+
<p>Set variables</p>
|
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">:file_id</span>, params[<span class="symbol">:fileId</span>]
|
69
69
|
set <span class="symbol">:source</span>, params[<span class="symbol">:source</span>]
|
70
70
|
set <span class="symbol">:sex</span>, params[<span class="symbol">:sex</span>]
|
71
71
|
set <span class="symbol">:age</span>, params[<span class="symbol">:age</span>]
|
72
72
|
set <span class="symbol">:sunrise</span>, params[<span class="symbol">:sunrise</span>]
|
73
73
|
set <span class="symbol">:name</span>, params[<span class="symbol">:name</span>]
|
74
|
-
set <span class="symbol">:type</span>, params[<span class="symbol">:type</span>]
|
74
|
+
set <span class="symbol">:type</span>, params[<span class="symbol">:type</span>]
|
75
|
+
set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]</pre></div></div>
|
75
76
|
|
76
77
|
</li>
|
77
78
|
|
@@ -122,7 +123,9 @@
|
|
122
123
|
|
123
124
|
</div>
|
124
125
|
|
125
|
-
<div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.client_id.empty? <span class="keyword">or</span> settings.private_key.empty
|
126
|
+
<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?
|
127
|
+
|
128
|
+
<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>
|
126
129
|
|
127
130
|
</li>
|
128
131
|
|
@@ -133,12 +136,13 @@
|
|
133
136
|
<div class="pilwrap ">
|
134
137
|
<a class="pilcrow" href="#section-7">¶</a>
|
135
138
|
</div>
|
136
|
-
<p>
|
139
|
+
<p>Configure your access to API server</p>
|
137
140
|
|
138
141
|
</div>
|
139
142
|
|
140
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">
|
141
|
-
|
143
|
+
<div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
|
144
|
+
groupdocs.client_id = settings.client_id
|
145
|
+
groupdocs.private_key = settings.private_key</pre></div></div>
|
142
146
|
|
143
147
|
</li>
|
144
148
|
|
@@ -149,12 +153,12 @@
|
|
149
153
|
<div class="pilwrap ">
|
150
154
|
<a class="pilcrow" href="#section-8">¶</a>
|
151
155
|
</div>
|
152
|
-
<p>
|
156
|
+
<p>Optionally specify API server and version</p>
|
153
157
|
|
154
158
|
</div>
|
155
159
|
|
156
|
-
<div class="content"><div class='highlight'><pre>
|
157
|
-
<span class="keyword">
|
160
|
+
<div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
|
161
|
+
<span class="keyword">end</span></pre></div></div>
|
158
162
|
|
159
163
|
</li>
|
160
164
|
|
@@ -165,11 +169,12 @@
|
|
165
169
|
<div class="pilwrap ">
|
166
170
|
<a class="pilcrow" href="#section-9">¶</a>
|
167
171
|
</div>
|
168
|
-
<p>
|
172
|
+
<p>Get document by file GUID</p>
|
169
173
|
|
170
174
|
</div>
|
171
175
|
|
172
|
-
<div class="content"><div class='highlight'><pre>
|
176
|
+
<div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.source
|
177
|
+
<span class="keyword">when</span> <span class="string">'guid'</span></pre></div></div>
|
173
178
|
|
174
179
|
</li>
|
175
180
|
|
@@ -180,11 +185,12 @@
|
|
180
185
|
<div class="pilwrap ">
|
181
186
|
<a class="pilcrow" href="#section-10">¶</a>
|
182
187
|
</div>
|
183
|
-
<p>
|
188
|
+
<p>Create instance of File</p>
|
184
189
|
|
185
190
|
</div>
|
186
191
|
|
187
|
-
<div class="content"><div class='highlight'><pre> <span class="constant">File</span>.
|
192
|
+
<div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.new({<span class="symbol">:guid</span> => settings.file_id})
|
193
|
+
<span class="keyword">when</span> <span class="string">'local'</span></pre></div></div>
|
188
194
|
|
189
195
|
</li>
|
190
196
|
|
@@ -195,12 +201,11 @@
|
|
195
201
|
<div class="pilwrap ">
|
196
202
|
<a class="pilcrow" href="#section-11">¶</a>
|
197
203
|
</div>
|
198
|
-
<p>
|
204
|
+
<p>Construct path</p>
|
199
205
|
|
200
206
|
</div>
|
201
207
|
|
202
|
-
<div class="content"><div class='highlight'><pre>
|
203
|
-
<span class="keyword">when</span> <span class="string">'url'</span></pre></div></div>
|
208
|
+
<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>
|
204
209
|
|
205
210
|
</li>
|
206
211
|
|
@@ -211,14 +216,11 @@
|
|
211
216
|
<div class="pilwrap ">
|
212
217
|
<a class="pilcrow" href="#section-12">¶</a>
|
213
218
|
</div>
|
214
|
-
<p>
|
219
|
+
<p>Open file</p>
|
215
220
|
|
216
221
|
</div>
|
217
222
|
|
218
|
-
<div class="content"><div class='highlight'><pre>
|
219
|
-
<span class="keyword">else</span>
|
220
|
-
raise <span class="string">'Wrong GUID source.'</span>
|
221
|
-
<span class="keyword">end</span></pre></div></div>
|
223
|
+
<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>
|
222
224
|
|
223
225
|
</li>
|
224
226
|
|
@@ -229,11 +231,12 @@
|
|
229
231
|
<div class="pilwrap ">
|
230
232
|
<a class="pilcrow" href="#section-13">¶</a>
|
231
233
|
</div>
|
232
|
-
<p>
|
234
|
+
<p>Make a request to API using client_id and private_key</p>
|
233
235
|
|
234
236
|
</div>
|
235
237
|
|
236
|
-
<div class="content"><div class='highlight'><pre>
|
238
|
+
<div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload!(file_path, {})
|
239
|
+
<span class="keyword">when</span> <span class="string">'url'</span></pre></div></div>
|
237
240
|
|
238
241
|
</li>
|
239
242
|
|
@@ -244,11 +247,14 @@
|
|
244
247
|
<div class="pilwrap ">
|
245
248
|
<a class="pilcrow" href="#section-14">¶</a>
|
246
249
|
</div>
|
247
|
-
<p>
|
250
|
+
<p>Upload file from defined url</p>
|
248
251
|
|
249
252
|
</div>
|
250
253
|
|
251
|
-
<div class="content"><div class='highlight'><pre>
|
254
|
+
<div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload_web!(settings.url)
|
255
|
+
<span class="keyword">else</span>
|
256
|
+
raise <span class="string">'Wrong GUID source.'</span>
|
257
|
+
<span class="keyword">end</span></pre></div></div>
|
252
258
|
|
253
259
|
</li>
|
254
260
|
|
@@ -259,11 +265,11 @@
|
|
259
265
|
<div class="pilwrap ">
|
260
266
|
<a class="pilcrow" href="#section-15">¶</a>
|
261
267
|
</div>
|
262
|
-
<p>
|
268
|
+
<p>Raise exception if something went wrong</p>
|
263
269
|
|
264
270
|
</div>
|
265
271
|
|
266
|
-
<div class="content"><div class='highlight'><pre>
|
272
|
+
<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>
|
267
273
|
|
268
274
|
</li>
|
269
275
|
|
@@ -274,11 +280,11 @@
|
|
274
280
|
<div class="pilwrap ">
|
275
281
|
<a class="pilcrow" href="#section-16">¶</a>
|
276
282
|
</div>
|
277
|
-
<p>
|
283
|
+
<p>Make GroupDocs::Storage::Document instance</p>
|
278
284
|
|
279
285
|
</div>
|
280
286
|
|
281
|
-
<div class="content"><div class='highlight'><pre>
|
287
|
+
<div class="content"><div class='highlight'><pre> document = file.to_document</pre></div></div>
|
282
288
|
|
283
289
|
</li>
|
284
290
|
|
@@ -289,11 +295,11 @@
|
|
289
295
|
<div class="pilwrap ">
|
290
296
|
<a class="pilcrow" href="#section-17">¶</a>
|
291
297
|
</div>
|
292
|
-
<p>Create
|
298
|
+
<p>Create datasource with fields</p>
|
293
299
|
|
294
300
|
</div>
|
295
301
|
|
296
|
-
<div class="content"><div class='highlight'><pre> datasource
|
302
|
+
<div class="content"><div class='highlight'><pre> datasource = <span class="constant">GroupDocs::DataSource</span>.new</pre></div></div>
|
297
303
|
|
298
304
|
</li>
|
299
305
|
|
@@ -304,11 +310,11 @@
|
|
304
310
|
<div class="pilwrap ">
|
305
311
|
<a class="pilcrow" href="#section-18">¶</a>
|
306
312
|
</div>
|
307
|
-
<p>
|
313
|
+
<p>Get arry of document's fields</p>
|
308
314
|
|
309
315
|
</div>
|
310
316
|
|
311
|
-
<div class="content"><div class='highlight'><pre>
|
317
|
+
<div class="content"><div class='highlight'><pre> enteredData = {<span class="string">"sex"</span> => settings.sex, <span class="string">"name"</span> => settings.name, <span class="string">"age"</span>=> settings.age, <span class="string">"sunrise"</span> => settings.sunrise}</pre></div></div>
|
312
318
|
|
313
319
|
</li>
|
314
320
|
|
@@ -319,12 +325,11 @@
|
|
319
325
|
<div class="pilwrap ">
|
320
326
|
<a class="pilcrow" href="#section-19">¶</a>
|
321
327
|
</div>
|
322
|
-
<p>
|
328
|
+
<p>Create Field instance and fill the fields</p>
|
323
329
|
|
324
330
|
</div>
|
325
331
|
|
326
|
-
<div class="content"><div class='highlight'><pre>
|
327
|
-
sleep <span class="number">10</span> <span class="comment"># wait for merge and convert</span></pre></div></div>
|
332
|
+
<div class="content"><div class='highlight'><pre> datasource.fields = enteredData.map { |key, value| <span class="constant">GroupDocs::DataSource::Field</span>.new(<span class="symbol">name:</span> key, <span class="symbol">type:</span> <span class="symbol">:text</span>, <span class="symbol">values:</span> <span class="constant">Array</span>.new() << value) }</pre></div></div>
|
328
333
|
|
329
334
|
</li>
|
330
335
|
|
@@ -335,11 +340,11 @@
|
|
335
340
|
<div class="pilwrap ">
|
336
341
|
<a class="pilcrow" href="#section-20">¶</a>
|
337
342
|
</div>
|
338
|
-
<p>
|
343
|
+
<p>Adds datasource.</p>
|
339
344
|
|
340
345
|
</div>
|
341
346
|
|
342
|
-
<div class="content"><div class='highlight'><pre>
|
347
|
+
<div class="content"><div class='highlight'><pre> datasource.add!()</pre></div></div>
|
343
348
|
|
344
349
|
</li>
|
345
350
|
|
@@ -350,11 +355,12 @@
|
|
350
355
|
<div class="pilwrap ">
|
351
356
|
<a class="pilcrow" href="#section-21">¶</a>
|
352
357
|
</div>
|
353
|
-
<p>
|
358
|
+
<p>Creates new job to merge datasource into document.</p>
|
354
359
|
|
355
360
|
</div>
|
356
361
|
|
357
|
-
<div class="content"><div class='highlight'><pre>
|
362
|
+
<div class="content"><div class='highlight'><pre> job = document.datasource!(datasource, {<span class="symbol">:new_type</span> => settings.type})
|
363
|
+
sleep <span class="number">10</span> <span class="comment"># wait for merge and convert</span></pre></div></div>
|
358
364
|
|
359
365
|
</li>
|
360
366
|
|
@@ -365,11 +371,11 @@
|
|
365
371
|
<div class="pilwrap ">
|
366
372
|
<a class="pilcrow" href="#section-22">¶</a>
|
367
373
|
</div>
|
368
|
-
<p>
|
374
|
+
<p>Returns an hash of input and output documents associated to job.</p>
|
369
375
|
|
370
376
|
</div>
|
371
377
|
|
372
|
-
<div class="content"><div class='highlight'><pre>
|
378
|
+
<div class="content"><div class='highlight'><pre> document = job.documents!()</pre></div></div>
|
373
379
|
|
374
380
|
</li>
|
375
381
|
|
@@ -380,11 +386,11 @@
|
|
380
386
|
<div class="pilwrap ">
|
381
387
|
<a class="pilcrow" href="#section-23">¶</a>
|
382
388
|
</div>
|
383
|
-
<p>
|
389
|
+
<p>Download file</p>
|
384
390
|
|
385
391
|
</div>
|
386
392
|
|
387
|
-
<div class="content"><div class='highlight'><pre>
|
393
|
+
<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!(downloads_path)</pre></div></div>
|
388
394
|
|
389
395
|
</li>
|
390
396
|
|
@@ -395,12 +401,81 @@
|
|
395
401
|
<div class="pilwrap ">
|
396
402
|
<a class="pilcrow" href="#section-24">¶</a>
|
397
403
|
</div>
|
404
|
+
<p>Set converted document GUID</p>
|
405
|
+
|
406
|
+
</div>
|
407
|
+
|
408
|
+
<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>
|
409
|
+
|
410
|
+
</li>
|
411
|
+
|
412
|
+
|
413
|
+
<li id="section-25">
|
414
|
+
<div class="annotation">
|
415
|
+
|
416
|
+
<div class="pilwrap ">
|
417
|
+
<a class="pilcrow" href="#section-25">¶</a>
|
418
|
+
</div>
|
419
|
+
<p>Set converted document Name</p>
|
420
|
+
|
421
|
+
</div>
|
422
|
+
|
423
|
+
<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>
|
424
|
+
|
425
|
+
</li>
|
426
|
+
|
427
|
+
|
428
|
+
<li id="section-26">
|
429
|
+
<div class="annotation">
|
430
|
+
|
431
|
+
<div class="pilwrap ">
|
432
|
+
<a class="pilcrow" href="#section-26">¶</a>
|
433
|
+
</div>
|
434
|
+
<p>Get url from request</p>
|
435
|
+
|
436
|
+
</div>
|
437
|
+
|
438
|
+
<div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.base_path
|
439
|
+
|
440
|
+
<span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
|
441
|
+
url = <span class="string">"http://stage-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{guid}</span>"</span>
|
442
|
+
<span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
|
443
|
+
url = <span class="string">"http://dev-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{guid}</span>"</span>
|
444
|
+
<span class="keyword">else</span>
|
445
|
+
url = <span class="string">"https://apps.groupdocs.com/document-viewer/embed/<span class="subst">#{guid}</span>"</span>
|
446
|
+
<span class="keyword">end</span></pre></div></div>
|
447
|
+
|
448
|
+
</li>
|
449
|
+
|
450
|
+
|
451
|
+
<li id="section-27">
|
452
|
+
<div class="annotation">
|
453
|
+
|
454
|
+
<div class="pilwrap ">
|
455
|
+
<a class="pilcrow" href="#section-27">¶</a>
|
456
|
+
</div>
|
457
|
+
<p>Add the signature to url the request</p>
|
458
|
+
|
459
|
+
</div>
|
460
|
+
|
461
|
+
<div class="content"><div class='highlight'><pre>
|
462
|
+
iframe = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> => url).prepare_and_sign_url</pre></div></div>
|
463
|
+
|
464
|
+
</li>
|
465
|
+
|
466
|
+
|
467
|
+
<li id="section-28">
|
468
|
+
<div class="annotation">
|
469
|
+
|
470
|
+
<div class="pilwrap ">
|
471
|
+
<a class="pilcrow" href="#section-28">¶</a>
|
472
|
+
</div>
|
398
473
|
<p>Set iframe with document GUID or raise an error</p>
|
399
474
|
|
400
475
|
</div>
|
401
476
|
|
402
477
|
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> guid
|
403
|
-
iframe = <span class="string">"<iframe width='100%' height='600' frameborder='0' src='
|
478
|
+
iframe = <span class="string">"<iframe width='100%' height='600' frameborder='0' src='<span class="subst">#{iframe}</span>'></iframe>"</span>
|
404
479
|
<span class="keyword">else</span>
|
405
480
|
raise <span class="string">'File was not converted'</span>
|
406
481
|
<span class="keyword">end</span>
|
@@ -412,13 +487,13 @@
|
|
412
487
|
</li>
|
413
488
|
|
414
489
|
|
415
|
-
<li id="section-
|
490
|
+
<li id="section-29">
|
416
491
|
<div class="annotation">
|
417
492
|
|
418
493
|
<div class="pilwrap ">
|
419
|
-
<a class="pilcrow" href="#section-
|
494
|
+
<a class="pilcrow" href="#section-29">¶</a>
|
420
495
|
</div>
|
421
|
-
<p>
|
496
|
+
<p>Set variables for template</p>
|
422
497
|
|
423
498
|
</div>
|
424
499
|
|