groupdocs 1.5.8 → 1.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/CHANGELOG.md +9 -0
  2. data/examples/api-samples/public/docs/sample01.html +34 -15
  3. data/examples/api-samples/public/docs/sample02.html +36 -15
  4. data/examples/api-samples/public/docs/sample03.html +55 -34
  5. data/examples/api-samples/public/docs/sample04.html +33 -14
  6. data/examples/api-samples/public/docs/sample05.html +51 -33
  7. data/examples/api-samples/public/docs/sample06.html +86 -40
  8. data/examples/api-samples/public/docs/sample07.html +32 -13
  9. data/examples/api-samples/public/docs/sample08.html +39 -20
  10. data/examples/api-samples/public/docs/sample09.html +93 -39
  11. data/examples/api-samples/public/docs/sample10.html +39 -21
  12. data/examples/api-samples/public/docs/sample11.html +133 -88
  13. data/examples/api-samples/public/docs/sample12.html +33 -14
  14. data/examples/api-samples/public/docs/sample13.html +14 -7
  15. data/examples/api-samples/public/docs/sample14.html +37 -18
  16. data/examples/api-samples/public/docs/sample15.html +29 -10
  17. data/examples/api-samples/public/docs/sample16.html +58 -25
  18. data/examples/api-samples/public/docs/sample17.html +71 -38
  19. data/examples/api-samples/public/docs/sample18.html +98 -71
  20. data/examples/api-samples/public/docs/sample19.html +74 -42
  21. data/examples/api-samples/public/docs/sample20.html +39 -21
  22. data/examples/api-samples/public/docs/sample21.html +113 -69
  23. data/examples/api-samples/public/docs/sample22.html +89 -43
  24. data/examples/api-samples/public/docs/sample23.html +50 -32
  25. data/examples/api-samples/public/docs/sample24.html +64 -31
  26. data/examples/api-samples/public/docs/sample25.html +107 -60
  27. data/examples/api-samples/public/docs/sample26.html +29 -10
  28. data/examples/api-samples/public/docs/sample27.html +107 -61
  29. data/examples/api-samples/public/docs/sample28.html +158 -9
  30. data/examples/api-samples/public/docs/sample29.html +13 -8
  31. data/examples/api-samples/public/docs/sample30.html +34 -15
  32. data/examples/api-samples/public/docs/sample31.html +107 -76
  33. data/examples/api-samples/public/docs/sample32.html +104 -40
  34. data/examples/api-samples/public/docs/sample33.html +85 -36
  35. data/examples/api-samples/public/docs/sample34.html +30 -11
  36. data/examples/api-samples/public/docs/sample35.html +90 -27
  37. data/examples/api-samples/public/docs/sample36.html +36 -16
  38. data/examples/api-samples/public/docs/sample37.html +144 -265
  39. data/examples/api-samples/public/docs/sample38.html +113 -64
  40. data/examples/api-samples/public/docs/sample39.html +118 -45
  41. data/examples/api-samples/public/docs/sample40.html +81 -46
  42. data/examples/api-samples/public/docs/sample41.html +562 -90
  43. data/examples/api-samples/public/docs/sample42.html +94 -39
  44. data/examples/api-samples/public/docs/sample43.html +669 -0
  45. data/examples/api-samples/samples/sample01.rb +17 -10
  46. data/examples/api-samples/samples/sample02.rb +21 -12
  47. data/examples/api-samples/samples/sample03.rb +35 -29
  48. data/examples/api-samples/samples/sample04.rb +19 -12
  49. data/examples/api-samples/samples/sample05.rb +24 -17
  50. data/examples/api-samples/samples/sample06.rb +38 -32
  51. data/examples/api-samples/samples/sample07.rb +19 -12
  52. data/examples/api-samples/samples/sample08.rb +22 -15
  53. data/examples/api-samples/samples/sample09.rb +31 -29
  54. data/examples/api-samples/samples/sample10.rb +22 -15
  55. data/examples/api-samples/samples/sample11.rb +78 -81
  56. data/examples/api-samples/samples/sample12.rb +19 -21
  57. data/examples/api-samples/samples/sample13.rb +19 -21
  58. data/examples/api-samples/samples/sample14.rb +18 -12
  59. data/examples/api-samples/samples/sample15.rb +17 -10
  60. data/examples/api-samples/samples/sample16.rb +25 -17
  61. data/examples/api-samples/samples/sample17.rb +31 -23
  62. data/examples/api-samples/samples/sample18.rb +60 -55
  63. data/examples/api-samples/samples/sample19.rb +48 -42
  64. data/examples/api-samples/samples/sample20.rb +20 -13
  65. data/examples/api-samples/samples/sample21.rb +62 -54
  66. data/examples/api-samples/samples/sample22.rb +37 -31
  67. data/examples/api-samples/samples/sample23.rb +24 -17
  68. data/examples/api-samples/samples/sample24.rb +29 -22
  69. data/examples/api-samples/samples/sample25.rb +47 -40
  70. data/examples/api-samples/samples/sample26.rb +16 -9
  71. data/examples/api-samples/samples/sample27.rb +46 -39
  72. data/examples/api-samples/samples/sample28.rb +42 -11
  73. data/examples/api-samples/samples/sample29.rb +13 -8
  74. data/examples/api-samples/samples/sample30.rb +19 -12
  75. data/examples/api-samples/samples/sample31.rb +63 -58
  76. data/examples/api-samples/samples/sample32.rb +45 -42
  77. data/examples/api-samples/samples/sample33.rb +36 -25
  78. data/examples/api-samples/samples/sample34.rb +16 -9
  79. data/examples/api-samples/samples/sample35.rb +66 -53
  80. data/examples/api-samples/samples/sample36.rb +19 -15
  81. data/examples/api-samples/samples/sample37.rb +61 -99
  82. data/examples/api-samples/samples/sample38.rb +51 -43
  83. data/examples/api-samples/samples/sample39.rb +78 -62
  84. data/examples/api-samples/samples/sample40.rb +48 -38
  85. data/examples/api-samples/samples/sample41.rb +189 -67
  86. data/examples/api-samples/samples/sample42.rb +37 -29
  87. data/examples/api-samples/samples/sample43.rb +127 -0
  88. data/examples/api-samples/views/_others_samples.haml +4 -2
  89. data/examples/api-samples/views/index.haml +4 -2
  90. data/examples/api-samples/views/sample11.haml +1 -1
  91. data/examples/api-samples/views/sample28.haml +8 -0
  92. data/examples/api-samples/views/sample31.haml +1 -6
  93. data/examples/api-samples/views/sample39.haml +7 -2
  94. data/examples/api-samples/views/sample41.haml +78 -33
  95. data/examples/api-samples/views/sample42.haml +0 -1
  96. data/examples/api-samples/views/sample43.haml +91 -0
  97. data/lib/groupdocs/api/helpers/access_rights_helper.rb +6 -5
  98. data/lib/groupdocs/api/helpers/url_helper.rb +2 -1
  99. data/lib/groupdocs/document.rb +3 -3
  100. data/lib/groupdocs/version.rb +1 -1
  101. metadata +5 -2
