groupdocs 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. data/CHANGELOG.md +34 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +3 -0
  4. data/examples/api-samples/public/docs/sample01.html +23 -23
  5. data/examples/api-samples/public/docs/sample02.html +27 -27
  6. data/examples/api-samples/public/docs/sample03.html +81 -69
  7. data/examples/api-samples/public/docs/sample04.html +29 -29
  8. data/examples/api-samples/public/docs/sample05.html +48 -48
  9. data/examples/api-samples/public/docs/sample06.html +47 -46
  10. data/examples/api-samples/public/docs/sample07.html +35 -35
  11. data/examples/api-samples/public/docs/sample08.html +45 -45
  12. data/examples/api-samples/public/docs/sample09.html +57 -57
  13. data/examples/api-samples/public/docs/sample10.html +41 -41
  14. data/examples/api-samples/public/docs/sample11.html +96 -118
  15. data/examples/api-samples/public/docs/sample12.html +29 -50
  16. data/examples/api-samples/public/docs/sample13.html +36 -44
  17. data/examples/api-samples/public/docs/sample14.html +29 -29
  18. data/examples/api-samples/public/docs/sample15.html +24 -24
  19. data/examples/api-samples/public/docs/sample16.html +32 -32
  20. data/examples/api-samples/public/docs/sample17.html +38 -38
  21. data/examples/api-samples/public/docs/sample18.html +105 -101
  22. data/examples/api-samples/public/docs/sample19.html +101 -101
  23. data/examples/api-samples/public/docs/sample20.html +42 -42
  24. data/examples/api-samples/public/docs/sample21.html +109 -109
  25. data/examples/api-samples/public/docs/sample22.html +56 -56
  26. data/examples/api-samples/public/docs/sample23.html +39 -39
  27. data/examples/api-samples/public/docs/sample24.html +36 -36
  28. data/examples/api-samples/public/docs/sample25.html +67 -67
  29. data/examples/api-samples/public/docs/sample26.html +23 -23
  30. data/examples/api-samples/public/docs/sample27.html +72 -72
  31. data/examples/api-samples/public/docs/sample28.html +46 -45
  32. data/examples/api-samples/public/docs/sample29.html +30 -30
  33. data/examples/api-samples/public/docs/sample30.html +30 -30
  34. data/examples/api-samples/public/docs/sample31.html +114 -114
  35. data/examples/api-samples/public/docs/sample32.html +96 -96
  36. data/examples/api-samples/public/docs/sample33.html +56 -56
  37. data/examples/api-samples/public/docs/sample34.html +27 -27
  38. data/examples/api-samples/public/docs/sample35.html +134 -135
  39. data/examples/api-samples/public/docs/sample36.html +32 -32
  40. data/examples/api-samples/public/docs/sample37.html +103 -103
  41. data/examples/api-samples/public/docs/sample38.html +76 -76
  42. data/examples/api-samples/public/docs/sample39.html +136 -136
  43. data/examples/api-samples/public/docs/sample40.html +104 -104
  44. data/examples/api-samples/public/docs/sample41.html +137 -137
  45. data/examples/api-samples/public/docs/sample42.html +61 -61
  46. data/examples/api-samples/public/docs/sample43.html +72 -72
  47. data/examples/api-samples/public/docs/sample44.html +751 -0
  48. data/examples/api-samples/public/docs/sample45.html +236 -0
  49. data/examples/api-samples/public/templates/merge_field3_doc.docx +0 -0
  50. data/examples/api-samples/samples/sample01.rb +2 -2
  51. data/examples/api-samples/samples/sample02.rb +2 -2
  52. data/examples/api-samples/samples/sample03.rb +2 -2
  53. data/examples/api-samples/samples/sample04.rb +2 -2
  54. data/examples/api-samples/samples/sample05.rb +2 -2
  55. data/examples/api-samples/samples/sample06.rb +2 -2
  56. data/examples/api-samples/samples/sample07.rb +2 -2
  57. data/examples/api-samples/samples/sample08.rb +2 -2
  58. data/examples/api-samples/samples/sample09.rb +2 -2
  59. data/examples/api-samples/samples/sample10.rb +2 -2
  60. data/examples/api-samples/samples/sample11.rb +2 -2
  61. data/examples/api-samples/samples/sample12.rb +2 -2
  62. data/examples/api-samples/samples/sample13.rb +2 -2
  63. data/examples/api-samples/samples/sample14.rb +2 -2
  64. data/examples/api-samples/samples/sample15.rb +2 -2
  65. data/examples/api-samples/samples/sample16.rb +2 -2
  66. data/examples/api-samples/samples/sample17.rb +2 -2
  67. data/examples/api-samples/samples/sample18.rb +2 -2
  68. data/examples/api-samples/samples/sample19.rb +2 -2
  69. data/examples/api-samples/samples/sample20.rb +2 -2
  70. data/examples/api-samples/samples/sample21.rb +2 -2
  71. data/examples/api-samples/samples/sample22.rb +2 -2
  72. data/examples/api-samples/samples/sample23.rb +2 -2
  73. data/examples/api-samples/samples/sample24.rb +2 -2
  74. data/examples/api-samples/samples/sample25.rb +2 -2
  75. data/examples/api-samples/samples/sample26.rb +2 -2
  76. data/examples/api-samples/samples/sample27.rb +2 -2
  77. data/examples/api-samples/samples/sample28.rb +2 -2
  78. data/examples/api-samples/samples/sample29.rb +2 -2
  79. data/examples/api-samples/samples/sample30.rb +2 -2
  80. data/examples/api-samples/samples/sample31.rb +2 -2
  81. data/examples/api-samples/samples/sample32.rb +2 -2
  82. data/examples/api-samples/samples/sample33.rb +2 -2
  83. data/examples/api-samples/samples/sample34.rb +2 -2
  84. data/examples/api-samples/samples/sample35.rb +4 -4
  85. data/examples/api-samples/samples/sample36.rb +2 -2
  86. data/examples/api-samples/samples/sample37.rb +2 -2
  87. data/examples/api-samples/samples/sample38.rb +2 -2
  88. data/examples/api-samples/samples/sample39.rb +2 -2
  89. data/examples/api-samples/samples/sample40.rb +2 -2
  90. data/examples/api-samples/samples/sample41.rb +2 -2
  91. data/examples/api-samples/samples/sample42.rb +2 -2
  92. data/examples/api-samples/samples/sample43.rb +2 -2
  93. data/examples/api-samples/samples/sample44.rb +188 -0
  94. data/examples/api-samples/samples/sample45.rb +74 -0
  95. data/examples/api-samples/views/_others_samples.haml +47 -43
  96. data/examples/api-samples/views/index.haml +55 -44
  97. data/examples/api-samples/views/layout.haml +1 -6
  98. data/examples/api-samples/views/sample01.haml +62 -57
  99. data/examples/api-samples/views/sample02.haml +52 -46
  100. data/examples/api-samples/views/sample03.haml +78 -73
  101. data/examples/api-samples/views/sample04.haml +51 -45
  102. data/examples/api-samples/views/sample05.haml +77 -71
  103. data/examples/api-samples/views/sample06.haml +58 -52
  104. data/examples/api-samples/views/sample07.haml +51 -45
  105. data/examples/api-samples/views/sample08.haml +90 -84
  106. data/examples/api-samples/views/sample09.haml +86 -80
  107. data/examples/api-samples/views/sample10.haml +83 -77
  108. data/examples/api-samples/views/sample11.haml +124 -120
  109. data/examples/api-samples/views/sample12.haml +65 -59
  110. data/examples/api-samples/views/sample13.haml +62 -56
  111. data/examples/api-samples/views/sample14.haml +57 -51
  112. data/examples/api-samples/views/sample15.haml +49 -43
  113. data/examples/api-samples/views/sample16.haml +49 -43
  114. data/examples/api-samples/views/sample17.haml +53 -47
  115. data/examples/api-samples/views/sample18.haml +140 -134
  116. data/examples/api-samples/views/sample19.haml +87 -81
  117. data/examples/api-samples/views/sample20.haml +53 -47
  118. data/examples/api-samples/views/sample21.haml +115 -111
  119. data/examples/api-samples/views/sample22.haml +94 -88
  120. data/examples/api-samples/views/sample23.haml +83 -78
  121. data/examples/api-samples/views/sample24.haml +54 -48
  122. data/examples/api-samples/views/sample25.haml +89 -83
  123. data/examples/api-samples/views/sample26.haml +62 -57
  124. data/examples/api-samples/views/sample27.haml +114 -109
  125. data/examples/api-samples/views/sample28.haml +55 -49
  126. data/examples/api-samples/views/sample29.haml +67 -69
  127. data/examples/api-samples/views/sample30.haml +54 -48
  128. data/examples/api-samples/views/sample31.haml +106 -100
  129. data/examples/api-samples/views/sample32.haml +90 -84
  130. data/examples/api-samples/views/sample33.haml +60 -54
  131. data/examples/api-samples/views/sample34.haml +51 -46
  132. data/examples/api-samples/views/sample35.haml +84 -78
  133. data/examples/api-samples/views/sample36.haml +63 -58
  134. data/examples/api-samples/views/sample37.haml +122 -116
  135. data/examples/api-samples/views/sample38.haml +104 -98
  136. data/examples/api-samples/views/sample39.haml +6 -2
  137. data/examples/api-samples/views/sample40.haml +94 -89
  138. data/examples/api-samples/views/sample41.haml +127 -123
  139. data/examples/api-samples/views/sample42.haml +60 -54
  140. data/examples/api-samples/views/sample43.haml +81 -77
  141. data/examples/api-samples/views/sample44.haml +85 -0
  142. data/examples/api-samples/views/sample45.haml +85 -0
  143. data/groupdocs.gemspec +2 -0
  144. data/lib/groupdocs/datasource/field.rb +9 -0
  145. data/lib/groupdocs/document.rb +66 -4
  146. data/lib/groupdocs/document/annotation.rb +11 -6
  147. data/lib/groupdocs/document/editor.rb +53 -0
  148. data/lib/groupdocs/document/field.rb +16 -0
  149. data/lib/groupdocs/document/style.rb +30 -0
  150. data/lib/groupdocs/job.rb +24 -0
  151. data/lib/groupdocs/questionnaire.rb +2 -0
  152. data/lib/groupdocs/questionnaire/collector.rb +52 -0
  153. data/lib/groupdocs/questionnaire/collector_style.rb +54 -0
  154. data/lib/groupdocs/questionnaire/question.rb +9 -0
  155. data/lib/groupdocs/questionnaire/style/base_font.rb +17 -0
  156. data/lib/groupdocs/questionnaire/style/question_title.rb +17 -0
  157. data/lib/groupdocs/questionnaire/style/title.rb +17 -0
  158. data/lib/groupdocs/signature/envelope.rb +43 -8
  159. data/lib/groupdocs/signature/form.rb +113 -12
  160. data/lib/groupdocs/signature/recipient.rb +38 -3
  161. data/lib/groupdocs/signature/shared/field_methods.rb +4 -2
  162. data/lib/groupdocs/signature/template.rb +20 -1
  163. data/lib/groupdocs/storage/file.rb +3 -2
  164. data/lib/groupdocs/user.rb +148 -0
  165. data/lib/groupdocs/version.rb +1 -1
  166. data/spec/groupdocs/api/helpers/access_rights_helper_spec.rb +5 -5
  167. data/spec/groupdocs/document/annotation_spec.rb +1 -1
  168. data/spec/groupdocs/signature/envelope_spec.rb +1 -1
  169. data/spec/groupdocs/user_spec.rb +4 -4
  170. data/spec/support/shared_examples/signature/shared/field_methods.rb +5 -4
  171. metadata +18 -3
