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
@@ -59,11 +59,12 @@
59
59
  <div class="pilwrap ">
60
60
  <a class="pilcrow" href="#section-3">&#182;</a>
61
61
  </div>
62
- <p>set variables</p>
62
+ <p>Set variables</p>
63
63
 
64
64
  </div>
65
65
 
66
66
  <div class="content"><div class='highlight'><pre> set <span class="symbol">:fileId</span>, params[<span class="symbol">:fileId</span>]
67
+ set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]
67
68
 
68
69
  <span class="keyword">begin</span></pre></div></div>
69
70
 
@@ -76,11 +77,13 @@
76
77
  <div class="pilwrap ">
77
78
  <a class="pilcrow" href="#section-4">&#182;</a>
78
79
  </div>
79
- <p>check required variables</p>
80
+ <p>Check required variables</p>
80
81
 
81
82
  </div>
82
83
 
83
- <div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.fileId.empty?</pre></div></div>
84
+ <div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.fileId.empty?
85
+
86
+ <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>
84
87
 
85
88
  </li>
86
89
 
@@ -91,11 +94,82 @@
91
94
  <div class="pilwrap ">
92
95
  <a class="pilcrow" href="#section-5">&#182;</a>
93
96
  </div>
94
- <p>construct result iframe</p>
97
+ <p>Configure your access to API server</p>
98
+
99
+ </div>
100
+
101
+ <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
102
+ groupdocs.client_id = settings.client_id
103
+ groupdocs.private_key = settings.private_key</pre></div></div>
104
+
105
+ </li>
106
+
107
+
108
+ <li id="section-6">
109
+ <div class="annotation">
110
+
111
+ <div class="pilwrap ">
112
+ <a class="pilcrow" href="#section-6">&#182;</a>
113
+ </div>
114
+ <p>Optionally specify API server and version</p>
115
+
116
+ </div>
117
+
118
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
119
+ <span class="keyword">end</span></pre></div></div>
120
+
121
+ </li>
122
+
123
+
124
+ <li id="section-7">
125
+ <div class="annotation">
126
+
127
+ <div class="pilwrap ">
128
+ <a class="pilcrow" href="#section-7">&#182;</a>
129
+ </div>
130
+ <p>Get url from request</p>
95
131
 
96
132
  </div>
97
133
 
98
- <div class="content"><div class='highlight'><pre> iframe = <span class="string">"&lt;iframe src='https://apps.groupdocs.com/assembly2/questionnaire-assembly/<span class="subst">#{settings.fileId}</span>' frameborder='0' width='100%' height='600'&gt;&lt;/iframe&gt;"</span>
134
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.base_path
135
+
136
+ <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
137
+ url = <span class="string">"http://stage-apps-groupdocs.dynabic.com/assembly2/questionnaire-assembly/<span class="subst">#{settings.fileId}</span>"</span>
138
+ <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
139
+ url = <span class="string">"http://dev-apps-groupdocs.dynabic.com/assembly2/questionnaire-assembly/<span class="subst">#{settings.fileId}</span>"</span>
140
+ <span class="keyword">else</span>
141
+ url = <span class="string">"https://apps.groupdocs.com/assembly2/questionnaire-assembly/<span class="subst">#{settings.fileId}</span>"</span>
142
+ <span class="keyword">end</span></pre></div></div>
143
+
144
+ </li>
145
+
146
+
147
+ <li id="section-8">
148
+ <div class="annotation">
149
+
150
+ <div class="pilwrap ">
151
+ <a class="pilcrow" href="#section-8">&#182;</a>
152
+ </div>
153
+ <p>Add the signature to the url request</p>
154
+
155
+ </div>
156
+
157
+ <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</pre></div></div>
158
+
159
+ </li>
160
+
161
+
162
+ <li id="section-9">
163
+ <div class="annotation">
164
+
165
+ <div class="pilwrap ">
166
+ <a class="pilcrow" href="#section-9">&#182;</a>
167
+ </div>
168
+ <p>Construct result iframe</p>
169
+
170
+ </div>
171
+
172
+ <div class="content"><div class='highlight'><pre> iframe = <span class="string">"&lt;iframe src='<span class="subst">#{iframe}</span>' frameborder='0' width='100%' height='600'&gt;&lt;/iframe&gt;"</span>
99
173
 
