groupdocs 1.5.7 → 1.5.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. data/CHANGELOG.md +51 -0
  2. data/examples/api-samples/Gemfile +1 -1
  3. data/examples/api-samples/Gemfile.lock +43 -0
  4. data/examples/api-samples/public/docs/{sample2.html → sample01.html} +39 -19
  5. data/examples/api-samples/public/docs/{sample3.html → sample02.html} +28 -22
  6. data/examples/api-samples/public/docs/sample03.html +285 -0
  7. data/examples/api-samples/public/docs/{sample4.html → sample04.html} +30 -36
  8. data/examples/api-samples/public/docs/{sample5.html → sample05.html} +68 -31
  9. data/examples/api-samples/public/docs/sample06.html +299 -0
  10. data/examples/api-samples/public/docs/{sample7.html → sample07.html} +53 -18
  11. data/examples/api-samples/public/docs/{sample8.html → sample08.html} +64 -41
  12. data/examples/api-samples/public/docs/sample09.html +260 -0
  13. data/examples/api-samples/public/docs/sample10.html +67 -28
  14. data/examples/api-samples/public/docs/sample11.html +171 -55
  15. data/examples/api-samples/public/docs/sample12.html +53 -17
  16. data/examples/api-samples/public/docs/sample13.html +52 -16
  17. data/examples/api-samples/public/docs/sample14.html +51 -8
  18. data/examples/api-samples/public/docs/sample15.html +46 -10
  19. data/examples/api-samples/public/docs/sample16.html +81 -7
  20. data/examples/api-samples/public/docs/sample17.html +103 -15
  21. data/examples/api-samples/public/docs/sample18.html +117 -41
  22. data/examples/api-samples/public/docs/sample19.html +410 -36
  23. data/examples/api-samples/public/docs/sample20.html +46 -10
  24. data/examples/api-samples/public/docs/sample21.html +504 -45
  25. data/examples/api-samples/public/docs/sample22.html +166 -28
  26. data/examples/api-samples/public/docs/sample23.html +61 -25
  27. data/examples/api-samples/public/docs/sample24.html +100 -12
  28. data/examples/api-samples/public/docs/sample25.html +123 -49
  29. data/examples/api-samples/public/docs/sample26.html +41 -8
  30. data/examples/api-samples/public/docs/sample27.html +125 -50
  31. data/examples/api-samples/public/docs/sample28.html +27 -9
  32. data/examples/api-samples/public/docs/sample29.html +10 -10
  33. data/examples/api-samples/public/docs/sample30.html +70 -14
  34. data/examples/api-samples/public/docs/sample31.html +108 -67
  35. data/examples/api-samples/public/docs/sample32.html +71 -99
  36. data/examples/api-samples/public/docs/sample33.html +107 -32
  37. data/examples/api-samples/public/docs/{sample1.html → sample34.html} +58 -18
  38. data/examples/api-samples/public/docs/sample35.html +666 -0
  39. data/examples/api-samples/public/docs/{sample6.html → sample36.html} +56 -37
  40. data/examples/api-samples/public/docs/sample37.html +815 -0
  41. data/examples/api-samples/public/docs/sample38.html +508 -0
  42. data/examples/api-samples/public/docs/sample39.html +921 -0
  43. data/examples/api-samples/public/docs/sample40.html +510 -0
  44. data/examples/api-samples/public/docs/sample41.html +452 -0
  45. data/examples/api-samples/public/docs/sample42.html +311 -0
  46. data/examples/api-samples/public/templates/test_all_fields2.pdf +0 -0
  47. data/examples/api-samples/samples/sample01.rb +37 -0
  48. data/examples/api-samples/samples/sample02.rb +41 -0
  49. data/examples/api-samples/samples/sample03.rb +73 -0
  50. data/examples/api-samples/samples/sample04.rb +47 -0
  51. data/examples/api-samples/samples/{sample5.rb → sample05.rb} +26 -14
  52. data/examples/api-samples/samples/sample06.rb +80 -0
  53. data/examples/api-samples/samples/sample07.rb +52 -0
  54. data/examples/api-samples/samples/sample08.rb +69 -0
  55. data/examples/api-samples/samples/sample09.rb +83 -0
  56. data/examples/api-samples/samples/sample10.rb +29 -15
  57. data/examples/api-samples/samples/sample11.rb +89 -37
  58. data/examples/api-samples/samples/sample12.rb +22 -11
  59. data/examples/api-samples/samples/sample13.rb +22 -10
  60. data/examples/api-samples/samples/sample14.rb +23 -5
  61. data/examples/api-samples/samples/sample15.rb +18 -7
  62. data/examples/api-samples/samples/sample16.rb +28 -4
  63. data/examples/api-samples/samples/sample17.rb +31 -5
  64. data/examples/api-samples/samples/sample18.rb +36 -8
  65. data/examples/api-samples/samples/sample19.rb +138 -18
  66. data/examples/api-samples/samples/sample20.rb +14 -3
  67. data/examples/api-samples/samples/sample21.rb +162 -23
  68. data/examples/api-samples/samples/sample22.rb +73 -22
  69. data/examples/api-samples/samples/sample23.rb +17 -6
  70. data/examples/api-samples/samples/sample24.rb +34 -7
  71. data/examples/api-samples/samples/sample25.rb +37 -12
  72. data/examples/api-samples/samples/sample26.rb +12 -5
  73. data/examples/api-samples/samples/sample27.rb +38 -12
  74. data/examples/api-samples/samples/sample28.rb +25 -6
  75. data/examples/api-samples/samples/sample29.rb +12 -12
  76. data/examples/api-samples/samples/sample30.rb +27 -15
  77. data/examples/api-samples/samples/sample31.rb +44 -33
  78. data/examples/api-samples/samples/sample32.rb +43 -41
  79. data/examples/api-samples/samples/sample33.rb +42 -14
  80. data/examples/api-samples/samples/sample34.rb +40 -0
  81. data/examples/api-samples/samples/sample35.rb +224 -0
  82. data/examples/api-samples/samples/sample36.rb +58 -0
  83. data/examples/api-samples/samples/sample37.rb +229 -0
  84. data/examples/api-samples/samples/sample38.rb +128 -0
  85. data/examples/api-samples/samples/sample39.rb +252 -0
  86. data/examples/api-samples/samples/sample40.rb +164 -0
  87. data/examples/api-samples/samples/sample41.rb +118 -0
  88. data/examples/api-samples/samples/sample42.rb +97 -0
  89. data/examples/api-samples/views/_others_samples.haml +25 -11
  90. data/examples/api-samples/views/index.haml +23 -11
  91. data/examples/api-samples/views/popup.haml +32 -0
  92. data/examples/api-samples/views/{sample1.haml → sample01.haml} +12 -7
  93. data/examples/api-samples/views/{sample2.haml → sample02.haml} +20 -15
  94. data/examples/api-samples/views/sample03.haml +83 -0
  95. data/examples/api-samples/views/sample04.haml +49 -0
  96. data/examples/api-samples/views/{sample5.haml → sample05.haml} +19 -14
  97. data/examples/api-samples/views/sample06.haml +53 -0
  98. data/examples/api-samples/views/sample07.haml +47 -0
  99. data/examples/api-samples/views/{sample8.haml → sample08.haml} +17 -12
  100. data/examples/api-samples/views/{sample9.haml → sample09.haml} +19 -4
  101. data/examples/api-samples/views/sample10.haml +18 -13
  102. data/examples/api-samples/views/sample11.haml +48 -19
  103. data/examples/api-samples/views/sample12.haml +26 -21
  104. data/examples/api-samples/views/sample13.haml +18 -12
  105. data/examples/api-samples/views/sample14.haml +21 -15
  106. data/examples/api-samples/views/sample15.haml +16 -9
  107. data/examples/api-samples/views/sample16.haml +18 -5
  108. data/examples/api-samples/views/sample17.haml +14 -9
  109. data/examples/api-samples/views/sample18.haml +13 -7
  110. data/examples/api-samples/views/sample19.haml +37 -8
  111. data/examples/api-samples/views/sample20.haml +13 -8
  112. data/examples/api-samples/views/sample21.haml +71 -13
  113. data/examples/api-samples/views/sample22.haml +53 -16
  114. data/examples/api-samples/views/sample23.haml +9 -4
  115. data/examples/api-samples/views/sample24.haml +9 -4
  116. data/examples/api-samples/views/sample25.haml +18 -13
  117. data/examples/api-samples/views/sample26.haml +8 -3
  118. data/examples/api-samples/views/sample27.haml +20 -14
  119. data/examples/api-samples/views/sample28.haml +16 -10
  120. data/examples/api-samples/views/sample29.haml +4 -4
  121. data/examples/api-samples/views/sample30.haml +16 -10
  122. data/examples/api-samples/views/sample31.haml +39 -32
  123. data/examples/api-samples/views/sample32.haml +25 -36
  124. data/examples/api-samples/views/sample33.haml +14 -17
  125. data/examples/api-samples/views/sample34.haml +48 -0
  126. data/examples/api-samples/views/sample35.haml +95 -0
  127. data/examples/api-samples/views/sample36.haml +64 -0
  128. data/examples/api-samples/views/sample37.haml +124 -0
  129. data/examples/api-samples/views/sample38.haml +115 -0
  130. data/examples/api-samples/views/sample39.haml +236 -0
  131. data/examples/api-samples/views/sample40.haml +95 -0
  132. data/examples/api-samples/views/{sample4.haml → sample41.haml} +90 -72
  133. data/examples/api-samples/views/sample42.haml +59 -0
  134. data/lib/groupdocs/api/helpers/rest_helper.rb +13 -1
  135. data/lib/groupdocs/datasource.rb +2 -1
  136. data/lib/groupdocs/document.rb +101 -13
  137. data/lib/groupdocs/document/annotation.rb +28 -13
  138. data/lib/groupdocs/document/annotation/marker.rb +18 -0
  139. data/lib/groupdocs/document/annotation/reply.rb +9 -2
  140. data/lib/groupdocs/document/field.rb +5 -1
  141. data/lib/groupdocs/job.rb +12 -2
  142. data/lib/groupdocs/questionnaire.rb +174 -4
  143. data/lib/groupdocs/questionnaire/collector.rb +21 -0
  144. data/lib/groupdocs/questionnaire/question.rb +19 -0
  145. data/lib/groupdocs/questionnaire/question/answer.rb +5 -0
  146. data/lib/groupdocs/questionnaire/question/conditions.rb +20 -0
  147. data/lib/groupdocs/signature.rb +36 -308
  148. data/lib/groupdocs/signature/envelope.rb +146 -4
  149. data/lib/groupdocs/signature/field.rb +20 -1
  150. data/lib/groupdocs/signature/field/location.rb +18 -7
  151. data/lib/groupdocs/signature/form.rb +199 -10
  152. data/lib/groupdocs/signature/shared/document_methods.rb +38 -0
  153. data/lib/groupdocs/signature/shared/entity_methods.rb +0 -1
  154. data/lib/groupdocs/signature/shared/field_methods.rb +13 -38
  155. data/lib/groupdocs/signature/shared/recipient_methods.rb +8 -0
  156. data/lib/groupdocs/signature/template.rb +3 -1
  157. data/lib/groupdocs/storage.rb +4 -1
  158. data/lib/groupdocs/storage/file.rb +18 -1
  159. data/lib/groupdocs/subscription.rb +8 -3
  160. data/lib/groupdocs/user.rb +8 -0
  161. data/lib/groupdocs/version.rb +1 -1
  162. data/spec/groupdocs/document/annotation_spec.rb +1 -14
  163. data/spec/groupdocs/subscription_spec.rb +2 -2
  164. metadata +86 -32
  165. checksums.yaml +0 -15
  166. data/examples/api-samples/public/docs/sample9.html +0 -200
  167. data/examples/api-samples/samples/sample1.rb +0 -25
  168. data/examples/api-samples/samples/sample2.rb +0 -29
  169. data/examples/api-samples/samples/sample3.rb +0 -33
  170. data/examples/api-samples/samples/sample4.rb +0 -51
  171. data/examples/api-samples/samples/sample6.rb +0 -49
  172. data/examples/api-samples/samples/sample7.rb +0 -42
  173. data/examples/api-samples/samples/sample8.rb +0 -61
  174. data/examples/api-samples/samples/sample9.rb +0 -48
  175. data/examples/api-samples/views/sample3.haml +0 -44
  176. data/examples/api-samples/views/sample6.haml +0 -49
  177. data/examples/api-samples/views/sample7.haml +0 -42