@@ -31,9 +31,9 @@
31
31
 
32
32
  </div>
33
33
 
34
- <div class="content"><div class='highlight'><pre>get <span class="string">'/sample10'</span> <span class="keyword">do</span>
35
- haml <span class="symbol">:sample10</span>
36
- <span class="keyword">end</span></pre></div></div>
34
+ <div class="content"><div class='highlight'><pre>get <span class="hljs-string">'/sample-10-how-to-share-a-document-to-other-users'</span> <span class="hljs-keyword">do</span>
35
+ haml <span class="hljs-symbol">:sample10</span>
36
+ <span class="hljs-keyword">end</span></pre></div></div>
37
37
 
38
38
  </li>
39
39
 
@@ -48,7 +48,7 @@
48
48
 
49
49
  </div>
50
50
 
51
- <div class="content"><div class='highlight'><pre>post <span class="string">'/sample10'</span> <span class="keyword">do</span></pre></div></div>
51
+ <div class="content"><div class='highlight'><pre>post <span class="hljs-string">'/sample-10-how-to-share-a-document-to-other-users'</span> <span class="hljs-keyword">do</span></pre></div></div>
52
52
 
53
53
  </li>
54
54
 
@@ -63,14 +63,14 @@
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">:clientId</span>]
67
- set <span class="symbol">:private_key</span>, params[<span class="symbol">:privateKey</span>]
68
- set <span class="symbol">:guid</span>, params[<span class="symbol">:fileId</span>]
69
- set <span class="symbol">:email</span>, params[<span class="symbol">:email</span>]
70
- set <span class="symbol">:source</span>, params[<span class="symbol">:source</span>]
71
- set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]
66
+ <div class="content"><div class='highlight'><pre> set <span class="hljs-symbol">:client_id</span>, params[<span class="hljs-symbol">:clientId</span>]
67
+ set <span class="hljs-symbol">:private_key</span>, params[<span class="hljs-symbol">:privateKey</span>]
68
+ set <span class="hljs-symbol">:guid</span>, params[<span class="hljs-symbol">:fileId</span>]
69
+ set <span class="hljs-symbol">:email</span>, params[<span class="hljs-symbol">:email</span>]
70
+ set <span class="hljs-symbol">:source</span>, params[<span class="hljs-symbol">:source</span>]
71
+ set <span class="hljs-symbol">:base_path</span>, params[<span class="hljs-symbol">:basePath</span>]
72
72
 