100
174
  <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e
101
175
  err = e.message
@@ -104,11 +178,11 @@
104
178
  </li>
105
179
 
106
180
 
107
- <li id="section-6">
181
+ <li id="section-10">
108
182
  <div class="annotation">
109
183
 
110
184
  <div class="pilwrap ">
111
- <a class="pilcrow" href="#section-6">&#182;</a>
185
+ <a class="pilcrow" href="#section-10">&#182;</a>
112
186
  </div>
113
187
  <p>set variables for template</p>
114
188
 
@@ -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">:client_id</span>]
67
- set <span class="symbol">:private_key</span>, params[<span class="symbol">:private_key</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
68
  set <span class="symbol">:file</span>, params[<span class="symbol">:file</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
 
@@ -82,7 +83,9 @@
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.file.<span class="keyword">nil</span>?</pre></div></div>
86
+ <div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.client_id.empty? <span class="keyword">or</span> settings.private_key.empty? <span class="keyword">or</span> settings.file.<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">&#182;</a>
95
98
  </div>
96
- <p>construct path</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> filepath = <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>
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,11 +113,12 @@
108
113
  <div class="pilwrap ">
109
114
  <a class="pilcrow" href="#section-6">&#182;</a>
110
115
  </div>
111
- <p>open file</p>
116
+ <p>Optionally specify API server and version</p>
112
117
 
113
118
  </div>
114
119
 
115
- <div class="content"><div class='highlight'><pre> <span class="constant">File</span>.open(filepath, <span class="string">'wb'</span>) { |f| f.write(params[<span class="symbol">:file</span>][<span class="symbol">:tempfile</span>].read) }</pre></div></div>
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>
116
122
 
117
123
  </li>
118
124
 
@@ -123,11 +129,11 @@
123
129
  <div class="pilwrap ">
124
130
  <a class="pilcrow" href="#section-7">&#182;</a>
125
131
  </div>
126
- <p>upload file</p>
132
+ <p>construct path</p>
127
133
 
128
134
  </div>
129
135
 
130
- <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload!(filepath, {}, <span class="symbol">client_id:</span> settings.client_id, <span class="symbol">private_key:</span> settings.private_key)</pre></div></div>
136
+ <div class="content"><div class='highlight'><pre> filepath = <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>
131
137
 
132
138
  </li>
133
139
 
@@ -138,11 +144,11 @@
138
144
  <div class="pilwrap ">
139
145
  <a class="pilcrow" href="#section-8">&#182;</a>
140
146
  </div>
141
- <p>compress file</p>
147
+ <p>open file</p>
142
148
 
143
149
  </div>
144
150
 
145
- <div class="content"><div class='highlight'><pre> file.compress!({<span class="symbol">client_id:</span> settings.client_id, <span class="symbol">private_key:</span> settings.private_key})</pre></div></div>
151
+ <div class="content"><div class='highlight'><pre> <span class="constant">File</span>.open(filepath, <span class="string">'wb'</span>) { |f| f.write(params[<span class="symbol">:file</span>][<span class="symbol">:tempfile</span>].read) }</pre></div></div>
146
152
 
147
153
  </li>
148
154
 
@@ -153,12 +159,94 @@
153
159
  <div class="pilwrap ">
154
160
  <a class="pilcrow" href="#section-9">&#182;</a>
155
161
  </div>
162
+ <p>upload file</p>
163
+
164
+ </div>
165
+
166
+ <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload!(filepath, {})</pre></div></div>
167
+
168
+ </li>
169
+
170
+
171
+ <li id="section-10">
172
+ <div class="annotation">
173
+
174
+ <div class="pilwrap ">
175
+ <a class="pilcrow" href="#section-10">&#182;</a>
176
+ </div>
177
+ <p>compress file</p>
178
+
179
+ </div>
180
+
181
+ <div class="content"><div class='highlight'><pre> file.compress!()</pre></div></div>
182
+
183
+ </li>
184
+
185
+
186
+ <li id="section-11">
187
+ <div class="annotation">
188
+
189
+ <div class="pilwrap ">
190
+ <a class="pilcrow" href="#section-11">&#182;</a>
191
+ </div>
156
192
  <p>construct result messages</p>
157
193
 
158
194
  </div>
159
195
 
160
- <div class="content"><div class='highlight'><pre> massage = <span class="string">"&lt;p&gt;Archive created and saved successfully. Here you can see your &lt;strong&gt;<span class="subst">#{params[<span class="symbol">:file</span>][<span class="symbol">:filename</span>]}</span>&lt;/strong&gt; file in the GroupDocs Embedded Viewer.&lt;/p&gt;"</span>
161
- iframe = <span class="string">"&lt;iframe src='https://apps.groupdocs.com/document-viewer/Embed/<span class="subst">#{file.guid}</span>' frameborder='0' width='720' height='600'&gt;&lt;/iframe&gt;"</span>
196
+ <div class="content"><div class='highlight'><pre> massage = <span class="string">"&lt;p&gt;Archive created and saved successfully. Here you can see your &lt;strong&gt;<span class="subst">#{params[<span class="symbol">:file</span>][<span class="symbol">:filename</span>]}</span>&lt;/strong&gt; file in the GroupDocs Embedded Viewer.&lt;/p&gt;"</span></pre></div></div>
197
+
198
+ </li>
199
+
200
+
201
+ <li id="section-12">
202
+ <div class="annotation">
203
+
204
+ <div class="pilwrap ">
205
+ <a class="pilcrow" href="#section-12">&#182;</a>
206
+ </div>
207
+ <p>Get url from request</p>
208
+
209
+ </div>
210
+
211
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.base_path
212
+
213
+ <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
214
+ url = <span class="string">"http://stage-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{file.guid}</span>"</span>
215
+ <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
216
+ url = <span class="string">"http://dev-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{file.guid}</span>"</span>
217
+ <span class="keyword">else</span>
218
+ url = <span class="string">"https://apps.groupdocs.com/document-viewer/embed/<span class="subst">#{file.guid}</span>"</span>
219
+ <span class="keyword">end</span></pre></div></div>
220
+
221
+ </li>
222
+
223
+
224
+ <li id="section-13">
225
+ <div class="annotation">
226
+
227
+ <div class="pilwrap ">
228
+ <a class="pilcrow" href="#section-13">&#182;</a>
229
+ </div>
230
+ <p>Add the signature to the url request</p>
231
+
232
+ </div>
233
+
234
+ <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</pre></div></div>
235
+
236
+ </li>
237
+
238
+
239
+ <li id="section-14">
240
+ <div class="annotation">
241
+
242
+ <div class="pilwrap ">
243
+ <a class="pilcrow" href="#section-14">&#182;</a>
244
+ </div>
245
+ <p>Construct result iframe</p>
246
+
247
+ </div>
248
+
249
+ <div class="content"><div class='highlight'><pre> iframe = <span class="string">"&lt;iframe src='<span class="subst">#{iframe}</span>' frameborder='0' width='100%' height='600'&gt;&lt;/iframe&gt;"</span>
162
250
 
163
251
  <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e
164
252
  err = e.message
@@ -167,11 +255,11 @@
167
255
  </li>
168
256
 
169
257
 
170
- <li id="section-10">
258
+ <li id="section-15">
171
259
  <div class="annotation">
172
260
 
173
261
  <div class="pilwrap ">
174
- <a class="pilcrow" href="#section-10">&#182;</a>
262
+ <a class="pilcrow" href="#section-15">&#182;</a>
175
263
  </div>
176
264
  <p>set variables for template</p>
177
265
 
@@ -286,13 +286,14 @@
286
286
 
287
287
  </div>
288
288
 
289
- <div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:client_id</span>]
290
- set <span class="symbol">:private_key</span>, params[<span class="symbol">:private_key</span>]
289
+ <div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:clientId</span>]
290
+ set <span class="symbol">:private_key</span>, params[<span class="symbol">:privateKey</span>]
291
291
  set <span class="symbol">:source</span>, params[<span class="symbol">:source</span>]