@@ -85,10 +85,7 @@
85
85
 
86
86
  </div>
87
87
 
88
- <div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.client_id.empty? <span class="keyword">or</span> settings.private_key.empty? <span class="keyword">or</span> settings.guid.empty? <span class="keyword">or</span> settings.email.empty?
89
-
90
-
91
- <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>
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.guid.empty? <span class="keyword">or</span> settings.email.empty?</pre></div></div>
92
89
 
93
90
  </li>
94
91
 
@@ -99,6 +96,27 @@
99
96
  <div class="pilwrap ">
100
97
  <a class="pilcrow" href="#section-5">&#182;</a>
101
98
  </div>
99
+ <p>Prepare base path</p>
100
+
101
+ </div>
102
+
103
+ <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.base_path.empty?
104
+ base_path = <span class="string">'https://api.groupdocs.com'</span>
105
+ <span class="keyword">elsif</span> settings.base_path.match(<span class="string">'/v2.0'</span>)
106
+ base_path = settings.base_path.split(<span class="string">'/v2.0'</span>)[<span class="number">0</span>]
107
+ <span class="keyword">else</span>
108
+ base_path = settings.base_path
109
+ <span class="keyword">end</span></pre></div></div>
110
+
111
+ </li>
112
+
113
+
114
+ <li id="section-6">
115
+ <div class="annotation">
116
+
117
+ <div class="pilwrap ">
118
+ <a class="pilcrow" href="#section-6">&#182;</a>
119
+ </div>
102
120
  <p>Configure your access to API server</p>
103
121
 
104
122
  </div>
@@ -110,27 +128,27 @@
110
128
  </li>
111
129
 
112
130
 
113
- <li id="section-6">
131
+ <li id="section-7">
114
132
  <div class="annotation">
115
133
 
116
134
  <div class="pilwrap ">
117
- <a class="pilcrow" href="#section-6">&#182;</a>
135
+ <a class="pilcrow" href="#section-7">&#182;</a>
118
136
  </div>
119
137
  <p>Optionally specify API server and version</p>
120
138
 
121
139
  </div>
122
140
 
123
- <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
141
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
124
142
  <span class="keyword">end</span></pre></div></div>
125
143
 
126
144
  </li>
127
145
 
128
146
 
129
- <li id="section-7">
147
+ <li id="section-8">
130
148
  <div class="annotation">
131
149
 