73
- <span class="keyword">begin</span></pre></div></div>
73
+ <span class="hljs-keyword">begin</span></pre></div></div>
74
74
 
75
75
  </li>
76
76
 
@@ -85,7 +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?</pre></div></div>
88
+ <div class="content"><div class='highlight'><pre> raise <span class="hljs-string">'Please enter all required parameters'</span> <span class="hljs-keyword">if</span> settings.client_id.empty? <span class="hljs-keyword">or</span> settings.private_key.empty? <span class="hljs-keyword">or</span> settings.guid.empty? <span class="hljs-keyword">or</span> settings.email.empty?</pre></div></div>
89
89
 
90
90
  </li>
91
91
 
@@ -100,13 +100,13 @@
100
100
 
101
101
  </div>
102
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>
103
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> settings.base_path.empty?
104
+ base_path = <span class="hljs-string">'https://api.groupdocs.com'</span>
105
+ <span class="hljs-keyword">elsif</span> settings.base_path.match(<span class="hljs-string">'/v2.0'</span>)
106
+ base_path = settings.base_path.split(<span class="hljs-string">'/v2.0'</span>)[<span class="hljs-number">0</span>]
107
+ <span class="hljs-keyword">else</span>
108
108
  base_path = settings.base_path
109
- <span class="keyword">end</span></pre></div></div>
109
+ <span class="hljs-keyword">end</span></pre></div></div>
110
110
 
111
111
  </li>
112
112
 
@@ -121,7 +121,7 @@
121
121
 
122
122
  </div>
123
123
 
124
- <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
124
+ <div class="content"><div class='highlight'><pre> <span class="hljs-constant">GroupDocs</span>.configure <span class="hljs-keyword">do</span> |groupdocs|
125
125
  groupdocs.client_id = settings.client_id
126
126
  groupdocs.private_key = settings.private_key</pre></div></div>
127
127
 
@@ -138,8 +138,8 @@
138
138
 
139
139
  </div>
140
140
 
141
- <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
142
- <span class="keyword">end</span></pre></div></div>
141
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="hljs-comment"># default is 'https://api.groupdocs.com'</span>
142
+ <span class="hljs-keyword">end</span></pre></div></div>
143
143
 
144
144
  </li>
145
145
 
@@ -154,12 +154,12 @@
154
154
 
155
155
  </div>
156
156
 