292
292
  set <span class="symbol">:file_id</span>, params[<span class="symbol">:fileId</span>]
293
293
  set <span class="symbol">:url</span>, params[<span class="symbol">:url</span>]
294
- set <span class="symbol">:convert_type</span>, params[<span class="symbol">:convert_type</span>]
295
- set <span class="symbol">:callback</span>, params[<span class="symbol">:callback</span>]</pre></div></div>
294
+ set <span class="symbol">:convert_type</span>, params[<span class="symbol">:convertType</span>]
295
+ set <span class="symbol">:callback</span>, params[<span class="symbol">:callback</span>]
296
+ set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]</pre></div></div>
296
297
 
297
298
  </li>
298
299
 
@@ -343,7 +344,11 @@
343
344
 
344
345
  </div>
345
346
 
346
- <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>
347
+ <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?
348
+
349
+ <span class="keyword">if</span> settings.base_path.empty? <span class="keyword">then</span>
350
+ settings.base_path = <span class="string">'https://api.groupdocs.com'</span>
351
+ <span class="keyword">end</span></pre></div></div>
347
352
 
348
353
  </li>
349
354
 
@@ -354,6 +359,39 @@
354
359
  <div class="pilwrap ">
355
360
  <a class="pilcrow" href="#section-20">&#182;</a>