@@ -109,7 +109,7 @@
109
109
  contents = contents.split(<span class="string">' '</span>)
110
110
  client_id = contents[<span class="number">0</span>]
111
111
  private_key = contents[<span class="number">1</span>]
112
- subscriber_email = contens[<span class="number">2</span>]
112
+ subscriber_email = contents[<span class="number">2</span>]
113
113
  <span class="keyword">end</span></pre></div></div>
114
114
 
115
115
  </li>
@@ -227,11 +227,11 @@
227
227
  <div class="pilwrap ">
228
228
  <a class="pilcrow" href="#section-12">&#182;</a>
229
229
  </div>
230
- <p>GET request</p>
230
+ <p>POST request</p>
231
231
 
232
232
  </div>
233
233
 
234
- <div class="content"><div class='highlight'><pre>get <span class="string">'/sample32/check'</span> <span class="keyword">do</span></pre></div></div>
234
+ <div class="content"><div class='highlight'><pre>post <span class="string">'/sample32'</span> <span class="keyword">do</span></pre></div></div>
235
235
 
236
236
  </li>
237
237
 
@@ -242,13 +242,20 @@
242
242
  <div class="pilwrap ">
243
243
  <a class="pilcrow" href="#section-13">&#182;</a>
244
244
  </div>
245
- <p>Check is there download directory</p>
245
+ <p>set variables</p>
246
246
 