132
150
  <div class="pilwrap ">
133
- <a class="pilcrow" href="#section-7">&#182;</a>
151
+ <a class="pilcrow" href="#section-8">&#182;</a>
134
152
  </div>
135
153
  <p>Get document by file GUID</p>
136
154
 
@@ -146,11 +164,11 @@
146
164
  </li>
147
165
 
148
166
 
149
- <li id="section-8">
167
+ <li id="section-9">
150
168
  <div class="annotation">
151
169
 
152
170
  <div class="pilwrap ">
153
- <a class="pilcrow" href="#section-8">&#182;</a>
171
+ <a class="pilcrow" href="#section-9">&#182;</a>
154
172
  </div>
155
173
  <p>Construct path</p>
156
174
 
@@ -161,11 +179,11 @@
161
179
  </li>
162
180
 
163
181
 
164
- <li id="section-9">
182
+ <li id="section-10">
165
183
  <div class="annotation">
166
184
 
167
185
  <div class="pilwrap ">
168
- <a class="pilcrow" href="#section-9">&#182;</a>
186
+ <a class="pilcrow" href="#section-10">&#182;</a>
169
187
  </div>
170
188
  <p>Open file</p>
171
189
 
@@ -176,11 +194,11 @@
176
194
  </li>
177
195
 
178
196
 
179
- <li id="section-10">
197
+ <li id="section-11">
180
198
  <div class="annotation">
181
199
 
182
200
  <div class="pilwrap ">
183
- <a class="pilcrow" href="#section-10">&#182;</a>
201
+ <a class="pilcrow" href="#section-11">&#182;</a>
184
202
  </div>
185
203
  <p>Make a request to API using client_id and private_key</p>
186
204
 
@@ -196,11 +214,11 @@
196
214
  </li>
197
215
 
198
216
 
199
- <li id="section-11">
217
+ <li id="section-12">
200
218
  <div class="annotation">
201
219
 
202
220
  <div class="pilwrap ">
203
- <a class="pilcrow" href="#section-11">&#182;</a>
221
+ <a class="pilcrow" href="#section-12">&#182;</a>
204
222
  </div>
205
223
  <p>Share document. Make a request to API using client_id and private_key</p>
206
224
 
@@ -211,11 +229,11 @@
211
229
  </li>
212
230
 
213
231
 
214
- <li id="section-12">
232
+ <li id="section-13">
215
233
  <div class="annotation">
216
234
 
217
235
  <div class="pilwrap ">
218
- <a class="pilcrow" href="#section-12">&#182;</a>
236
+ <a class="pilcrow" href="#section-13">&#182;</a>
219
237
  </div>
220
238
  <p>Result</p>
221
239
 
@@ -231,11 +249,11 @@
231
249
  </li>
232
250
 
233
251
 
234
- <li id="section-13">
252
+ <li id="section-14">
235
253
  <div class="annotation">
236
254
 
237
255
  <div class="pilwrap ">
238
- <a class="pilcrow" href="#section-13">&#182;</a>
256
+ <a class="pilcrow" href="#section-14">&#182;</a>
239
257
  </div>
240
258
  <p>Set variables for template</p>
241
259
 
@@ -85,9 +85,7 @@
85
85
 
86
86
  </div>
87
87
 
88
- <div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.client_id.empty? <span class="keyword">or</span> settings.private_key.empty? <span class="keyword">or</span> settings.file_id.empty? <span class="keyword">or</span> settings.annotation_type.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>
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.file_id.empty? <span class="keyword">or</span> settings.annotation_type.empty?</pre></div></div>
91
89
 
92
90
  </li>
93
91
 
@@ -98,6 +96,27 @@
98
96
  <div class="pilwrap ">
99
97
  <a class="pilcrow" href="#section-5">&#182;</a>
100
98
  </div>
99
+ <p>Prepare base path</p>
100
+
101
+ </div>
102
+
103
+ <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.base_path.empty?
104
+ base_path = <span class="string">'https://api.groupdocs.com'</span>
105
+ <span class="keyword">elsif</span> settings.base_path.match(<span class="string">'/v2.0'</span>)
106
+ base_path = settings.base_path.split(<span class="string">'/v2.0'</span>)[<span class="number">0</span>]
107
+ <span class="keyword">else</span>
108
+ base_path = settings.base_path
109
+ <span class="keyword">end</span></pre></div></div>
110
+
111
+ </li>
112
+
113
+
114
+ <li id="section-6">
115
+ <div class="annotation">
116
+
117
+ <div class="pilwrap ">
118
+ <a class="pilcrow" href="#section-6">&#182;</a>
119
+ </div>
101
120
  <p>Configure your access to API server</p>
102
121
 
103
122
  </div>
@@ -109,17 +128,17 @@
109
128
  </li>
