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,16 +59,20 @@
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
- <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">:fileId</span>, params[<span class="symbol">:fileId</span>]
69
69
  set <span class="symbol">:email</span>, params[<span class="symbol">:email</span>]
70
- set <span class="symbol">:first_name</span>, params[<span class="symbol">:first_name</span>]
71
- set <span class="symbol">:last_name</span>, params[<span class="symbol">:last_name</span>]
70
+ set <span class="symbol">:first_name</span>, params[<span class="symbol">:firstName</span>]
71
+ set <span class="symbol">:last_name</span>, params[<span class="symbol">:lastName</span>]
72
+ set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]
73
+ set <span class="symbol">:url</span>, params[<span class="symbol">:url</span>]
74
+ set <span class="symbol">:source</span>, params[<span class="symbol">:source</span>]
75
+
72
76
 
73
77
  <span class="keyword">begin</span></pre></div></div>
74
78
 
@@ -81,11 +85,13 @@
81
85
  <div class="pilwrap ">
82
86
  <a class="pilcrow" href="#section-4">&#182;</a>
83
87
  </div>
84
- <p>check required variables</p>
88
+ <p>Check required variables</p>
85
89
 
86
90
  </div>
87
91
 
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.fileId.empty? <span class="keyword">or</span> settings.email.empty? <span class="keyword">or</span> settings.first_name.empty? <span class="keyword">or</span> settings.last_name.empty?</pre></div></div>
92
+ <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.email.empty? <span class="keyword">or</span> settings.first_name.empty? <span class="keyword">or</span> settings.last_name.empty?
93
+
94
+ <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>
89
95
 
90
96
  </li>
91
97
 
@@ -96,15 +102,13 @@
96
102
  <div class="pilwrap ">
97
103
  <a class="pilcrow" href="#section-5">&#182;</a>
98
104
  </div>
99
- <p>create new user</p>
105
+ <p>Configure your access to API server</p>
100
106
 
101
107
  </div>
102
108
 
103
- <div class="content"><div class='highlight'><pre> user = <span class="constant">GroupDocs::User</span>.new
104
- user.primary_email = settings.email
105
- user.nickname = settings.first_name
106
- user.first_name = settings.first_name
107
- user.last_name = settings.last_name</pre></div></div>
109
+ <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
110
+ groupdocs.client_id = settings.client_id
111
+ groupdocs.private_key = settings.private_key</pre></div></div>
108
112
 
109
113
  </li>
110
114
 
@@ -115,11 +119,13 @@
115
119
  <div class="pilwrap ">
116
120
  <a class="pilcrow" href="#section-6">&#182;</a>
117
121
  </div>
118
- <p>update account</p>
122
+ <p>Optionally specify API server and version</p>
119
123
 
120
124
  </div>
121
125
 
122
- <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs::User</span>.update_account!(user, {<span class="symbol">client_id:</span> settings.client_id, <span class="symbol">private_key:</span> settings.private_key})</pre></div></div>
126
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
127
+ <span class="keyword">end</span>
128
+ file = <span class="keyword">nil</span></pre></div></div>
123
129
 
124
130
  </li>
125
131
 
@@ -130,11 +136,12 @@
130
136
  <div class="pilwrap ">
131
137
  <a class="pilcrow" href="#section-7">&#182;</a>
132
138
  </div>
133
- <p>create file from GUID</p>
139
+ <p>get document by file GUID</p>
134
140
 
135
141
  </div>
136
142
 
137
- <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.new(<span class="symbol">guid:</span> settings.fileId)</pre></div></div>
143
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.source
144
+ <span class="keyword">when</span> <span class="string">'guid'</span></pre></div></div>
138
145
 
139
146
  </li>
140
147
 
@@ -145,11 +152,13 @@
145
152
  <div class="pilwrap ">
146
153
  <a class="pilcrow" href="#section-8">&#182;</a>
147
154
  </div>
148
- <p>create document from file</p>
155
+ <p>Create instance of File</p>
149
156
 
150
157
  </div>
151
158
 