157
- <div class="content"><div class='highlight'><pre> file = <span class="keyword">nil</span>
158
- <span class="keyword">case</span> settings.source
159
- <span class="keyword">when</span> <span class="string">'guid'</span>
160
- file = <span class="constant">GroupDocs::Storage::File</span>.new({<span class="symbol">:guid</span> =&gt; settings.guid}).to_document.metadata!()
157
+ <div class="content"><div class='highlight'><pre> file = <span class="hljs-keyword">nil</span>
158
+ <span class="hljs-keyword">case</span> settings.source
159
+ <span class="hljs-keyword">when</span> <span class="hljs-string">'guid'</span>
160
+ file = <span class="hljs-constant">GroupDocs::Storage::File</span>.new({<span class="hljs-symbol">:guid</span> =&gt; settings.guid}).to_document.metadata!()
161
161
  file = file.last_view.document.file
162
- <span class="keyword">when</span> <span class="string">'local'</span></pre></div></div>
162
+ <span class="hljs-keyword">when</span> <span class="hljs-string">'local'</span></pre></div></div>
163
163
 
164
164
  </li>
165
165
 
@@ -174,7 +174,7 @@
174
174
 
175
175
  </div>
176
176
 
177
- <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>
177
+ <div class="content"><div class='highlight'><pre> filepath = <span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">Dir</span>.tmpdir}</span>/<span class="hljs-subst">#{params[<span class="hljs-symbol">:file</span>][<span class="hljs-symbol">:filename</span>]}</span>"</span></pre></div></div>
178
178
 
179
179
  </li>
180
180
 
@@ -189,7 +189,7 @@
189
189
 
190
190
  </div>
191
191
 
192
- <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>
192
+ <div class="content"><div class='highlight'><pre> <span class="hljs-constant">File</span>.open(filepath, <span class="hljs-string">'wb'</span>) { |f| f.write(params[<span class="hljs-symbol">:file</span>][<span class="hljs-symbol">:tempfile</span>].read) }</pre></div></div>
193
193
 
194
194
  </li>
195
195
 
@@ -204,12 +204,12 @@
204
204
 
205
205
  </div>
206
206
 
207
- <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload!(filepath, {})
208
- <span class="keyword">when</span> <span class="string">'url'</span>
209
- file = <span class="constant">GroupDocs::Storage::File</span>.upload_web!(settings.url)
210
- <span class="keyword">else</span>
211
- raise <span class="string">'Wrong GUID source.'</span>
212
- <span class="keyword">end</span></pre></div></div>
207
+ <div class="content"><div class='highlight'><pre> file = <span class="hljs-constant">GroupDocs::Storage::File</span>.upload!(filepath, {})
208
+ <span class="hljs-keyword">when</span> <span class="hljs-string">'url'</span>
209
+ file = <span class="hljs-constant">GroupDocs::Storage::File</span>.upload_web!(settings.url)
210
+ <span class="hljs-keyword">else</span>
211
+ raise <span class="hljs-string">'Wrong GUID source.'</span>
212
+ <span class="hljs-keyword">end</span></pre></div></div>
213
213
 
214
214
  </li>
215
215
 
@@ -224,7 +224,7 @@
224
224
 
225
225
  </div>
226
226
 
227
- <div class="content"><div class='highlight'><pre> shared = file.to_document.sharers_set!(settings.email.split(<span class="string">' '</span>))</pre></div></div>
227
+ <div class="content"><div class='highlight'><pre> shared = file.to_document.sharers_set!(settings.email.split(<span class="hljs-string">' '</span>))</pre></div></div>
228
228
 
229
229
  </li>
230
230
 
@@ -239,12 +239,12 @@
239
239
 
240
240
  </div>
241
241
 
242
- <div class="content"><div class='highlight'><pre> <span class="keyword">if</span> shared
242
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> shared
243
243
  shared_emails = settings.email
244
- <span class="keyword">end</span>
245
- <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e
244
+ <span class="hljs-keyword">end</span>
245
+ <span class="hljs-keyword">rescue</span> <span class="hljs-constant">Exception</span> =&gt; e
246
246
  err = e.message
247
- <span class="keyword">end</span></pre></div></div>
247
+ <span class="hljs-keyword">end</span></pre></div></div>
248
248
 
249
249
  </li>
250
250
 
@@ -259,8 +259,8 @@
259
259
 
260
260
  </div>
261
261
 
262
- <div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample10</span>, <span class="symbol">:locals</span> =&gt; {<span class="symbol">:clientId</span> =&gt; settings.client_id, <span class="symbol">:privateKey</span> =&gt; settings.private_key, <span class="symbol">:guid</span> =&gt; settings.guid, <span class="symbol">:email</span> =&gt; settings.email, <span class="symbol">:shared</span> =&gt; shared_emails, <span class="symbol">:err</span> =&gt; err}
263
- <span class="keyword">end</span></pre></div></div>
262
+ <div class="content"><div class='highlight'><pre> haml <span class="hljs-symbol">:sample10</span>, <span class="hljs-symbol">:locals</span> =&gt; {<span class="hljs-symbol">:clientId</span> =&gt; settings.client_id, <span class="hljs-symbol">:privateKey</span> =&gt; settings.private_key, <span class="hljs-symbol">:guid</span> =&gt; settings.guid, <span class="hljs-symbol">:email</span> =&gt; settings.email, <span class="hljs-symbol">:shared</span> =&gt; shared_emails, <span class="hljs-symbol">:err</span> =&gt; err}
263
+ <span class="hljs-keyword">end</span></pre></div></div>
264
264
 
265
265
  </li>
266
266
 
@@ -31,9 +31,9 @@
31
31
 
32
32
  </div>
33
33
 
34
- <div class="content"><div class='highlight'><pre>get <span class="string">'/sample11'</span> <span class="keyword">do</span>
35
- haml <span class="symbol">:sample11</span>
36
- <span class="keyword">end</span></pre></div></div>
34
+ <div class="content"><div class='highlight'><pre>get <span class="hljs-string">'/sample-11-how-to-programmatically-create-and-post-an-annotation-into-document'</span> <span class="hljs-keyword">do</span>
35
+ haml <span class="hljs-symbol">:sample11</span>
36
+ <span class="hljs-keyword">end</span></pre></div></div>
37
37
 