110
129
 
111
130
 
112
- <li id="section-6">
131
+ <li id="section-7">
113
132
  <div class="annotation">
114
133
 
115
134
  <div class="pilwrap ">
116
- <a class="pilcrow" href="#section-6">&#182;</a>
135
+ <a class="pilcrow" href="#section-7">&#182;</a>
117
136
  </div>
118
137
  <p>Optionally specify API server and version</p>
119
138
 
120
139
  </div>
121
140
 
122
- <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
141
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
123
142
  <span class="keyword">end</span>
124
143
 
125
144
  <span class="keyword">if</span> settings.annotation_id != <span class="string">''</span>
@@ -130,11 +149,11 @@
130
149
  </li>
131
150
 
132
151
 
133
- <li id="section-7">
152
+ <li id="section-8">
134
153
  <div class="annotation">
135
154
 
136
155
  <div class="pilwrap ">
137
- <a class="pilcrow" href="#section-7">&#182;</a>
156
+ <a class="pilcrow" href="#section-8">&#182;</a>
138
157
  </div>
139
158
  <p>Remove annotation from document</p>
140
159
 
@@ -147,256 +166,282 @@
147
166
  </li>
148
167
 
149
168
 
150
- <li id="section-8">
169
+ <li id="section-9">
151
170
  <div class="annotation">
152
171
 
153
172
  <div class="pilwrap ">
154
- <a class="pilcrow" href="#section-8">&#182;</a>
173
+ <a class="pilcrow" href="#section-9">&#182;</a>
155
174
  </div>
156
175
  <p>Annotation types</p>
157
176
 
158
177
  </div>
159
178
 
160
- <div class="content"><div class='highlight'><pre> types = {<span class="symbol">:text</span> =&gt; <span class="string">"0"</span>, <span class="symbol">:area</span> =&gt; <span class="string">"1"</span>, <span class="symbol">:point</span> =&gt; <span class="string">"2"</span>}</pre></div></div>
179
+ <div class="content"><div class='highlight'><pre> types = {<span class="symbol">:text</span> =&gt; <span class="string">"0"</span>, <span class="symbol">:area</span> =&gt; <span class="string">"1"</span>, <span class="symbol">:point</span> =&gt; <span class="string">"2"</span>}</pre></div></div>
161
180
 
162
181
  </li>
163
182
 
164
183
 
165
- <li id="section-9">
184
+ <li id="section-10">
166
185
  <div class="annotation">
167
186
 
168
187
  <div class="pilwrap ">
169
- <a class="pilcrow" href="#section-9">&#182;</a>
188
+ <a class="pilcrow" href="#section-10">&#182;</a>
170
189
  </div>
171
190
  <p>Required parameters</p>
172
191
 
173
192
  </div>
174
193
 
175
- <div class="content"><div class='highlight'><pre> all_params = all_params = [<span class="string">'annotation_type'</span>, <span class="string">'box_x'</span>, <span class="string">'box_y'</span>, <span class="string">'text'</span>]</pre></div></div>
194
+ <div class="content"><div class='highlight'><pre> all_params = all_params = [<span class="string">'annotationType'</span>, <span class="string">'boxX'</span>, <span class="string">'boxY'</span>, <span class="string">'text'</span>]</pre></div></div>
176
195
 
177
196
  </li>
178
197
 
179
198
 
180
- <li id="section-10">
199
+ <li id="section-11">
181
200
  <div class="annotation">
182
201
 
183
202
  <div class="pilwrap ">
184
- <a class="pilcrow" href="#section-10">&#182;</a>
203
+ <a class="pilcrow" href="#section-11">&#182;</a>
185
204
  </div>