247
247
  </div>
248
248
 
249
- <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>)
250
- <span class="keyword">return</span> <span class="string">'Directory was not found.'</span>
251
- <span class="keyword">end</span></pre></div></div>
249
+ <div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:clientId</span>]
250
+ set <span class="symbol">:private_key</span>, params[<span class="symbol">:privateKey</span>]
251
+ set <span class="symbol">:template_guid</span>, params[<span class="symbol">:templateGuid</span>]
252
+ set <span class="symbol">:form_guid</span>, params[<span class="symbol">:formGuid</span>]
253
+ set <span class="symbol">:email</span>, params[<span class="symbol">:email</span>]
254
+ set <span class="symbol">:callback</span>, params[<span class="symbol">:callbackUrl</span>]
255
+ set <span class="symbol">:source</span>, params[<span class="symbol">:source</span>]
256
+ set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]
257
+
258
+ <span class="keyword">begin</span></pre></div></div>
252
259
 
253
260
  </li>
254
261
 
@@ -259,17 +266,13 @@
259
266
  <div class="pilwrap ">
260
267
  <a class="pilcrow" href="#section-14">&#182;</a>
261
268
  </div>
262
- <p>Get file name from download directory</p>
269
+ <p>Check required variables</p>
263
270
 
264
271
  </div>