38
38
  </li>
39
39
 
@@ -48,7 +48,7 @@
48
48
 
49
49
  </div>
50
50
 
51
- <div class="content"><div class='highlight'><pre>post <span class="string">'/sample11'</span> <span class="keyword">do</span></pre></div></div>
51
+ <div class="content"><div class='highlight'><pre>post <span class="hljs-string">'/sample-11-how-to-programmatically-create-and-post-an-annotation-into-document'</span> <span class="hljs-keyword">do</span></pre></div></div>
52
52
 
53
53
  </li>
54
54
 
@@ -63,14 +63,14 @@
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">:clientId</span>]
67
- set <span class="symbol">:private_key</span>, params[<span class="symbol">:privateKey</span>]
68
- set <span class="symbol">:file_id</span>, params[<span class="symbol">:fileId</span>]
69
- set <span class="symbol">:annotation_type</span>, params[<span class="symbol">:annotationType</span>]
70
- set <span class="symbol">:annotation_id</span>, params[<span class="symbol">:annotationId</span>]
71
- set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]
66
+ <div class="content"><div class='highlight'><pre> set <span class="hljs-symbol">:client_id</span>, params[<span class="hljs-symbol">:clientId</span>]
67
+ set <span class="hljs-symbol">:private_key</span>, params[<span class="hljs-symbol">:privateKey</span>]
68
+ set <span class="hljs-symbol">:file_id</span>, params[<span class="hljs-symbol">:fileId</span>]
69
+ set <span class="hljs-symbol">:annotation_type</span>, params[<span class="hljs-symbol">:annotationType</span>]
70
+ set <span class="hljs-symbol">:annotation_id</span>, params[<span class="hljs-symbol">:annotationId</span>]
71
+ set <span class="hljs-symbol">:base_path</span>, params[<span class="hljs-symbol">:basePath</span>]
72
72
 
73
- <span class="keyword">begin</span></pre></div></div>
73
+ <span class="hljs-keyword">begin</span></pre></div></div>
74
74
 
75
75
  </li>
76
76
 
@@ -85,7 +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?</pre></div></div>
88
+ <div class="content"><div class='highlight'><pre> raise <span class="hljs-string">'Please enter all required parameters'</span> <span class="hljs-keyword">if</span> settings.client_id.empty? <span class="hljs-keyword">or</span> settings.private_key.empty? <span class="hljs-keyword">or</span> settings.file_id.empty? <span class="hljs-keyword">or</span> settings.annotation_type.empty?</pre></div></div>
89
89
 
90
90
  </li>
91
91
 
@@ -100,13 +100,13 @@
100
100
 
101
101
  </div>
102
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>
103
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> settings.base_path.empty?
104
+ base_path = <span class="hljs-string">'https://api.groupdocs.com'</span>
105
+ <span class="hljs-keyword">elsif</span> settings.base_path.match(<span class="hljs-string">'/v2.0'</span>)
106
+ base_path = settings.base_path.split(<span class="hljs-string">'/v2.0'</span>)[<span class="hljs-number">0</span>]
107
+ <span class="hljs-keyword">else</span>
108
108
  base_path = settings.base_path
109
- <span class="keyword">end</span></pre></div></div>
109
+ <span class="hljs-keyword">end</span></pre></div></div>
110
110
 
111
111
  </li>
112
112
 
@@ -121,7 +121,7 @@
121
121
 
122
122
  </div>
123
123
 
124
- <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
124
+ <div class="content"><div class='highlight'><pre> <span class="hljs-constant">GroupDocs</span>.configure <span class="hljs-keyword">do</span> |groupdocs|
125
125
  groupdocs.client_id = settings.client_id
126
126
  groupdocs.private_key = settings.private_key</pre></div></div>
127
127
 
@@ -138,12 +138,12 @@
138
138
 
139
139
  </div>
140
140
 
141
- <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
142
- <span class="keyword">end</span>
141
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="hljs-comment"># default is 'https://api.groupdocs.com'</span>
142
+ <span class="hljs-keyword">end</span>
143
143
 
144
- <span class="keyword">if</span> settings.annotation_id != <span class="string">''</span>
144
+ <span class="hljs-keyword">if</span> settings.annotation_id != <span class="hljs-string">''</span>
145
145
 
146
- file = <span class="constant">GroupDocs::Storage::File</span>.new({<span class="symbol">:guid</span> =&gt; settings.file_id}).to_document
146
+ file = <span class="hljs-constant">GroupDocs::Storage::File</span>.new({<span class="hljs-symbol">:guid</span> =&gt; settings.file_id}).to_document
147
147
  annotation = file.annotations!()</pre></div></div>
148
148
 
149
149
  </li>
@@ -160,8 +160,8 @@
160
160
  </div>
161
161
 
162
162
  <div class="content"><div class='highlight'><pre> remove = annotation.last.remove!()
163
- message = <span class="string">"You delete the annotation id = <span class="subst">#{remove[<span class="symbol">:guid</span>]}</span> "</span>
164
- <span class="keyword">else</span></pre></div></div>
163
+ message = <span class="hljs-string">"You delete the annotation id = <span class="hljs-subst">#{remove[<span class="hljs-symbol">:guid</span>]}</span> "</span>
164
+ <span class="hljs-keyword">else</span></pre></div></div>
165
165
 
166
166
  </li>
167
167
 
@@ -176,7 +176,7 @@
176
176
 