186
205
  <p>Added required parameters depends on annotation type [&#39;text&#39; or &#39;area&#39;]</p>
187
206
 
188
207
  </div>
189
208
 
190
- <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.annotation_type == <span class="string">'text'</span>
191
- all_params = all_params | [<span class="string">'box_width'</span>, <span class="string">'box_height'</span>, <span class="string">'annotationPosition_x'</span>, <span class="string">'annotationPosition_y'</span>, <span class="string">'range-position'</span>, <span class="string">'range-length'</span>]
192
- <span class="keyword">elsif</span> settings.annotation_type == <span class="string">'area'</span>
193
- all_params = all_params | [<span class="string">'box_width'</span>, <span class="string">'box_height'</span>]
194
- <span class="keyword">end</span></pre></div></div>
209
+ <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.annotation_type == <span class="string">'text'</span>
210
+ all_params = all_params | [<span class="string">'boxWidth'</span>, <span class="string">'boxHeight'</span>, <span class="string">'annotationPositionX'</span>, <span class="string">'annotationPositionY'</span>, <span class="string">'rangePosition'</span>, <span class="string">'rangeLength'</span>]
211
+ <span class="keyword">elsif</span> settings.annotation_type == <span class="string">'area'</span>
212
+ all_params = all_params | [<span class="string">'boxWidth'</span>, <span class="string">'boxHeight'</span>]
213
+ <span class="keyword">end</span></pre></div></div>
195
214
 
196
215
  </li>
197
216
 
198
217
 
199
- <li id="section-11">
218
+ <li id="section-12">
200
219
  <div class="annotation">
201
220
 
202
221
  <div class="pilwrap ">
203
- <a class="pilcrow" href="#section-11">&#182;</a>
222
+ <a class="pilcrow" href="#section-12">&#182;</a>
204
223
  </div>
205
224
  <p>Checking required parameters</p>
206
225
 
207
226
  </div>
208
227
 
209
- <div class="content"><div class='highlight'><pre> all_params.each <span class="keyword">do</span> |param|
210
- raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> params[param].empty?
211
- <span class="keyword">end</span></pre></div></div>
228
+ <div class="content"><div class='highlight'><pre> all_params.each <span class="keyword">do</span> |param|
229
+ raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> params[param].empty?
230
+ <span class="keyword">end</span></pre></div></div>
212
231
 
213
232
  </li>
214
233
 
215
234
 
216
- <li id="section-12">
235
+ <li id="section-13">
217
236
  <div class="annotation">
218
237
 
219
238
  <div class="pilwrap ">
220
- <a class="pilcrow" href="#section-12">&#182;</a>
239
+ <a class="pilcrow" href="#section-13">&#182;</a>
221
240
  </div>
222
241
  <p>Make a request to API using client_id and private_key</p>
223
242
 
224
243
  </div>
225
244
 
226
- <div class="content"><div class='highlight'><pre> files_list = <span class="constant">GroupDocs::Storage::Folder</span>.list!(<span class="string">'/'</span>, {})
245
+ <div class="content"><div class='highlight'><pre> files_list = <span class="constant">GroupDocs::Storage::Folder</span>.list!(<span class="string">'/'</span>, {})
227
246
 
228
- document = <span class="string">''</span></pre></div></div>
247
+ document = <span class="string">''</span></pre></div></div>
229
248
 
230
249
  </li>
231
250
 
232
251
 
233
- <li id="section-13">
252
+ <li id="section-14">
234
253
  <div class="annotation">
235
254
 
236
255
  <div class="pilwrap ">
237
- <a class="pilcrow" href="#section-13">&#182;</a>
256
+ <a class="pilcrow" href="#section-14">&#182;</a>
238
257
  </div>
239
258
  <p>Get document by file ID</p>
240
259
 
241
260
  </div>
242
261
 
243
- <div class="content"><div class='highlight'><pre> files_list.each <span class="keyword">do</span> |element|
244
- <span class="keyword">if</span> element.respond_to?(<span class="string">'guid'</span>) == <span class="keyword">true</span> <span class="keyword">and</span> element.guid == settings.file_id
245
- document = element
262
+ <div class="content"><div class='highlight'><pre> files_list.each <span class="keyword">do</span> |element|
263
+ <span class="keyword">if</span> element.respond_to?(<span class="string">'guid'</span>) == <span class="keyword">true</span> <span class="keyword">and</span> element.guid == settings.file_id
264
+ document = element
265
+ <span class="keyword">end</span>
246
266
  <span class="keyword">end</span>
247
- <span class="keyword">end</span>
248
267
 
249
- <span class="keyword">unless</span> document.instance_of? <span class="constant">String</span></pre></div></div>
268
+ <span class="keyword">unless</span> document.instance_of? <span class="constant">String</span></pre></div></div>
250
269
 
251
270
  </li>
252
271
 
253
272
 
254
- <li id="section-14">
273
+ <li id="section-15">
255
274
  <div class="annotation">
256
275
 
257
276
  <div class="pilwrap ">
258
- <a class="pilcrow" href="#section-14">&#182;</a>
277
+ <a class="pilcrow" href="#section-15">&#182;</a>
259
278
  </div>
260
279
  <p>Start create new annotation</p>
261
280
 
262
281
  </div>
263
282
 
264
- <div class="content"><div class='highlight'><pre> annotation = <span class="constant">GroupDocs::Document::Annotation</span>.new(<span class="symbol">document:</span> document.to_document)
283
+ <div class="content"><div class='highlight'><pre> annotation = <span class="constant">GroupDocs::Document::Annotation</span>.new(<span class="symbol">document:</span> document.to_document)
265
284
 
266
285
 
267
- info = <span class="keyword">nil</span></pre></div></div>
286
+ info = <span class="keyword">nil</span></pre></div></div>
268
287
 
269
288
  </li>
270
289
 
271
290
 
272
- <li id="section-15">
291
+ <li id="section-16">
273
292
  <div class="annotation">
274
293
 
275
294
  <div class="pilwrap ">
276
- <a class="pilcrow" href="#section-15">&#182;</a>
295
+ <a class="pilcrow" href="#section-16">&#182;</a>
277
296
  </div>
278
297
  <p>Construct requestBody depends on annotation type
279
298
  Text annotation</p>
280
299
 
281
300
  </div>
282
301
 
283
- <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.annotation_type == <span class="string">'text'</span>
284
- annotation.box = <span class="constant">GroupDocs::Document::Rectangle</span>.new ({<span class="symbol">x:</span> params[<span class="string">'box_x'</span>], <span class="symbol">y:</span> params[<span class="string">'box_y'</span>], <span class="symbol">width:</span> params[<span class="string">'box_width'</span>], <span class="symbol">height:</span> params[<span class="string">'box_height'</span>]})
285
- annotation.annotationPosition = {<span class="symbol">x:</span> params[<span class="string">'annotationPosition_x'</span>], <span class="symbol">y:</span> params[<span class="string">'annotationPosition_y'</span>]}
286
- range = {<span class="symbol">position:</span> params[<span class="string">'range-position'</span>], <span class="symbol">length:</span> params[<span class="string">'range-length'</span>]}
287
- info = {<span class="symbol">:box</span> =&gt; annotation_box, <span class="symbol">:annotationPosition</span> =&gt; annotation_annotationPosition, <span class="symbol">:range</span> =&gt; range, <span class="symbol">:type</span> =&gt; types[settings.annotation_type.to_sym], <span class="symbol">:replies</span> =&gt; [{<span class="symbol">:text</span> =&gt; params[<span class="string">'text'</span>]}]}</pre></div></div>
302
+ <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.annotation_type == <span class="string">'text'</span>
303
+ annotation.box = <span class="constant">GroupDocs::Document::Rectangle</span>.new ({<span class="symbol">x:</span> params[<span class="string">'boxX'</span>], <span class="symbol">y:</span> params[<span class="string">'boxY'</span>], <span class="symbol">width:</span> params[<span class="string">'boxWidth'</span>], <span class="symbol">height:</span> params[<span class="string">'boxHeight'</span>]})
304
+ annotation.annotationPosition = {<span class="symbol">x:</span> params[<span class="string">'annotationPositionX'</span>], <span class="symbol">y:</span> params[<span class="string">'annotationPositionY'</span>]}
305
+ range = {<span class="symbol">position:</span> params[<span class="string">'rangePosition'</span>], <span class="symbol">length:</span> params[<span class="string">'rangeLength'</span>]}
306
+ info = {<span class="symbol">:box</span> =&gt; annotation_box, <span class="symbol">:annotationPosition</span> =&gt; annotation_annotationPosition, <span class="symbol">:range</span> =&gt; range, <span class="symbol">:type</span> =&gt; types[settings.annotation_type.to_sym], <span class="symbol">:replies</span> =&gt; [{<span class="symbol">:text</span> =&gt; params[<span class="string">'text'</span>]}]}</pre></div></div>
288
307
 
289
308
  </li>
290
309
 
291
310
 
292
- <li id="section-16">
311
+ <li id="section-17">
293
312
  <div class="annotation">
294
313
 
295
314
  <div class="pilwrap ">
296
- <a class="pilcrow" href="#section-16">&#182;</a>
315
+ <a class="pilcrow" href="#section-17">&#182;</a>
297
316
  </div>
298
317
  <p>Area annotation</p>
299
318
 
300
319
  </div>
301
320
 
302
- <div class="content"><div class='highlight'><pre> <span class="keyword">elsif</span> settings.annotation_type == <span class="string">'area'</span>
303
- annotation_box = {<span class="symbol">x:</span> params[<span class="string">'box_x'</span>], <span class="symbol">y:</span> params[<span class="string">'box_y'</span>], <span class="symbol">width:</span> params[<span class="string">'box_width'</span>], <span class="symbol">height:</span> params[<span class="string">'box_height'</span>]}
304
- annotation_annotationPosition = {<span class="symbol">x:</span> <span class="number">0</span>, <span class="symbol">y:</span> <span class="number">0</span>}
305
- info = {<span class="symbol">:box</span> =&gt; annotation_box, <span class="symbol">:annotationPosition</span> =&gt; annotation_annotationPosition, <span class="symbol">:type</span> =&gt; types[settings.annotation_type.to_sym], <span class="symbol">:replies</span> =&gt; [{<span class="symbol">:text</span> =&gt; params[<span class="string">'text'</span>]}]}</pre></div></div>
321
+ <div class="content"><div class='highlight'><pre> <span class="keyword">elsif</span> settings.annotation_type == <span class="string">'area'</span>
322
+ annotation_box = {<span class="symbol">x:</span> params[<span class="string">'boxX'</span>], <span class="symbol">y:</span> params[<span class="string">'boxY'</span>], <span class="symbol">width:</span> params[<span class="string">'boxWidth'</span>], <span class="symbol">height:</span> params[<span class="string">'boxHeight'</span>]}
323
+ annotation_annotationPosition = {<span class="symbol">x:</span> <span class="number">0</span>, <span class="symbol">y:</span> <span class="number">0</span>}
324
+ info = {<span class="symbol">:box</span> =&gt; annotation_box, <span class="symbol">:annotationPosition</span> =&gt; annotation_annotationPosition, <span class="symbol">:type</span> =&gt; types[settings.annotation_type.to_sym], <span class="symbol">:replies</span> =&gt; [{<span class="symbol">:text</span> =&gt; params[<span class="string">'text'</span>]}]}</pre></div></div>
306
325
 
307
326
  </li>
308
327
 
309
328
 
310
- <li id="section-17">
329
+ <li id="section-18">
311
330
  <div class="annotation">
312
331
 
313
332
  <div class="pilwrap ">
314
- <a class="pilcrow" href="#section-17">&#182;</a>
333
+ <a class="pilcrow" href="#section-18">&#182;</a>
315
334
  </div>
316
335
  <p>Point annotation</p>
317
336
 
318
337
  </div>
319
338
 
320
- <div class="content"><div class='highlight'><pre> <span class="keyword">elsif</span> settings.annotation_type == <span class="string">'point'</span>
321
- annotation_box = {<span class="symbol">x:</span> params[<span class="string">'box_x'</span>], <span class="symbol">y:</span> params[<span class="string">'box_y'</span>], <span class="symbol">width:</span> <span class="number">0</span>, <span class="symbol">height:</span> <span class="number">0</span>}
322
- annotation_annotationPosition = {<span class="symbol">x:</span> <span class="number">0</span>, <span class="symbol">y:</span> <span class="number">0</span>}
339
+ <div class="content"><div class='highlight'><pre> <span class="keyword">elsif</span> settings.annotation_type == <span class="string">'point'</span>
340
+ annotation_box = {<span class="symbol">x:</span> params[<span class="string">'boxX'</span>], <span class="symbol">y:</span> params[<span class="string">'boxY'</span>], <span class="symbol">width:</span> <span class="number">0</span>, <span class="symbol">height:</span> <span class="number">0</span>}
341
+ annotation_annotationPosition = {<span class="symbol">x:</span> <span class="number">0</span>, <span class="symbol">y:</span> <span class="number">0</span>}
323
342
 
324
- info = {<span class="symbol">:box</span> =&gt; annotation_box, <span class="symbol">:annotationPosition</span> =&gt; annotation_annotationPosition, <span class="symbol">:type</span> =&gt; types[settings.annotation_type.to_sym], <span class="symbol">:replies</span> =&gt; [{<span class="symbol">:text</span> =&gt; params[<span class="string">'text'</span>]}] }
325
- <span class="keyword">end</span></pre></div></div>
343
+ info = {<span class="symbol">:box</span> =&gt; annotation_box, <span class="symbol">:annotationPosition</span> =&gt; annotation_annotationPosition, <span class="symbol">:type</span> =&gt; types[settings.annotation_type.to_sym], <span class="symbol">:replies</span> =&gt; [{<span class="symbol">:text</span> =&gt; params[<span class="string">'text'</span>]}] }
344
+ <span class="keyword">end</span></pre></div></div>
326
345
 
327
346
  </li>
328
347
 
329
348
 
330
- <li id="section-18">
349
+ <li id="section-19">
331
350
  <div class="annotation">
332
351
 
333
352
  <div class="pilwrap ">
334
- <a class="pilcrow" href="#section-18">&#182;</a>
353
+ <a class="pilcrow" href="#section-19">&#182;</a>
335
354
  </div>
336
355
  <p>Call create method</p>
337
356
 
338
357
  </div>
339
358
 
340
- <div class="content"><div class='highlight'><pre> annotation.create!(info)
341
- id = annotation.document.file.id</pre></div></div>
359
+ <div class="content"><div class='highlight'><pre> annotation.create!(info)
360
+ id = annotation.document.file.id</pre></div></div>
342
361
 
343
362
  </li>
344
363
 
345
364
 
346
- <li id="section-19">
365
+ <li id="section-20">
347
366
  <div class="annotation">
348
367
 
349
368
  <div class="pilwrap ">
350
- <a class="pilcrow" href="#section-19">&#182;</a>
369
+ <a class="pilcrow" href="#section-20">&#182;</a>
351
370
  </div>
352
371
  <p>Get document guid</p>
353
372
 
354
373
  </div>
355
374
 
356
- <div class="content"><div class='highlight'><pre> guid = annotation.document.file.guid
357
-
358
- <span class="keyword">case</span> settings.base_path
375
+ <div class="content"><div class='highlight'><pre> guid = annotation.document.file.guid</pre></div></div>
376
+
377
+ </li>
378
+
379
+
380
+ <li id="section-21">
381
+ <div class="annotation">
382
+
383
+ <div class="pilwrap ">
384
+ <a class="pilcrow" href="#section-21">&#182;</a>
385
+ </div>
386
+ <p>Prepare to sign url</p>
359
387
 
360
- <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
361
- url = <span class="string">"http://stage-apps-groupdocs.dynabic.com/document-annotation2/embed/<span class="subst">#{guid}</span>"</span>
362
- <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
363
- url = <span class="string">"http://dev-apps-groupdocs.dynabic.com/document-annotation2/embed/<span class="subst">#{guid}</span>"</span>
364
- <span class="keyword">else</span>
365
- url = <span class="string">"http://apps.groupdocs.com/document-annotation2/embed/<span class="subst">#{guid}</span>"</span>
366
- <span class="keyword">end</span></pre></div></div>
388
+ </div>
389
+
390
+ <div class="content"><div class='highlight'><pre> iframe = <span class="string">"/document-annotation2/embed/<span class="subst">#{guid}</span>"</span></pre></div></div>
367
391
 
368
392
  </li>
369
393
 
370
394
 
371
- <li id="section-20">
395
+ <li id="section-22">
372
396
  <div class="annotation">
373
397
 
374
398
  <div class="pilwrap ">
375
- <a class="pilcrow" href="#section-20">&#182;</a>
399
+ <a class="pilcrow" href="#section-22">&#182;</a>
376
400
  </div>
377
- <p>Add the signature in url</p>
401
+ <p>Construct result string</p>
378
402
 
379
403
  </div>
380
404
 
381
- <div class="content"><div class='highlight'><pre> url = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> =&gt; url).prepare_and_sign_url</pre></div></div>
405
+ <div class="content"><div class='highlight'><pre> url = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> =&gt; iframe).prepare_and_sign_url</pre></div></div>
382
406
 