356
361
  </div>
362
+ <p>Configure your access to API server</p>
363
+
364
+ </div>
365
+
366
+ <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
367
+ groupdocs.client_id = settings.client_id
368
+ groupdocs.private_key = settings.private_key</pre></div></div>
369
+
370
+ </li>
371
+
372
+
373
+ <li id="section-21">
374
+ <div class="annotation">
375
+
376
+ <div class="pilwrap ">
377
+ <a class="pilcrow" href="#section-21">&#182;</a>
378
+ </div>
379
+ <p>Optionally specify API server and version</p>
380
+
381
+ </div>
382
+
383
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
384
+ <span class="keyword">end</span></pre></div></div>
385
+
386
+ </li>
387
+
388
+
389
+ <li id="section-22">
390
+ <div class="annotation">
391
+
392
+ <div class="pilwrap ">
393
+ <a class="pilcrow" href="#section-22">&#182;</a>
394
+ </div>
357
395
  <p>Write client and private key to the file for callback job</p>
358
396
 
359
397
  </div>
@@ -364,11 +402,11 @@
364
402
  </li>
365
403
 
366
404
 
367
- <li id="section-21">
405
+ <li id="section-23">
368
406
  <div class="annotation">
369
407
 
370
408
  <div class="pilwrap ">
371
- <a class="pilcrow" href="#section-21">&#182;</a>
409
+ <a class="pilcrow" href="#section-23">&#182;</a>
372
410
  </div>
373
411
  <p>white space is required</p>
374
412
 
@@ -384,11 +422,11 @@
384
422
  </li>
385
423
 
386
424
 
387
- <li id="section-22">
425
+ <li id="section-24">
388
426
  <div class="annotation">
389
427
 
390
428
  <div class="pilwrap ">
391
- <a class="pilcrow" href="#section-22">&#182;</a>
429
+ <a class="pilcrow" href="#section-24">&#182;</a>
392
430
  </div>
393
431
  <p>get document by file GUID</p>
394
432
 
@@ -400,11 +438,11 @@
400
438
  </li>
401
439
 
402
440
 
403
- <li id="section-23">
441
+ <li id="section-25">
404
442
  <div class="annotation">
405
443
 
406
444
  <div class="pilwrap ">
407
- <a class="pilcrow" href="#section-23">&#182;</a>
445
+ <a class="pilcrow" href="#section-25">&#182;</a>
408
446
  </div>
409
447
  <p>Create instance of File</p>
410
448
 
@@ -416,11 +454,11 @@
416
454
  </li>
417
455
 
418
456
 
419
- <li id="section-24">
457
+ <li id="section-26">
420
458
  <div class="annotation">
421
459
 
422
460
  <div class="pilwrap ">
423
- <a class="pilcrow" href="#section-24">&#182;</a>
461
+ <a class="pilcrow" href="#section-26">&#182;</a>
424
462
  </div>
425
463
  <p>construct path</p>
426
464
 
@@ -431,11 +469,11 @@
431
469
  </li>
432
470
 
433
471
 
434
- <li id="section-25">
472
+ <li id="section-27">
435
473
  <div class="annotation">
436
474
 
437
475
  <div class="pilwrap ">