152
- <div class="content"><div class='highlight'><pre> document = <span class="constant">GroupDocs::Document</span>.new(<span class="symbol">file:</span> file)</pre></div></div>
159
+ <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.new({<span class="symbol">:guid</span> =&gt; settings.fileId})
160
+ <span class="keyword">when</span> <span class="string">'local'</span>
161
+ 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>
153
162
 
154
163
  </li>
155
164
 
@@ -160,11 +169,11 @@
160
169
  <div class="pilwrap ">
161
170
  <a class="pilcrow" href="#section-9">&#182;</a>
162
171
  </div>
163
- <p>set new collaboration</p>
172
+ <p>Open file</p>
164
173
 
165
174
  </div>
166
175
 
167
- <div class="content"><div class='highlight'><pre> document.set_collaborators!([settings.email], <span class="number">2</span>, {<span class="symbol">:client_id</span> =&gt; settings.client_id, <span class="symbol">:private_key</span> =&gt; settings.private_key})</pre></div></div>
176
+ <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>
168
177
 
169
178
  </li>
170
179
 
@@ -175,11 +184,12 @@
175
184
  <div class="pilwrap ">
176
185
  <a class="pilcrow" href="#section-10">&#182;</a>
177
186
  </div>
178
- <p>get all collaborations</p>
187
+ <p>Make a request to API using client_id and private_key</p>
179
188
 
180
189
  </div>
181
190
 
182
- <div class="content"><div class='highlight'><pre> collaborations = document.collaborators!({<span class="symbol">:client_id</span> =&gt; settings.client_id, <span class="symbol">:private_key</span> =&gt; settings.private_key})</pre></div></div>
191
+ <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload!(filepath, {})
192
+ <span class="keyword">when</span> <span class="string">'url'</span></pre></div></div>
183
193
 
184
194
  </li>
185
195
 
@@ -190,11 +200,139 @@
190
200
  <div class="pilwrap ">
191
201
  <a class="pilcrow" href="#section-11">&#182;</a>
192
202
  </div>
193
- <p>set document reviewers</p>
203
+ <p>Upload file from defined url</p>
204
+
205
+ </div>
206
+
207
+ <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload_web!(settings.url)
208
+ <span class="keyword">else</span>
209
+ raise <span class="string">'Wrong GUID source.'</span>
210
+ <span class="keyword">end</span>
211
+
212
+
213
+ file = file.to_document</pre></div></div>
214
+
215
+ </li>
216
+
217
+
218
+ <li id="section-12">
219
+ <div class="annotation">
220
+
221
+ <div class="pilwrap ">
222
+ <a class="pilcrow" href="#section-12">&#182;</a>
223
+ </div>
224
+ <p>Create new user</p>
225
+
226
+ </div>
227
+
228
+ <div class="content"><div class='highlight'><pre> user = <span class="constant">GroupDocs::User</span>.new
229
+
230
+ user.primary_email = settings.email
231
+ user.nickname = settings.email
232
+ user.first_name = settings.first_name
233
+ user.last_name = settings.last_name
234
+
235
+ user.roles = [{<span class="symbol">:id</span> =&gt; <span class="string">'3'</span>, <span class="symbol">:name</span> =&gt; <span class="string">'User'</span>}]</pre></div></div>
236
+
237
+ </li>
238
+
239
+
240
+ <li id="section-13">
241
+ <div class="annotation">
242
+
243
+ <div class="pilwrap ">
244
+ <a class="pilcrow" href="#section-13">&#182;</a>
245
+ </div>
246
+ <p>Update account</p>
194
247
 
195
248
  </div>
196
249
 