383
407
  </li>
384
408
 
385
409
 
386
- <li id="section-21">
410
+ <li id="section-23">
387
411
  <div class="annotation">
388
412
 
389
413
  <div class="pilwrap ">
390
- <a class="pilcrow" href="#section-21">&#182;</a>
414
+ <a class="pilcrow" href="#section-23">&#182;</a>
391
415
  </div>
392
- <p>Set iframe with document GUID</p>
416
+ <p>Generate iframe URL</p>
393
417
 
394
418
  </div>
395
419
 
396
- <div class="content"><div class='highlight'><pre> iframe = <span class="string">"&lt;iframe src='<span class="subst">#{url}</span>' frameborder='0' width='720' height='600'&gt;&lt;/iframe&gt;"</span>
420
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> base_path
421
+ <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
422
+ iframe = <span class="string">"https://stage-api-groupdocs.dynabic.com<span class="subst">#{url}</span>"</span>
423
+ <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
424
+ iframe = <span class="string">"https://dev-apps.groupdocs.com<span class="subst">#{url}</span>"</span>
425
+ <span class="keyword">else</span>
426
+ iframe = <span class="string">"https://apps.groupdocs.com<span class="subst">#{url}</span>"</span>
427
+ <span class="keyword">end</span></pre></div></div>
428
+
429
+ </li>
430
+
431
+
432
+ <li id="section-24">
433
+ <div class="annotation">
434
+
435
+ <div class="pilwrap ">
436
+ <a class="pilcrow" href="#section-24">&#182;</a>
437
+ </div>
438
+ <p>Make iframe</p>
397
439
 
398
- <span class="keyword">end</span>
440
+ </div>
441
+
442
+ <div class="content"><div class='highlight'><pre> iframe = <span class="string">"&lt;iframe id='downloadframe' src='<span class="subst">#{iframe}</span>' width='800' height='1000'&gt;&lt;/iframe&gt;"</span>
399
443
 
444
+ <span class="keyword">end</span>
400
445
  <span class="keyword">end</span>
401
446
 
402
447
  <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e
@@ -406,11 +451,11 @@ Text annotation</p>
406
451
  </li>
407
452
 
408
453
 
409
- <li id="section-22">
454
+ <li id="section-25">
410
455
  <div class="annotation">
411
456
 
412
457
  <div class="pilwrap ">
413
- <a class="pilcrow" href="#section-22">&#182;</a>
458
+ <a class="pilcrow" href="#section-25">&#182;</a>
414
459
  </div>
415
460
  <p>set variables for template</p>
416
461