438
- <a class="pilcrow" href="#section-25">&#182;</a>
476
+ <a class="pilcrow" href="#section-27">&#182;</a>
439
477
  </div>
440
478
  <p>open file</p>
441
479
 
@@ -446,33 +484,33 @@
446
484
  </li>
447
485
 
448
486
 
449
- <li id="section-26">
487
+ <li id="section-28">
450
488
  <div class="annotation">
451
489
 
452
490
  <div class="pilwrap ">
453
- <a class="pilcrow" href="#section-26">&#182;</a>
491
+ <a class="pilcrow" href="#section-28">&#182;</a>
454
492
  </div>
455
493
  <p>make a request to API using client_id and private_key</p>
456
494
 
457
495
  </div>
458
496
 
459
- <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload!(file_path, {}, {<span class="symbol">:client_id</span> =&gt; settings.client_id, <span class="symbol">:private_key</span> =&gt; settings.private_key})
497
+ <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload!(file_path, {})
460
498
  <span class="keyword">when</span> <span class="string">'url'</span></pre></div></div>
461
499
 
462
500
  </li>
463
501
 
464
502
 
465
- <li id="section-27">
503
+ <li id="section-29">
466
504
  <div class="annotation">
467
505
 
468
506
  <div class="pilwrap ">
469
- <a class="pilcrow" href="#section-27">&#182;</a>
507
+ <a class="pilcrow" href="#section-29">&#182;</a>
470
508
  </div>
471
509
  <p>Upload file from defined url</p>
472
510
 
473
511
  </div>
474
512
 
475
- <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> =&gt; settings.client_id, <span class="symbol">:private_key</span> =&gt; settings.private_key})
513
+ <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload_web!(settings.url)
476
514
  <span class="keyword">else</span>
477
515
  raise <span class="string">'Wrong GUID source.'</span>
478
516
  <span class="keyword">end</span></pre></div></div>
@@ -480,11 +518,11 @@
480
518
  </li>
481
519
 
482
520
 
483
- <li id="section-28">
521
+ <li id="section-30">
484
522
  <div class="annotation">
485
523
 
486
524
  <div class="pilwrap ">
487
- <a class="pilcrow" href="#section-28">&#182;</a>
525
+ <a class="pilcrow" href="#section-30">&#182;</a>
488
526
  </div>
489
527
  <p>Raise exception if something went wrong</p>
490
528
 
@@ -495,11 +533,11 @@
495
533
  </li>
496
534
 
497
535
 
498
- <li id="section-29">
536
+ <li id="section-31">
499
537
  <div class="annotation">
500
538
 
501
539
  <div class="pilwrap ">
502
- <a class="pilcrow" href="#section-29">&#182;</a>
540
+ <a class="pilcrow" href="#section-31">&#182;</a>
503
541
  </div>
504
542
  <p>Make document from file</p>
505
543
 
@@ -510,26 +548,26 @@
510
548
  </li>
511
549
 
512
550
 
513
- <li id="section-30">
551
+ <li id="section-32">
514
552
  <div class="annotation">
515
553
 
516
554
  <div class="pilwrap ">
517
- <a class="pilcrow" href="#section-30">&#182;</a>
555
+ <a class="pilcrow" href="#section-32">&#182;</a>
518
556
  </div>
519
557
  <p>convert document</p>
520
558
 
521
559
  </div>
522
560
 
523
- <div class="content"><div class='highlight'><pre> convert = document.convert!(settings.convert_type, {<span class="symbol">:callback</span> =&gt; settings.callback}, {<span class="symbol">:client_id</span> =&gt; settings.client_id, <span class="symbol">:private_key</span> =&gt; settings.private_key})</pre></div></div>
561
+ <div class="content"><div class='highlight'><pre> convert = document.convert!(settings.convert_type, {<span class="symbol">:callback</span> =&gt; settings.callback})</pre></div></div>
524
562
 
525
563
  </li>
526
564
 
527
565
 
528
- <li id="section-31">
566
+ <li id="section-33">
529
567
  <div class="annotation">
530
568
 
531
569
  <div class="pilwrap ">
532
- <a class="pilcrow" href="#section-31">&#182;</a>
570
+ <a class="pilcrow" href="#section-33">&#182;</a>
533
571
  </div>