265
272
 
266
- <div class="content"><div class='highlight'><pre> name = <span class="keyword">nil</span>
267
- <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|
268
- name = file <span class="keyword">if</span> file != <span class="string">'.'</span> &amp;&amp; file != <span class="string">'..'</span>
269
- <span class="keyword">end</span>
273
+ <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?
270
274
 
271
- name
272
- <span class="keyword">end</span></pre></div></div>
275
+ <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>
273
276
 
274
277
  </li>
275
278
 
@@ -280,11 +283,13 @@
280
283
  <div class="pilwrap ">
281
284
  <a class="pilcrow" href="#section-15">&#182;</a>
282
285
  </div>
283
- <p>POST request</p>
286
+ <p>Configure your access to API server</p>
284
287
 
285
288
  </div>
286
289
 
287
- <div class="content"><div class='highlight'><pre>post <span class="string">'/sample32'</span> <span class="keyword">do</span></pre></div></div>
290
+ <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
291
+ groupdocs.client_id = settings.client_id
292
+ groupdocs.private_key = settings.private_key</pre></div></div>
288
293
 
289
294
  </li>
290
295
 
@@ -295,17 +300,12 @@
295
300
  <div class="pilwrap ">
296
301
  <a class="pilcrow" href="#section-16">&#182;</a>
297
302
  </div>
298
- <p>set variables</p>
303
+ <p>Optionally specify API server and version</p>
299
304
 
300
305
  </div>
301
306
 
302
- <div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:client_id</span>]
303
- set <span class="symbol">:private_key</span>, params[<span class="symbol">:private_key</span>]
304
- set <span class="symbol">:template_guid</span>, params[<span class="symbol">:template</span>]
305
- set <span class="symbol">:form_guid</span>, params[<span class="symbol">:form</span>]
306
- set <span class="symbol">:email</span>, params[<span class="symbol">:email</span>]
307
- set <span class="symbol">:callback</span>, params[<span class="symbol">:callback</span>]
308
- set <span class="symbol">:source</span>, params[<span class="symbol">:source</span>]</pre></div></div>
307
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
308
+ <span class="keyword">end</span></pre></div></div>
309
309
 
310
310
  </li>
311
311
 
@@ -316,11 +316,12 @@
316
316
  <div class="pilwrap ">
317
317
  <a class="pilcrow" href="#section-17">&#182;</a>
318
318
  </div>
319
- <p>Set download path</p>
319
+ <p>Write client and private key to the file for callback job</p>
320
320
 
321
321
  </div>
322
322
 