177
177
  </div>
178
178
 
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>
179
+ <div class="content"><div class='highlight'><pre> types = {<span class="hljs-symbol">:text</span> =&gt; <span class="hljs-string">"0"</span>, <span class="hljs-symbol">:area</span> =&gt; <span class="hljs-string">"1"</span>, <span class="hljs-symbol">:point</span> =&gt; <span class="hljs-string">"2"</span>}</pre></div></div>
180
180
 
181
181
  </li>
182
182
 
@@ -191,7 +191,7 @@
191
191
 
192
192
  </div>
193
193
 
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>
194
+ <div class="content"><div class='highlight'><pre> all_params = all_params = [<span class="hljs-string">'annotationType'</span>, <span class="hljs-string">'boxX'</span>, <span class="hljs-string">'boxY'</span>, <span class="hljs-string">'text'</span>]</pre></div></div>
195
195
 
196
196
  </li>
197
197
 
@@ -202,15 +202,15 @@
202
202
  <div class="pilwrap ">
203
203
  <a class="pilcrow" href="#section-11">&#182;</a>
204
204
  </div>
205
- <p>Added required parameters depends on annotation type [&#39;text&#39; or &#39;area&#39;]</p>
205
+ <p>Added required parameters depends on annotation type [text or area]</p>
206
206
 
207
207
  </div>
208
208
 
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>
209
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> settings.annotation_type == <span class="hljs-string">'text'</span>
210
+ all_params = all_params | [<span class="hljs-string">'boxWidth'</span>, <span class="hljs-string">'boxHeight'</span>, <span class="hljs-string">'annotationPositionX'</span>, <span class="hljs-string">'annotationPositionY'</span>, <span class="hljs-string">'rangePosition'</span>, <span class="hljs-string">'rangeLength'</span>]
211
+ <span class="hljs-keyword">elsif</span> settings.annotation_type == <span class="hljs-string">'area'</span>
212
+ all_params = all_params | [<span class="hljs-string">'boxWidth'</span>, <span class="hljs-string">'boxHeight'</span>]
213
+ <span class="hljs-keyword">end</span></pre></div></div>
214
214
 
215
215
  </li>
216
216
 
@@ -225,9 +225,9 @@
225
225
 
226
226
  </div>
227
227
 
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>
228
+ <div class="content"><div class='highlight'><pre> all_params.each <span class="hljs-keyword">do</span> |param|
229
+ raise <span class="hljs-string">'Please enter all required parameters'</span> <span class="hljs-keyword">if</span> params[param].empty?
230
+ <span class="hljs-keyword">end</span></pre></div></div>
231
231
 
232
232
  </li>
233
233
 
@@ -238,13 +238,13 @@
238
238
  <div class="pilwrap ">
239
239
  <a class="pilcrow" href="#section-13">&#182;</a>
240
240
  </div>
241
- <p>Make a request to API using client_id and private_key</p>
241
+ <p>Create document object</p>
242
242
 
243
243
  </div>
244
244
 
245
- <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> document = <span class="hljs-constant">GroupDocs::Storage::File</span>.new(<span class="hljs-symbol">guid:</span> settings.file_id).to_document
246
246
 
247
- document = <span class="string">''</span></pre></div></div>
247
+ <span class="hljs-keyword">unless</span> document.instance_of? <span class="hljs-constant">String</span></pre></div></div>
248
248
 
249
249
  </li>
250
250
 
@@ -255,17 +255,13 @@
255
255
  <div class="pilwrap ">
256
256
  <a class="pilcrow" href="#section-14">&#182;</a>
257
257
  </div>
258
- <p>Get document by file ID</p>
258
+ <p>Start create new annotation</p>
259
259
 
260
260
  </div>
261
261
 
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>
266
- <span class="keyword">end</span>
262
+ <div class="content"><div class='highlight'><pre> annotation = <span class="hljs-constant">GroupDocs::Document::Annotation</span>.new(<span class="hljs-symbol">document:</span> document)
267
263
 
268
- <span class="keyword">unless</span> document.instance_of? <span class="constant">String</span></pre></div></div>
264
+ info = <span class="hljs-keyword">nil</span></pre></div></div>
269
265
 
270
266
  </li>
271
267
 
@@ -276,14 +272,16 @@
276
272
  <div class="pilwrap ">
277
273
  <a class="pilcrow" href="#section-15">&#182;</a>
278
274
  </div>
279
- <p>Start create new annotation</p>
275
+ <p>Construct requestBody depends on annotation type
276
+ Text annotation</p>
280
277
 
281
278
  </div>
282
279
 
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)
284
-
285
-
286
- info = <span class="keyword">nil</span></pre></div></div>
280
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> settings.annotation_type == <span class="hljs-string">'text'</span>
281
+ annotation.box = <span class="hljs-constant">GroupDocs::Document::Rectangle</span>.new ({<span class="hljs-symbol">x:</span> params[<span class="hljs-string">'boxX'</span>], <span class="hljs-symbol">y:</span> params[<span class="hljs-string">'boxY'</span>], <span class="hljs-symbol">width:</span> params[<span class="hljs-string">'boxWidth'</span>], <span class="hljs-symbol">height:</span> params[<span class="hljs-string">'boxHeight'</span>]})
282
+ annotation.annotationPosition = {<span class="hljs-symbol">x:</span> params[<span class="hljs-string">'annotationPositionX'</span>], <span class="hljs-symbol">y:</span> params[<span class="hljs-string">'annotationPositionY'</span>]}
283
+ range = {<span class="hljs-symbol">position:</span> params[<span class="hljs-string">'rangePosition'</span>], <span class="hljs-symbol">length:</span> params[<span class="hljs-string">'rangeLength'</span>]}
284
+ info = {<span class="hljs-symbol">:box</span> =&gt; annotation_box, <span class="hljs-symbol">:annotationPosition</span> =&gt; annotation_annotationPosition, <span class="hljs-symbol">:range</span> =&gt; range, <span class="hljs-symbol">:type</span> =&gt; types[settings.annotation_type.to_sym], <span class="hljs-symbol">:replies</span> =&gt; [{<span class="hljs-symbol">:text</span> =&gt; params[<span class="hljs-string">'text'</span>]}]}</pre></div></div>
287
285
 