197
- <div class="content"><div class='highlight'><pre> document.set_reviewers!(collaborations, {<span class="symbol">:client_id</span> =&gt; settings.client_id, <span class="symbol">:private_key</span> =&gt; settings.private_key})
250
+ <div class="content"><div class='highlight'><pre> new_user = <span class="constant">GroupDocs::User</span>.update_account!(user)</pre></div></div>
251
+
252
+ </li>
253
+
254
+
255
+ <li id="section-14">
256
+ <div class="annotation">
257
+
258
+ <div class="pilwrap ">
259
+ <a class="pilcrow" href="#section-14">&#182;</a>
260
+ </div>
261
+ <p>Set new collaboration</p>
262
+
263
+ </div>
264
+
265
+ <div class="content"><div class='highlight'><pre> file.set_collaborators!([settings.email], <span class="number">2</span>)</pre></div></div>
266
+
267
+ </li>
268
+
269
+
270
+ <li id="section-15">
271
+ <div class="annotation">
272
+
273
+ <div class="pilwrap ">
274
+ <a class="pilcrow" href="#section-15">&#182;</a>
275
+ </div>
276
+ <p>Get all collaborations</p>
277
+
278
+ </div>
279
+
280
+ <div class="content"><div class='highlight'><pre> collaborations = file.collaborators!()</pre></div></div>
281
+
282
+ </li>
283
+
284
+
285
+ <li id="section-16">
286
+ <div class="annotation">
287
+
288
+ <div class="pilwrap ">
289
+ <a class="pilcrow" href="#section-16">&#182;</a>
290
+ </div>
291
+ <p>Set document reviewers</p>
292
+
293
+ </div>
294
+
295
+ <div class="content"><div class='highlight'><pre> file.set_reviewers!(collaborations)</pre></div></div>
296
+
297
+ </li>
298
+
299
+
300
+ <li id="section-17">
301
+ <div class="annotation">
302
+
303
+ <div class="pilwrap ">
304
+ <a class="pilcrow" href="#section-17">&#182;</a>
305
+ </div>
306
+ <p>Get url from request</p>
307
+
308
+ </div>
309
+
310
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.base_path
311
+
312
+ <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
313
+ url = <span class="string">"http://stage-apps-groupdocs.dynabic.com/document-annotation2/embed/<span class="subst">#{file.file.guid}</span>?uid = <span class="subst">#{new_user.guid}</span>&amp;download=true"</span>
314
+ <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
315
+ url = <span class="string">"http://dev-apps-groupdocs.dynabic.com/document-annotation2/embed/<span class="subst">#{file.file.guid}</span>?uid = <span class="subst">#{new_user.guid}</span>&amp;download=true"</span>
316
+ <span class="keyword">else</span>
317
+ url = <span class="string">"https://apps.groupdocs.com/document-annotation2/embed/<span class="subst">#{file.file.guid}</span>?uid = <span class="subst">#{new_user.guid}</span>&amp;download=true"</span>
318
+ <span class="keyword">end</span></pre></div></div>
319
+
320
+ </li>
321
+
322
+
323
+ <li id="section-18">
324
+ <div class="annotation">
325
+
326
+ <div class="pilwrap ">
327
+ <a class="pilcrow" href="#section-18">&#182;</a>
328
+ </div>
329
+ <p>Add the signature to url the request</p>
330
+
331
+ </div>
332
+
333
+ <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
334
+
335
+ iframe = <span class="string">"&lt;iframe src='<span class="subst">#{iframe}</span>' frameborder='0' width='720' height='600'&gt;&lt;/iframe&gt;"</span>
198
336
 
199
337
  <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e
200
338
  err = e.message
@@ -203,17 +341,17 @@
203
341
  </li>
204
342
 
205
343
 
206
- <li id="section-12">
344
+ <li id="section-19">
207
345
  <div class="annotation">
208
346
 
209
347
  <div class="pilwrap ">
210
- <a class="pilcrow" href="#section-12">&#182;</a>
348
+ <a class="pilcrow" href="#section-19">&#182;</a>
211
349
  </div>
212
350
  <p>set variables for template</p>
213
351
 
214
352
  </div>
215
353
 
216
- <div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample22</span>, <span class="symbol">:locals</span> =&gt; {<span class="symbol">:userId</span> =&gt; settings.client_id, <span class="symbol">:privateKey</span> =&gt; settings.private_key, <span class="symbol">:fileId</span> =&gt; settings.fileId, <span class="symbol">:email</span> =&gt; settings.email, <span class="symbol">:first_name</span> =&gt; settings.first_name, <span class="symbol">:last_name</span> =&gt; settings.last_name, <span class="symbol">:err</span> =&gt; err}
354
+ <div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample22</span>, <span class="symbol">:locals</span> =&gt; {<span class="symbol">:userId</span> =&gt; settings.client_id, <span class="symbol">:privateKey</span> =&gt; settings.private_key, <span class="symbol">:fileId</span> =&gt; settings.fileId, <span class="symbol">:email</span> =&gt; settings.email, <span class="symbol">:firstName</span> =&gt; settings.first_name, <span class="symbol">:lastName</span> =&gt; settings.last_name, <span class="symbol">:iframe</span> =&gt; iframe, <span class="symbol">:err</span> =&gt; err}
217
355
  <span class="keyword">end</span></pre></div></div>