323
- <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>
323
+ <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.callback
324
+ out_file = <span class="constant">File</span>.new(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/user_info.txt"</span>, <span class="string">'w'</span>)</pre></div></div>
324
325
 
325
326
  </li>
326
327
 
@@ -331,17 +332,22 @@
331
332
  <div class="pilwrap ">
332
333
  <a class="pilcrow" href="#section-18">&#182;</a>
333
334
  </div>
334
- <p>Remove all files from download directory or create folder if it not there</p>
335
+ <p>white space is required</p>
335
336
 
336
337
  </div>
337
338
 
338
- <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> <span class="constant">File</span>.directory?(downloads_path)
339
- <span class="constant">Dir</span>.foreach(downloads_path) { |f| fn = <span class="constant">File</span>.join(downloads_path, f); <span class="constant">File</span>.delete(fn) <span class="keyword">if</span> f != <span class="string">'.'</span> &amp;&amp; f != <span class="string">'..'</span> }
340
- <span class="keyword">else</span>
341
- <span class="constant">Dir::</span>mkdir(downloads_path)
342
- <span class="keyword">end</span>
339
+ <div class="content"><div class='highlight'><pre> out_file.write(<span class="string">"<span class="subst">#{settings.client_id}</span> "</span>)
340
+ out_file.write(<span class="string">"<span class="subst">#{settings.private_key}</span> "</span>)
341
+ out_file.write(<span class="string">"<span class="subst">#{settings.email}</span>"</span>)
342
+ out_file.close
343
+ <span class="keyword">end</span>
343
344
 
344
- <span class="keyword">begin</span></pre></div></div>
345
+ guid = <span class="keyword">nil</span>
346
+ url = <span class="keyword">nil</span>
347
+
348
+ <span class="keyword">case</span> settings.source
349
+ <span class="keyword">when</span> <span class="string">'form'</span>
350
+ id = settings.form_guid</pre></div></div>
345
351
 
346
352
  </li>
347
353
 
@@ -352,11 +358,11 @@
352
358
  <div class="pilwrap ">
353
359
  <a class="pilcrow" href="#section-19">&#182;</a>
354
360
  </div>
355
- <p>Check required variables</p>
361
+ <p>Create new Form with guid</p>
356
362
 
357
363
  </div>
358
364
 
359
- <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>
365
+ <div class="content"><div class='highlight'><pre> form = <span class="constant">GroupDocs::Signature::Form</span>.get!(id)</pre></div></div>
360
366
 
361
367
  </li>
362
368
 
@@ -367,14 +373,19 @@
367
373
  <div class="pilwrap ">
368
374
  <a class="pilcrow" href="#section-20">&#182;</a>
369
375
  </div>
370
- <p>Configure your access to API server.</p>
376
+ <p>Publish the Form</p>
371
377
 
372
378
  </div>
373
379
 
374
- <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
375
- groupdocs.client_id = settings.client_id
376
- groupdocs.private_key = settings.private_key
377
- <span class="keyword">end</span></pre></div></div>
380
+ <div class="content"><div class='highlight'><pre> form.publish!({<span class="symbol">:callbackUrl</span> =&gt; settings.callback})
381
+ raise form.to_yaml
382
+ guid = settings.form_guid
383
+
384
+ <span class="keyword">when</span> <span class="string">'template'</span>
385
+
386
+ form = <span class="constant">GroupDocs::Signature::Form</span>.new
387
+ form.name = <span class="string">'test'</span>
388
+ form.notifyOwnerOnSign = <span class="keyword">true</span></pre></div></div>
378
389
 
379
390
  </li>
380
391
 
@@ -385,12 +396,11 @@
385
396
  <div class="pilwrap ">
386
397
  <a class="pilcrow" href="#section-21">&#182;</a>
387
398
  </div>
388
- <p>Write client and private key to the file for callback job</p>
399
+ <p>Create new Form with template</p>
389
400
 
390
401
  </div>
391
402
 
392
- <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.callback[<span class="number">0</span>]
393
- out_file = <span class="constant">File</span>.new(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/user_info.txt"</span>, <span class="string">'w'</span>)</pre></div></div>
403
+ <div class="content"><div class='highlight'><pre> guid = form.create!({ <span class="symbol">:templateId</span> =&gt; settings.template_guid})</pre></div></div>
394
404
 
395
405
  </li>
396
406
 
@@ -401,20 +411,13 @@
401
411
  <div class="pilwrap ">
402
412
  <a class="pilcrow" href="#section-22">&#182;</a>
403
413
  </div>
404
- <p>white space is required</p>
414
+ <p>Publish the Form</p>
405
415
 
406
416
  </div>
407
417
 
408
- <div class="content"><div class='highlight'><pre> out_file.write(<span class="string">"<span class="subst">#{settings.client_id}</span> "</span>)
409
- out_file.write(<span class="string">"<span class="subst">#{settings.private_key}</span>"</span>)
410
- out_file.write(<span class="string">"<span class="subst">#{settings.email}</span>"</span>)
411
- out_file.close
412
- <span class="keyword">end</span>
413
-
414
- iframe = <span class="string">''</span>
418
+ <div class="content"><div class='highlight'><pre> form.publish!({<span class="symbol">:callbackUrl</span> =&gt; settings.callback})
415
419
 
416
- <span class="keyword">case</span> settings.source
417
- <span class="keyword">when</span> <span class="string">'form'</span></pre></div></div>
420
+ <span class="keyword">end</span></pre></div></div>
418
421
 
419
422
  </li>
420
423
 
@@ -425,11 +428,19 @@
425
428
  <div class="pilwrap ">
426
429
  <a class="pilcrow" href="#section-23">&#182;</a>
427
430
  </div>
428
- <p>Create new Form with guid</p>
431
+ <p>Get url from request</p>
429
432
 
430
433
  </div>
431
434
 
432
- <div class="content"><div class='highlight'><pre> form = <span class="constant">GroupDocs::Signature::Form</span>.new({<span class="symbol">:guid</span> =&gt; settings.form_guid})</pre></div></div>
435
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.base_path
436
+
437
+ <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
438
+ url = <span class="string">"http://stage-apps-groupdocs.dynabic.com/signature2/forms/signembed/ <span class="subst">#{guid}</span>"</span>
439
+ <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
440
+ url = <span class="string">"http://dev-apps-groupdocs.dynabic.com/signature2/forms/signembed/ <span class="subst">#{guid}</span>"</span>
441
+ <span class="keyword">else</span>
442
+ url = <span class="string">"https://apps.groupdocs.com/signature2/forms/signembed/ <span class="subst">#{guid}</span>"</span>
443
+ <span class="keyword">end</span></pre></div></div>
433
444
 
434
445
  </li>
435
446
 
@@ -440,51 +451,12 @@
440
451
  <div class="pilwrap ">
441
452
  <a class="pilcrow" href="#section-24">&#182;</a>
442
453
  </div>
443
- <p>Publish the Form</p>
444
-
445
- </div>
446
-
447
- <div class="content"><div class='highlight'><pre> form.publish!({<span class="symbol">:callbackUrl</span> =&gt; settings.callback})
448
-
449
- iframe = <span class="string">"https://apps.groupdocs.com/signature2/forms/signembed/ <span class="subst">#{settings.form_guid}</span>"</span>;
450
- <span class="keyword">when</span> <span class="string">'template'</span>
451
-
452
- form = <span class="constant">GroupDocs::Signature::Form</span>.new
453
- form.name = <span class="string">'test'</span>
454
- form.notifyOwnerOnSign = <span class="keyword">true</span></pre></div></div>
455
-
456
- </li>
457
-
458
-
459
- <li id="section-25">
460
- <div class="annotation">
461
-
462
- <div class="pilwrap ">
463
- <a class="pilcrow" href="#section-25">&#182;</a>
464
- </div>
465
- <p>Create new Form with template</p>
466
-
467
- </div>
468
-
469
- <div class="content"><div class='highlight'><pre> signature = form.create!({ <span class="symbol">:templateId</span> =&gt; settings.template_guid})</pre></div></div>
470
-
471
- </li>
472
-
473
-
474
- <li id="section-26">
475
- <div class="annotation">
476
-
477
- <div class="pilwrap ">
478
- <a class="pilcrow" href="#section-26">&#182;</a>
479
- </div>
480
- <p>Publish the Form</p>
454
+ <p>Add the signature to url the request</p>
481
455
 
482
456
  </div>
483
457
 
484
- <div class="content"><div class='highlight'><pre> form.publish!({<span class="symbol">:callbackUrl</span> =&gt; settings.callback})
485
-
486
- iframe = <span class="string">"&lt;iframe width='100%' height='600' frameborder='0' src='https://apps.groupdocs.com/signature2/forms/signembed/ <span class="subst">#{signature}</span>'&gt;&lt;/iframe&gt;"</span>
487
- <span class="keyword">end</span>
458
+ <div class="content"><div class='highlight'><pre> iframe = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> =&gt; url).prepare_and_sign_url
459
+ iframe = <span class="string">"&lt;iframe width='100%' height='600' frameborder='0' src='<span class="subst">#{iframe}</span>'&gt;&lt;/iframe&gt;"</span>
488
460
 
489
461
  <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e
490
462
  err = e.message
@@ -493,11 +465,11 @@
493
465
  </li>
494
466
 
495
467
 
496
- <li id="section-27">
468
+ <li id="section-25">
497
469
  <div class="annotation">
498
470
 
499
471
  <div class="pilwrap ">
500
- <a class="pilcrow" href="#section-27">&#182;</a>
472
+ <a class="pilcrow" href="#section-25">&#182;</a>
501
473
  </div>
502
474
  <p>Set variables for template</p>
503
475
 
@@ -63,13 +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">:client_id</span>]
67
- set <span class="symbol">:private_key</span>, params[<span class="symbol">:private_key</span>]
68
- set <span class="symbol">:url_1</span>, params[<span class="symbol">:url_1</span>]
69
- set <span class="symbol">:url_2</span>, params[<span class="symbol">:url_2</span>]
70
- set <span class="symbol">:url_3</span>, params[<span class="symbol">:url_3</span>]
71
- set <span class="symbol">:url_4</span>, params[<span class="symbol">:url_4</span>]
72
- set <span class="symbol">:url_5</span>, params[<span class="symbol">:url_5</span>]
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
+ set <span class="symbol">:url_1</span>, params[<span class="symbol">:url1</span>]
69
+ set <span class="symbol">:url_2</span>, params[<span class="symbol">:url2</span>]
70
+ set <span class="symbol">:url_3</span>, params[<span class="symbol">:url3</span>]
71
+ set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]
73
72
 