288
286
  </li>
289
287
 
@@ -294,16 +292,14 @@
294
292
  <div class="pilwrap ">
295
293
  <a class="pilcrow" href="#section-16">&#182;</a>
296
294
  </div>
297
- <p>Construct requestBody depends on annotation type
298
- Text annotation</p>
295
+ <p>Area annotation</p>
299
296
 
300
297
  </div>
301
298
 
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>
299
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">elsif</span> settings.annotation_type == <span class="hljs-string">'area'</span>
300
+ annotation_box = {<span class="hljs-symbol">x:</span> params[<span class="hljs-string">'boxX'</span>], <span class="hljs-symbol">y:</span> params[<span class="hljs-string">'boxY'</span>], <span class="hljs-symbol">width:</span> params[<span class="hljs-string">'boxWidth'</span>], <span class="hljs-symbol">height:</span> params[<span class="hljs-string">'boxHeight'</span>]}
301
+ annotation_annotationPosition = {<span class="hljs-symbol">x:</span> <span class="hljs-number">0</span>, <span class="hljs-symbol">y:</span> <span class="hljs-number">0</span>}
302
+ info = {<span class="hljs-symbol">:box</span> =&gt; annotation_box, <span class="hljs-symbol">:annotationPosition</span> =&gt; annotation_annotationPosition, <span class="hljs-symbol">:type</span> =&gt; types[settings.annotation_type.to_sym], <span class="hljs-symbol">:replies</span> =&gt; [{<span class="hljs-symbol">:text</span> =&gt; params[<span class="hljs-string">'text'</span>]}]}</pre></div></div>
307
303
 
308
304
  </li>
309
305
 
@@ -314,14 +310,16 @@ Text annotation</p>
314
310
  <div class="pilwrap ">
315
311
  <a class="pilcrow" href="#section-17">&#182;</a>
316
312
  </div>
317
- <p>Area annotation</p>
313
+ <p>Point annotation</p>
318
314
 
319
315
  </div>
320
316
 
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>
317
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">elsif</span> settings.annotation_type == <span class="hljs-string">'point'</span>
318
+ annotation_box = {<span class="hljs-symbol">x:</span> params[<span class="hljs-string">'boxX'</span>], <span class="hljs-symbol">y:</span> params[<span class="hljs-string">'boxY'</span>], <span class="hljs-symbol">width:</span> <span class="hljs-number">0</span>, <span class="hljs-symbol">height:</span> <span class="hljs-number">0</span>}
319
+ annotation_annotationPosition = {<span class="hljs-symbol">x:</span> <span class="hljs-number">0</span>, <span class="hljs-symbol">y:</span> <span class="hljs-number">0</span>}
320
+
321
+ info = {<span class="hljs-symbol">:box</span> =&gt; annotation_box, <span class="hljs-symbol">:annotationPosition</span> =&gt; annotation_annotationPosition, <span class="hljs-symbol">:type</span> =&gt; types[settings.annotation_type.to_sym], <span class="hljs-symbol">:replies</span> =&gt; [{<span class="hljs-symbol">:text</span> =&gt; params[<span class="hljs-string">'text'</span>]}] }
322
+ <span class="hljs-keyword">end</span></pre></div></div>
325
323
 
326
324
  </li>
327
325
 
@@ -332,16 +330,12 @@ Text annotation</p>
332
330
  <div class="pilwrap ">
333
331
  <a class="pilcrow" href="#section-18">&#182;</a>
334
332
  </div>
335
- <p>Point annotation</p>
333
+ <p>Call create method</p>
336
334
 
337
335
  </div>
338
336
 
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>}
342
-
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>
337
+ <div class="content"><div class='highlight'><pre> annotation.create!(info)
338
+ id = annotation.document.file.id</pre></div></div>
345
339
 
346
340
  </li>
347
341
 
@@ -352,12 +346,11 @@ Text annotation</p>
352
346
  <div class="pilwrap ">
353
347
  <a class="pilcrow" href="#section-19">&#182;</a>
354
348
  </div>
355
- <p>Call create method</p>
349
+ <p>Get document guid</p>
356
350
 
357
351
  </div>
358
352
 
359
- <div class="content"><div class='highlight'><pre> annotation.create!(info)
360
- id = annotation.document.file.id</pre></div></div>
353
+ <div class="content"><div class='highlight'><pre> guid = annotation.document.file.guid</pre></div></div>
361
354
 
362
355
  </li>
363
356
 
@@ -368,11 +361,11 @@ Text annotation</p>
368
361
  <div class="pilwrap ">
369
362
  <a class="pilcrow" href="#section-20">&#182;</a>
370
363
  </div>
371
- <p>Get document guid</p>
364
+ <p>Prepare to sign url</p>
372
365
 
373
366
  </div>
374
367
 
375
- <div class="content"><div class='highlight'><pre> guid = annotation.document.file.guid</pre></div></div>
368
+ <div class="content"><div class='highlight'><pre> iframe = <span class="hljs-string">"/document-annotation2/embed/<span class="hljs-subst">#{guid}</span>"</span></pre></div></div>
376
369
 