534
572
  <p>waite 10 seconds for while file converting</p>
535
573
 
@@ -540,26 +578,26 @@
540
578
  </li>
541
579
 
542
580
 
543
- <li id="section-32">
581
+ <li id="section-34">
544
582
  <div class="annotation">
545
583
 
546
584
  <div class="pilwrap ">
547
- <a class="pilcrow" href="#section-32">&#182;</a>
585
+ <a class="pilcrow" href="#section-34">&#182;</a>
548
586
  </div>
549
587
  <p>Get array of changes in document from job</p>
550
588
 
551
589
  </div>
552
590
 
553
- <div class="content"><div class='highlight'><pre> original_document = convert.documents!({<span class="symbol">:client_id</span> =&gt; settings.client_id, <span class="symbol">:private_key</span> =&gt; settings.private_key})</pre></div></div>
591
+ <div class="content"><div class='highlight'><pre> original_document = convert.documents!()</pre></div></div>
554
592
 
555
593
  </li>
556
594
 
557
595
 
558
- <li id="section-33">
596
+ <li id="section-35">
559
597
  <div class="annotation">
560
598
 
561
599
  <div class="pilwrap ">
562
- <a class="pilcrow" href="#section-33">&#182;</a>
600
+ <a class="pilcrow" href="#section-35">&#182;</a>
563
601
  </div>
564
602
  <p>Get converted document GUID</p>
565
603
 
@@ -570,18 +608,56 @@
570
608
  </li>
571
609
 
572
610
 
573
- <li id="section-34">
611
+ <li id="section-36">
574
612
  <div class="annotation">
575
613
 
576
614
  <div class="pilwrap ">
577
- <a class="pilcrow" href="#section-34">&#182;</a>
615
+ <a class="pilcrow" href="#section-36">&#182;</a>
616
+ </div>
617
+ <p>Get url from request</p>
618
+
619
+ </div>
620
+
621
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.base_path
622
+
623
+ <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
624
+ url = <span class="string">"http://stage-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{guid}</span>"</span>
625
+ <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
626
+ url = <span class="string">"http://dev-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{guid}</span>"</span>
627
+ <span class="keyword">else</span>
628
+ url = <span class="string">"https://apps.groupdocs.com/document-viewer/embed/<span class="subst">#{guid}</span>"</span>
629
+ <span class="keyword">end</span></pre></div></div>
630
+
631
+ </li>
632
+
633
+
634
+ <li id="section-37">
635
+ <div class="annotation">
636
+
637
+ <div class="pilwrap ">
638
+ <a class="pilcrow" href="#section-37">&#182;</a>
578
639
  </div>
579
640
  <p>Set iframe with document GUID or raise an error</p>
580
641
 
581
642
  </div>
582
643
 
583
- <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> guid
584
- iframe = <span class="string">"&lt;iframe width='100%' height='600' frameborder='0' src='https://apps.groupdocs.com/document-viewer/embed/<span class="subst">#{guid}</span>'&gt;&lt;/iframe&gt;"</span>
644
+ <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> guid</pre></div></div>
645
+
646
+ </li>
647
+
648
+
649
+ <li id="section-38">
650
+ <div class="annotation">
651
+
652
+ <div class="pilwrap ">
653
+ <a class="pilcrow" href="#section-38">&#182;</a>
654
+ </div>
655
+ <p>Add the signature to url request</p>
656
+
657
+ </div>
658
+
659
+ <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
660
+ iframe = <span class="string">"&lt;iframe width='100%' height='600' frameborder='0' src='<span class="subst">#{iframe}</span>'&gt;&lt;/iframe&gt;"</span>
585
661
  <span class="keyword">else</span>
586
662
  raise <span class="string">'File was not converted'</span>
587
663
  <span class="keyword">end</span>
@@ -593,11 +669,11 @@
593
669
  </li>
594
670
 
595
671
 
596
- <li id="section-35">
672
+ <li id="section-39">
597
673
  <div class="annotation">
598
674
 
599
675
  <div class="pilwrap ">
600
- <a class="pilcrow" href="#section-35">&#182;</a>
676
+ <a class="pilcrow" href="#section-39">&#182;</a>
601
677
  </div>
602
678
  <p>set variables for template</p>
603
679