74
73
  <span class="keyword">begin</span></pre></div></div>
75
74
 
@@ -86,12 +85,9 @@
86
85
 
87
86
  </div>
88
87
 
89
- <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_1.empty? <span class="keyword">or</span> settings.url_2.empty? <span class="keyword">or</span> settings.url_3.empty? <span class="keyword">or</span> settings.url_4.empty? <span class="keyword">or</span> settings.url_5.empty?
90
-
91
- <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
92
- groupdocs.client_id = settings.client_id
93
- groupdocs.private_key = settings.private_key
94
- <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? <span class="keyword">or</span> settings.url_1.empty? <span class="keyword">or</span> settings.url_2.empty? <span class="keyword">or</span> settings.url_3.empty?
89
+
90
+ <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>
95
91
 
96
92
  </li>
97
93
 
@@ -102,11 +98,13 @@
102
98
  <div class="pilwrap ">
103
99
  <a class="pilcrow" href="#section-5">&#182;</a>
104
100
  </div>
105
- <p>Create Array from variables</p>
101
+ <p>Configure your access to API server</p>
106
102
 
107
103
  </div>
108
104
 
109
- <div class="content"><div class='highlight'><pre> url = [settings.url_1, settings.url_2, settings.url_3, settings.url_4, settings.url_5 ]</pre></div></div>
105
+ <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
106
+ groupdocs.client_id = settings.client_id
107
+ groupdocs.private_key = settings.private_key</pre></div></div>
110
108
 