377
370
  </li>
378
371
 
@@ -383,11 +376,11 @@ Text annotation</p>
383
376
  <div class="pilwrap ">
384
377
  <a class="pilcrow" href="#section-21">&#182;</a>
385
378
  </div>
386
- <p>Prepare to sign url</p>
379
+ <p>Construct result string</p>
387
380
 
388
381
  </div>
389
382
 
390
- <div class="content"><div class='highlight'><pre> iframe = <span class="string">"/document-annotation2/embed/<span class="subst">#{guid}</span>"</span></pre></div></div>
383
+ <div class="content"><div class='highlight'><pre> url = <span class="hljs-constant">GroupDocs::Api::Request</span>.new(<span class="hljs-symbol">:path</span> =&gt; iframe).prepare_and_sign_url</pre></div></div>
391
384
 
392
385
  </li>
393
386
 
@@ -398,11 +391,18 @@ Text annotation</p>
398
391
  <div class="pilwrap ">
399
392
  <a class="pilcrow" href="#section-22">&#182;</a>
400
393
  </div>
401
- <p>Construct result string</p>
394
+ <p>Generate iframe URL</p>
402
395
 
403
396
  </div>
404
397
 
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>
398
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">case</span> base_path
399
+ <span class="hljs-keyword">when</span> <span class="hljs-string">'https://stage-api-groupdocs.dynabic.com'</span>
400
+ iframe = <span class="hljs-string">"https://stage-api-groupdocs.dynabic.com<span class="hljs-subst">#{url}</span>"</span>
401
+ <span class="hljs-keyword">when</span> <span class="hljs-string">'https://dev-api-groupdocs.dynabic.com'</span>
402
+ iframe = <span class="hljs-string">"https://dev-apps.groupdocs.com<span class="hljs-subst">#{url}</span>"</span>
403
+ <span class="hljs-keyword">else</span>
404
+ iframe = <span class="hljs-string">"https://apps.groupdocs.com<span class="hljs-subst">#{url}</span>"</span>
405
+ <span class="hljs-keyword">end</span></pre></div></div>
406
406
 
407
407
  </li>
408
408
 
@@ -413,64 +413,42 @@ Text annotation</p>
413
413
  <div class="pilwrap ">
414
414
  <a class="pilcrow" href="#section-23">&#182;</a>
415
415
  </div>
416
- <p>Generate iframe URL</p>
417
-
418
- </div>
419
-
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
416
  <p>Make iframe</p>
439
417
 
440
418
  </div>
441
419
 
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>
420
+ <div class="content"><div class='highlight'><pre> iframe = <span class="hljs-string">"&lt;iframe id='downloadframe' src='<span class="hljs-subst">#{iframe}</span>' width='800' height='1000'&gt;&lt;/iframe&gt;"</span>
443
421
 
444
- <span class="keyword">end</span>
445
- <span class="keyword">end</span>
422
+ <span class="hljs-keyword">end</span>
423
+ <span class="hljs-keyword">end</span>
446
424
 
447
- <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e
425
+ <span class="hljs-keyword">rescue</span> <span class="hljs-constant">Exception</span> =&gt; e
448
426
  err = e.message
449
- <span class="keyword">end</span></pre></div></div>
427
+ <span class="hljs-keyword">end</span></pre></div></div>
450
428
 
451
429
  </li>
452
430
 
453
431
 
454
- <li id="section-25">
432
+ <li id="section-24">
455
433
  <div class="annotation">
456
434
 
457
435
  <div class="pilwrap ">
458
- <a class="pilcrow" href="#section-25">&#182;</a>
436
+ <a class="pilcrow" href="#section-24">&#182;</a>
459
437
  </div>
460
438
  <p>set variables for template</p>
461
439
 
462
440
  </div>
463
441
 
464
- <div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample11</span>, <span class="symbol">:locals</span> =&gt; {<span class="symbol">:clientId</span> =&gt; settings.client_id,
465
- <span class="symbol">:privateKey</span> =&gt; settings.private_key,
466
- <span class="symbol">:fileId</span> =&gt; settings.file_id,
467
- <span class="symbol">:annotationType</span> =&gt; settings.annotation_type,
468
- <span class="symbol">:annotationId</span> =&gt; id,
469
- <span class="symbol">:annotationText</span> =&gt; params[<span class="string">'text'</span>],
470
- <span class="symbol">:err</span> =&gt; err,
471
- <span class="symbol">:iframe</span> =&gt; iframe,
472
- <span class="symbol">:message</span> =&gt; message}
473
- <span class="keyword">end</span></pre></div></div>
442
+ <div class="content"><div class='highlight'><pre> haml <span class="hljs-symbol">:sample11</span>, <span class="hljs-symbol">:locals</span> =&gt; {<span class="hljs-symbol">:clientId</span> =&gt; settings.client_id,
443
+ <span class="hljs-symbol">:privateKey</span> =&gt; settings.private_key,
444
+ <span class="hljs-symbol">:fileId</span> =&gt; settings.file_id,
445
+ <span class="hljs-symbol">:annotationType</span> =&gt; settings.annotation_type,
446
+ <span class="hljs-symbol">:annotationId</span> =&gt; id,
447
+ <span class="hljs-symbol">:annotationText</span> =&gt; params[<span class="hljs-string">'text'</span>],
448
+ <span class="hljs-symbol">:err</span> =&gt; err,
449
+ <span class="hljs-symbol">:iframe</span> =&gt; iframe,
450
+ <span class="hljs-symbol">:message</span> =&gt; message}
451
+ <span class="hljs-keyword">end</span></pre></div></div>
474
452
 
475
453
  </li>
476
454