218
356
 
219
357
  </li>
@@ -64,11 +64,12 @@
64
64
  </div>
65
65
 
66
66
  <div class="content"><div class='highlight'><pre>
67
- set <span class="symbol">:client_id</span>, params[<span class="symbol">:client_id</span>]
68
- set <span class="symbol">:private_key</span>, params[<span class="symbol">:private_key</span>]
67
+ set <span class="symbol">:client_id</span>, params[<span class="symbol">:clientId</span>]
68
+ set <span class="symbol">:private_key</span>, params[<span class="symbol">:privateKey</span>]
69
69
  set <span class="symbol">:source</span>, params[<span class="symbol">:source</span>]
70
70
  set <span class="symbol">:file_id</span>, params[<span class="symbol">:fileId</span>]
71
71
  set <span class="symbol">:url</span>, params[<span class="symbol">:url</span>]
72
+ set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]
72
73
 
73
74
  <span class="keyword">begin</span></pre></div></div>
74
75
 
@@ -85,7 +86,9 @@
85
86
 
86
87
  </div>
87
88
 
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?</pre></div></div>
89
+ <div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.client_id.empty? <span class="keyword">or</span> settings.private_key.empty?
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>
89
92
 
90
93
  </li>
91
94
 
@@ -96,6 +99,39 @@
96
99
  <div class="pilwrap ">
97
100
  <a class="pilcrow" href="#section-5">&#182;</a>
98
101
  </div>
102
+ <p>Configure your access to API server</p>
103
+
104
+ </div>
105
+
106
+ <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
107
+ groupdocs.client_id = settings.client_id
108
+ groupdocs.private_key = settings.private_key</pre></div></div>
109
+
110
+ </li>
111
+
112
+
113
+ <li id="section-6">
114
+ <div class="annotation">
115
+
116
+ <div class="pilwrap ">
117
+ <a class="pilcrow" href="#section-6">&#182;</a>
118
+ </div>
119
+ <p>Optionally specify API server and version</p>
120
+
121
+ </div>
122
+
123
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
124
+ <span class="keyword">end</span></pre></div></div>
125
+
126
+ </li>
127
+
128
+
129
+ <li id="section-7">
130
+ <div class="annotation">
131
+
132
+ <div class="pilwrap ">
133
+ <a class="pilcrow" href="#section-7">&#182;</a>
134
+ </div>
99
135
  <p>get document by file GUID</p>
100
136
 
101
137
  </div>
@@ -106,11 +142,11 @@
106
142
  </li>
107
143
 
108
144
 
109
- <li id="section-6">
145
+ <li id="section-8">
110
146
  <div class="annotation">
111
147
 
112
148
  <div class="pilwrap ">
113
- <a class="pilcrow" href="#section-6">&#182;</a>
149
+ <a class="pilcrow" href="#section-8">&#182;</a>
114
150
  </div>
115
151
  <p>Create instance of File</p>
116
152
 
@@ -122,11 +158,11 @@
122
158
  </li>
123
159
 
124
160
 
125
- <li id="section-7">
161
+ <li id="section-9">
126
162
  <div class="annotation">
127
163
 
128
164
  <div class="pilwrap ">
129
- <a class="pilcrow" href="#section-7">&#182;</a>
165
+ <a class="pilcrow" href="#section-9">&#182;</a>
130
166
  </div>
131
167
  <p>Construct path</p>
132
168
 
@@ -137,11 +173,11 @@
137
173
  </li>
138
174
 
139
175
 
140
- <li id="section-8">
176
+ <li id="section-10">
141
177
  <div class="annotation">
142
178
 
143
179
  <div class="pilwrap ">
144
- <a class="pilcrow" href="#section-8">&#182;</a>
180
+ <a class="pilcrow" href="#section-10">&#182;</a>
145
181
  </div>