111
109
  </li>
112
110
 
@@ -117,11 +115,12 @@
117
115
  <div class="pilwrap ">
118
116
  <a class="pilcrow" href="#section-6">&#182;</a>
119
117
  </div>
120
- <p>Create Hash with the options for job. :status=&gt; -1 means the Draft status of the job</p>
118
+ <p>Optionally specify API server and version</p>
121
119
 
122
120
  </div>
123
121
 
124
- <div class="content"><div class='highlight'><pre> options = {<span class="symbol">:actions</span> =&gt; [<span class="symbol">:convert</span>, <span class="symbol">:combine</span>], <span class="symbol">:out_formats</span> =&gt; [<span class="string">'pdf'</span>], <span class="symbol">:status</span> =&gt; -<span class="number">1</span>, <span class="symbol">:name</span> =&gt; <span class="string">'sample'</span>}</pre></div></div>
122
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
123
+ <span class="keyword">end</span></pre></div></div>
125
124
 
126
125
  </li>
127
126
 
@@ -132,11 +131,11 @@
132
131
  <div class="pilwrap ">
133
132
  <a class="pilcrow" href="#section-7">&#182;</a>
134
133
  </div>
135
- <p>Create Job with provided options with Draft status (Sheduled job)</p>
134
+ <p>Create Array from variables</p>
136
135
 
137
136
  </div>
138
137
 
139
- <div class="content"><div class='highlight'><pre> job = <span class="constant">GroupDocs::Job</span>.create!(options)</pre></div></div>
138
+ <div class="content"><div class='highlight'><pre> url = [settings.url_1, settings.url_2, settings.url_3 ]</pre></div></div>
140
139
 
141
140
  </li>
142
141
 
@@ -147,6 +146,36 @@
147
146
  <div class="pilwrap ">
148
147
  <a class="pilcrow" href="#section-8">&#182;</a>
149
148
  </div>
149
+ <p>Create Hash with the options for job. :status=&gt; -1 means the Draft status of the job</p>
150
+
151
+ </div>
152
+
153
+ <div class="content"><div class='highlight'><pre> options = {<span class="symbol">:actions</span> =&gt; [<span class="symbol">:convert</span>, <span class="symbol">:combine</span>], <span class="symbol">:out_formats</span> =&gt; [<span class="string">'pdf'</span>], <span class="symbol">:status</span> =&gt; -<span class="number">1</span>, <span class="symbol">:name</span> =&gt; <span class="string">'sample'</span>}</pre></div></div>
154
+
155
+ </li>
156
+
157
+
158
+ <li id="section-9">
159
+ <div class="annotation">
160
+
161
+ <div class="pilwrap ">
162
+ <a class="pilcrow" href="#section-9">&#182;</a>
163
+ </div>
164
+ <p>Create Job with provided options with Draft status (Sheduled job)</p>
165
+
166
+ </div>
167
+
168
+ <div class="content"><div class='highlight'><pre> job = <span class="constant">GroupDocs::Job</span>.create!(options)</pre></div></div>
169
+
170
+ </li>
171
+
172
+
173
+ <li id="section-10">
174
+ <div class="annotation">
175
+
176
+ <div class="pilwrap ">
177
+ <a class="pilcrow" href="#section-10">&#182;</a>
178
+ </div>
150
179
  <p>Upload documents to GroupDocs Storage by url and add the documents to previously created Job</p>
151
180
 
152
181
  </div>
@@ -159,51 +188,97 @@
159
188
  </li>
160
189
 
161
190
 
162
- <li id="section-9">
191
+ <li id="section-11">
163
192
  <div class="annotation">
164
193
 
165
194
  <div class="pilwrap ">
166
- <a class="pilcrow" href="#section-9">&#182;</a>
195
+ <a class="pilcrow" href="#section-11">&#182;</a>
167
196
  </div>
168
197
  <p>Update the Job with new status. :status =&gt; &#39;0&#39; mean Active status of the job (Start the job)</p>
169
198
 
170
199
  </div>
171
200
 
172
- <div class="content"><div class='highlight'><pre> job.update!({<span class="symbol">:status</span> =&gt; <span class="string">'0'</span>})
173
- sleep(<span class="number">5</span>)</pre></div></div>
201
+ <div class="content"><div class='highlight'><pre> id = job.update!({<span class="symbol">:status</span> =&gt; <span class="string">'0'</span>})
202
+
203
+ i = <span class="number">1</span>
204
+
205
+ <span class="keyword">while</span> i&lt;<span class="number">5</span> <span class="keyword">do</span>
206
+ sleep(<span class="number">5</span>)
207
+ job = <span class="constant">GroupDocs::Job</span>.get!(id[<span class="symbol">:job_id</span>])
208
+ <span class="keyword">break</span> <span class="keyword">if</span> job.status == <span class="symbol">:archived</span>
209
+ i = i + <span class="number">1</span>
210
+ <span class="keyword">end</span></pre></div></div>
174
211
 
175
212
  </li>
176
213
 
177
214
 
178
- <li id="section-10">
215
+ <li id="section-12">
179
216
  <div class="annotation">
180
217
 
181
218
  <div class="pilwrap ">
182
- <a class="pilcrow" href="#section-10">&#182;</a>
219
+ <a class="pilcrow" href="#section-12">&#182;</a>
183
220
  </div>
184
221
  <p>Get the document into Pdf format</p>
185
222
 
186
223
  </div>
187
224
 
188
225
  <div class="content"><div class='highlight'><pre> file = job.documents!()
189
- sleep(<span class="number">7</span>)
226
+
190
227
  document = file[<span class="symbol">:outputs</span>]</pre></div></div>
191
228
 
192
229
  </li>
193
230
 
194
231
 
195
- <li id="section-11">
232
+ <li id="section-13">
196
233
  <div class="annotation">
197
234
 
198
235
  <div class="pilwrap ">
199
- <a class="pilcrow" href="#section-11">&#182;</a>
236
+ <a class="pilcrow" href="#section-13">&#182;</a>
200
237
  </div>
201
238
  <p>Set iframe with document GUID or raise an error</p>
202
239
 
203
240
  </div>
204
241
 
205
- <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> document
206
- iframe = <span class="string">"&lt;iframe width='100%' height='600' frameborder='0' src='https://apps.groupdocs.com/document-viewer/embed/<span class="subst">#{document[<span class="number">0</span>].guid}</span>'&gt;&lt;/iframe&gt;"</span>
242
+ <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> document</pre></div></div>
243
+
244
+ </li>
245
+
246
+
247
+ <li id="section-14">
248
+ <div class="annotation">
249
+
250
+ <div class="pilwrap ">
251
+ <a class="pilcrow" href="#section-14">&#182;</a>
252
+ </div>
253
+ <p>Get url from request</p>
254
+
255
+ </div>
256
+
257
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.base_path
258
+
259
+ <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
260
+ url = <span class="string">"http://stage-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{document[<span class="number">0</span>].guid}</span>"</span>
261
+ <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
262
+ url = <span class="string">"http://dev-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{document[<span class="number">0</span>].guid}</span>"</span>
263
+ <span class="keyword">else</span>
264
+ url = <span class="string">"https://apps.groupdocs.com/document-viewer/embed/<span class="subst">#{document[<span class="number">0</span>].guid}</span>"</span>
265
+ <span class="keyword">end</span></pre></div></div>
266
+
267
+ </li>
268
+
269
+
270
+ <li id="section-15">
271
+ <div class="annotation">
272
+
273
+ <div class="pilwrap ">
274
+ <a class="pilcrow" href="#section-15">&#182;</a>
275
+ </div>
276
+ <p>Add the signature in url</p>
277
+
278
+ </div>
279
+
280
+ <div class="content"><div class='highlight'><pre> iframe = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> =&gt; url).prepare_and_sign_url
281
+ iframe = <span class="string">"&lt;iframe width='100%' height='600' frameborder='0' src='<span class="subst">#{iframe}</span>'&gt;&lt;/iframe&gt;"</span>
207
282
  <span class="keyword">else</span>
208
283
  raise <span class="string">'File was not converted'</span>
209
284
  <span class="keyword">end</span>
@@ -214,11 +289,11 @@
214
289
  </li>
215
290
 
216
291
 
217
- <li id="section-12">
292
+ <li id="section-16">
218
293
  <div class="annotation">
219
294
 
220
295
  <div class="pilwrap ">
221
- <a class="pilcrow" href="#section-12">&#182;</a>
296
+ <a class="pilcrow" href="#section-16">&#182;</a>
222
297
  </div>
223
298
  <p>Set variables for template</p>
224
299