146
182
  <p>Open file</p>
147
183
 
@@ -152,33 +188,33 @@
152
188
  </li>
153
189
 
154
190
 
155
- <li id="section-9">
191
+ <li id="section-11">
156
192
  <div class="annotation">
157
193
 
158
194
  <div class="pilwrap ">
159
- <a class="pilcrow" href="#section-9">&#182;</a>
195
+ <a class="pilcrow" href="#section-11">&#182;</a>
160
196
  </div>
161
197
  <p>Make a request to API using client_id and private_key</p>
162
198
 
163
199
  </div>
164
200
 
165
- <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})
201
+ <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload!(file_path, {})
166
202
  <span class="keyword">when</span> <span class="string">'url'</span></pre></div></div>
167
203
 
168
204
  </li>
169
205
 
170
206
 
171
- <li id="section-10">
207
+ <li id="section-12">
172
208
  <div class="annotation">
173
209
 
174
210
  <div class="pilwrap ">
175
- <a class="pilcrow" href="#section-10">&#182;</a>
211
+ <a class="pilcrow" href="#section-12">&#182;</a>
176
212
  </div>
177
213
  <p>Upload file from defined url</p>
178
214
 
179
215
  </div>
180
216
 
181
- <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})
217
+ <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload_web!(settings.url)
182
218
  <span class="keyword">else</span>
183
219
  raise <span class="string">'Wrong GUID source.'</span>
184
220
  <span class="keyword">end</span></pre></div></div>
@@ -186,11 +222,11 @@
186
222
  </li>
187
223
 
188
224
 
189
- <li id="section-11">
225
+ <li id="section-13">
190
226
  <div class="annotation">
191
227
 
192
228
  <div class="pilwrap ">
193
- <a class="pilcrow" href="#section-11">&#182;</a>
229
+ <a class="pilcrow" href="#section-13">&#182;</a>
194
230
  </div>
195
231
  <p>Raise exception if something went wrong</p>
196
232
 
@@ -201,11 +237,11 @@
201
237
  </li>
202
238
 
203
239
 
204
- <li id="section-12">
240
+ <li id="section-14">
205
241
  <div class="annotation">
206
242
 
207
243
  <div class="pilwrap ">
208
- <a class="pilcrow" href="#section-12">&#182;</a>
244
+ <a class="pilcrow" href="#section-14">&#182;</a>
209
245
  </div>
210
246
  <p>Make GroupDocs::Storage::Document instance</p>
211
247
 
@@ -216,18 +252,18 @@
216
252
  </li>
217
253
 
218
254
 
219
- <li id="section-13">
255
+ <li id="section-15">
220
256
  <div class="annotation">
221
257
 
222
258
  <div class="pilwrap ">
223
- <a class="pilcrow" href="#section-13">&#182;</a>
259
+ <a class="pilcrow" href="#section-15">&#182;</a>
224
260
  </div>
225
261
  <p>Create new page</p>
226
262
 
227
263
  </div>
228
264
 
229
- <div class="content"><div class='highlight'><pre> page_image = document.page_images!(<span class="number">700</span>, <span class="number">700</span>, {<span class="symbol">first_page:</span> <span class="number">0</span>, <span class="symbol">page_count:</span> <span class="number">2</span>}, {<span class="symbol">:client_id</span> =&gt; settings.client_id, <span class="symbol">:private_key</span> =&gt; settings.private_key})
230
- pp page_image
265
+ <div class="content"><div class='highlight'><pre> page_image = document.page_images!(<span class="number">700</span>, <span class="number">700</span>, {})
266
+
231
267
  <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e
232
268
  err = e.message
233
269
  <span class="keyword">end</span></pre></div></div>
@@ -235,11 +271,11 @@
235
271
  </li>
236
272
 
237
273
 
238
- <li id="section-14">
274
+ <li id="section-16">
239
275
  <div class="annotation">
240
276
 
241
277
  <div class="pilwrap ">
242
- <a class="pilcrow" href="#section-14">&#182;</a>
278
+ <a class="pilcrow" href="#section-16">&#182;</a>
243
279
  </div>
244
280
  <p>set variables for template</p>
245
281