groupdocs 1.5.3 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +0 -1
- data/README.md +2 -0
- data/examples/api-samples/public/docs/annotation-sample.html +167 -57
- data/examples/api-samples/public/docs/docco.css +459 -151
- data/examples/api-samples/public/docs/envelope-sample.html +373 -131
- data/examples/api-samples/public/docs/sample1.html +126 -26
- data/examples/api-samples/public/docs/sample10.html +213 -50
- data/examples/api-samples/public/docs/sample11.html +319 -87
- data/examples/api-samples/public/docs/sample12.html +165 -40
- data/examples/api-samples/public/docs/sample13.html +166 -41
- data/examples/api-samples/public/docs/sample14.html +142 -30
- data/examples/api-samples/public/docs/sample15.html +127 -27
- data/examples/api-samples/public/docs/sample16.html +125 -25
- data/examples/api-samples/public/docs/sample17.html +188 -37
- data/examples/api-samples/public/docs/sample18.html +614 -157
- data/examples/api-samples/public/docs/sample19.html +221 -59
- data/examples/api-samples/public/docs/sample2.html +142 -30
- data/examples/api-samples/public/docs/sample20.html +176 -51
- data/examples/api-samples/public/docs/sample21.html +287 -66
- data/examples/api-samples/public/docs/sample22.html +224 -53
- data/examples/api-samples/public/docs/sample23.html +256 -0
- data/examples/api-samples/public/docs/sample24.html +143 -0
- data/examples/api-samples/public/docs/sample25.html +429 -0
- data/examples/api-samples/public/docs/sample26.html +113 -0
- data/examples/api-samples/public/docs/sample27.html +433 -0
- data/examples/api-samples/public/docs/sample28.html +185 -0
- data/examples/api-samples/public/docs/sample29.html +175 -0
- data/examples/api-samples/public/docs/sample3.html +172 -34
- data/examples/api-samples/public/docs/sample30.html +144 -0
- data/examples/api-samples/public/docs/sample31.html +734 -0
- data/examples/api-samples/public/docs/sample4.html +204 -52
- data/examples/api-samples/public/docs/sample5.html +241 -63
- data/examples/api-samples/public/docs/sample6.html +209 -48
- data/examples/api-samples/public/docs/sample7.html +155 -43
- data/examples/api-samples/public/docs/sample8.html +235 -62
- data/examples/api-samples/public/docs/sample9.html +200 -49
- data/examples/api-samples/public/templates/merge_field1_doc.docx +0 -0
- data/examples/api-samples/public/templates/merge_field2_doc.docx +0 -0
- data/examples/api-samples/samples/sample23.rb +54 -0
- data/examples/api-samples/samples/sample24.rb +30 -0
- data/examples/api-samples/samples/sample25.rb +4 -4
- data/examples/api-samples/samples/sample26.rb +25 -0
- data/examples/api-samples/samples/sample27.rb +100 -0
- data/examples/api-samples/samples/sample28.rb +47 -0
- data/examples/api-samples/samples/sample29.rb +52 -0
- data/examples/api-samples/samples/sample30.rb +39 -0
- data/examples/api-samples/samples/sample31.rb +204 -0
- data/examples/api-samples/samples/sample5.rb +5 -3
- data/examples/api-samples/samples/sample6.rb +2 -0
- data/examples/api-samples/views/_others_samples.haml +12 -0
- data/examples/api-samples/views/index.haml +12 -0
- data/examples/api-samples/views/layout.haml +1 -0
- data/examples/api-samples/views/sample1.haml +3 -2
- data/examples/api-samples/views/sample10.haml +3 -2
- data/examples/api-samples/views/sample11.haml +4 -0
- data/examples/api-samples/views/sample12.haml +4 -0
- data/examples/api-samples/views/sample13.haml +4 -0
- data/examples/api-samples/views/sample14.haml +4 -0
- data/examples/api-samples/views/sample15.haml +4 -0
- data/examples/api-samples/views/sample16.haml +4 -0
- data/examples/api-samples/views/sample17.haml +4 -0
- data/examples/api-samples/views/sample19.haml +4 -0
- data/examples/api-samples/views/sample2.haml +3 -2
- data/examples/api-samples/views/sample20.haml +4 -0
- data/examples/api-samples/views/sample21.haml +4 -0
- data/examples/api-samples/views/sample22.haml +4 -0
- data/examples/api-samples/views/sample23.haml +87 -0
- data/examples/api-samples/views/sample24.haml +44 -0
- data/examples/api-samples/views/sample26.haml +54 -0
- data/examples/api-samples/views/sample27.haml +122 -0
- data/examples/api-samples/views/sample28.haml +47 -0
- data/examples/api-samples/views/sample29.haml +70 -0
- data/examples/api-samples/views/sample3.haml +3 -2
- data/examples/api-samples/views/sample30.haml +46 -0
- data/examples/api-samples/views/sample31.haml +114 -0
- data/examples/api-samples/views/sample4.haml +3 -2
- data/examples/api-samples/views/sample5.haml +3 -2
- data/examples/api-samples/views/sample6.haml +3 -2
- data/examples/api-samples/views/sample7.haml +3 -2
- data/examples/api-samples/views/sample8.haml +3 -2
- data/examples/api-samples/views/sample9.haml +3 -2
- data/examples/viewer/Gemfile +1 -1
- data/groupdocs.gemspec +3 -3
- data/lib/groupdocs/datasource.rb +22 -0
- data/lib/groupdocs/document.rb +493 -43
- data/lib/groupdocs/document/annotation.rb +73 -0
- data/lib/groupdocs/job.rb +82 -1
- data/lib/groupdocs/post.rb +83 -0
- data/lib/groupdocs/questionnaire.rb +41 -0
- data/lib/groupdocs/signature.rb +342 -0
- data/lib/groupdocs/signature/envelope.rb +56 -0
- data/lib/groupdocs/signature/form.rb +47 -5
- data/lib/groupdocs/signature/shared/field_methods.rb +37 -0
- data/lib/groupdocs/storage/file.rb +83 -0
- data/lib/groupdocs/subscription.rb +218 -0
- data/lib/groupdocs/user.rb +422 -1
- data/lib/groupdocs/version.rb +1 -1
- data/spec/groupdocs/job_spec.rb +4 -5
- data/spec/groupdocs/user_spec.rb +157 -0
- data/spec/support/json/annotation_resize.json +11 -0
- data/spec/support/json/annotation_text_color.json +10 -0
- data/spec/support/json/annotation_text_info.json +11 -0
- data/spec/support/json/document_content_get.json +8 -0
- data/spec/support/json/document_edit_lock_get.json +10 -0
- data/spec/support/json/document_editlock_remove.json +8 -0
- data/spec/support/json/document_page_html_urls_get.json +14 -0
- data/spec/support/json/document_password_set.json +19 -0
- data/spec/support/json/document_representations.json +25 -0
- data/spec/support/json/document_shared_documents_get.json +32 -0
- data/spec/support/json/document_tags_get.json +9 -0
- data/spec/support/json/document_tags_remove.json +8 -0
- data/spec/support/json/document_tags_set.json +8 -0
- data/spec/support/json/document_user_status_set.json +12 -0
- data/spec/support/json/job_documents.json +103 -35
- data/spec/support/json/job_xml_get.json +30 -0
- data/spec/support/json/jobs_documents.json +40 -0
- data/spec/support/json/user_get_profile.json +73 -0
- metadata +49 -177
@@ -4,8 +4,9 @@
|
|
4
4
|
.samplecontent{:style => 'padding:10px;'}
|
5
5
|
%i This sample will show how to list thumbnails for documents in the GroupDocs account using Ruby SDK
|
6
6
|
%br/
|
7
|
-
%
|
8
|
-
%
|
7
|
+
%br/
|
8
|
+
%span.documentation
|
9
|
+
%a{:href => '/docs/sample7.html'} Builtin documentation for this sample
|
9
10
|
%br/
|
10
11
|
%br/
|
11
12
|
%p
|
@@ -4,8 +4,9 @@
|
|
4
4
|
.samplecontent{:style => 'padding:10px;'}
|
5
5
|
%i This sample will show how to return a URL representing a single page of particular Document in the GroupDocs account using Ruby SDK
|
6
6
|
%br/
|
7
|
-
%
|
8
|
-
%
|
7
|
+
%br/
|
8
|
+
%span.documentation
|
9
|
+
%a{:href => '/docs/sample8.html'} Builtin documentation for this sample
|
9
10
|
%br/
|
10
11
|
%br/
|
11
12
|
%p
|
@@ -4,8 +4,9 @@
|
|
4
4
|
.samplecontent{:style => 'padding:10px;'}
|
5
5
|
%i This sample will show how to generate an embedded Viewer URL for particular Document in the GroupDocs account using Ruby SDK
|
6
6
|
%br/
|
7
|
-
%
|
8
|
-
%
|
7
|
+
%br/
|
8
|
+
%span.documentation
|
9
|
+
%a{:href => '/docs/sample9.html'} Builtin documentation for this sample
|
9
10
|
%br/
|
10
11
|
%br/
|
11
12
|
%p
|
data/examples/viewer/Gemfile
CHANGED
data/groupdocs.gemspec
CHANGED
@@ -4,8 +4,8 @@ require 'groupdocs/version'
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'groupdocs'
|
6
6
|
s.version = GroupDocs::VERSION
|
7
|
-
s.authors = '
|
8
|
-
s.email = '
|
7
|
+
s.authors = 'Marketplace Team'
|
8
|
+
s.email = 'marketplace@groupdocs.com'
|
9
9
|
s.homepage = 'https://github.com/groupdocs/groupdocs-ruby'
|
10
10
|
s.summary = 'Ruby SDK for GroupDocs REST API'
|
11
11
|
s.description = 'Ruby SDK for GroupDocs REST API'
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.add_runtime_dependency 'rest-client' , '~> 1.6'
|
19
19
|
s.add_runtime_dependency 'json' , '~> 1.7'
|
20
20
|
s.add_runtime_dependency 'mime-types' , '~> 1.19'
|
21
|
-
s.add_runtime_dependency 'activesupport'
|
21
|
+
s.add_runtime_dependency 'activesupport' , '>= 3.0'
|
22
22
|
|
23
23
|
s.add_development_dependency 'rspec' , '~> 2.12'
|
24
24
|
s.add_development_dependency 'fuubar' , '~> 1.1'
|
data/lib/groupdocs/datasource.rb
CHANGED
@@ -139,6 +139,28 @@ module GroupDocs
|
|
139
139
|
end.execute!
|
140
140
|
end
|
141
141
|
|
142
|
+
#
|
143
|
+
# Updates datasource.
|
144
|
+
#
|
145
|
+
# @example
|
146
|
+
# field = GroupDocs::DataSource::Field.new(field: 'test', values: %w(test test))
|
147
|
+
# datasource = GroupDocs::DataSource.get!(180)
|
148
|
+
# datasource.add_field(field)
|
149
|
+
# datasource.update_fields!
|
150
|
+
#
|
151
|
+
# @param [Hash] access Access credentials
|
152
|
+
# @option access [String] :client_id
|
153
|
+
# @option access [String] :private_key
|
154
|
+
#
|
155
|
+
def update_fields!(access = {})
|
156
|
+
Api::Request.new do |request|
|
157
|
+
request[:access] = access
|
158
|
+
request[:method] = :PUT
|
159
|
+
request[:path] = "/merge/{{client_id}}/datasources/#{id}/fields"
|
160
|
+
request[:request_body] = to_hash
|
161
|
+
end.execute!
|
162
|
+
end
|
163
|
+
|
142
164
|
#
|
143
165
|
# Removes datasource.
|
144
166
|
#
|
data/lib/groupdocs/document.rb
CHANGED
@@ -9,11 +9,11 @@ module GroupDocs
|
|
9
9
|
require 'groupdocs/document/view'
|
10
10
|
|
11
11
|
ACCESS_MODES = {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
:private => 0,
|
13
|
+
:restricted => 1,
|
14
|
+
:public => 2,
|
15
|
+
:inherited => 254,
|
16
|
+
:denied => 255,
|
17
17
|
}
|
18
18
|
|
19
19
|
include Api::Helpers::AccessMode
|
@@ -141,6 +141,24 @@ module GroupDocs
|
|
141
141
|
signed_documents
|
142
142
|
end
|
143
143
|
|
144
|
+
#
|
145
|
+
# Get sign documents status
|
146
|
+
#
|
147
|
+
# @param [String] job_guid
|
148
|
+
# @param [Hash] access Access credentials
|
149
|
+
# @option access [String] :client_id
|
150
|
+
# @option access [String] :private_key
|
151
|
+
#
|
152
|
+
def document_status!(job_guid, access = {})
|
153
|
+
json = Api::Request.new do |request|
|
154
|
+
request[:access] = access
|
155
|
+
request[:method] = :PUT
|
156
|
+
request[:path] = "/signature/{{client_id}}/documents/#{job_guid}"
|
157
|
+
end.execute!
|
158
|
+
|
159
|
+
json[:documents]
|
160
|
+
end
|
161
|
+
|
144
162
|
#
|
145
163
|
# Returns a document metadata by given path.
|
146
164
|
#
|
@@ -184,40 +202,40 @@ module GroupDocs
|
|
184
202
|
# @attr [Integer] field_count
|
185
203
|
attr_accessor :field_count
|
186
204
|
[
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
205
|
+
:news ,
|
206
|
+
:alerts ,
|
207
|
+
:support ,
|
208
|
+
:is_real_time_broadcast ,
|
209
|
+
:is_scroll_broadcast ,
|
210
|
+
:is_zoom_broadcast ,
|
211
|
+
:is_annotation_navigation_widget ,
|
212
|
+
:is_annotation_zoom_widget ,
|
213
|
+
:is_annotation_download_widget ,
|
214
|
+
:is_annotation_print_widget ,
|
215
|
+
:is_annotation_help_widget ,
|
216
|
+
:is_right_panel ,
|
217
|
+
:is_thumbnails_panel ,
|
218
|
+
:is_toolbar ,
|
219
|
+
:is_text_annotation_button ,
|
220
|
+
:is_rectangle_annotation_button ,
|
221
|
+
:is_point_annotation_button ,
|
222
|
+
:is_strikeout_annotation_button ,
|
223
|
+
:is_polyline_annotation_button ,
|
224
|
+
:is_typewriter_annotation_button ,
|
225
|
+
:is_watermark_annotation_button ,
|
226
|
+
:is_viewer_navigation_widget ,
|
227
|
+
:is_viewer_zoom_widget ,
|
228
|
+
:is_viewer_download_widget ,
|
229
|
+
:is_viewer_print_widget ,
|
230
|
+
:is_viewer_help_widget ,
|
213
231
|
].each do |option|
|
214
232
|
# @attr [Boolean] option
|
215
233
|
attr_accessor :"#{option}_enabled"
|
216
234
|
end
|
217
235
|
[
|
218
|
-
|
219
|
-
|
220
|
-
|
236
|
+
:standard_header_always ,
|
237
|
+
:annotation_document_name ,
|
238
|
+
:viewer_document_name ,
|
221
239
|
].each do |option|
|
222
240
|
# @attr [Boolean] option
|
223
241
|
attr_accessor :"is_#{option}_shown"
|
@@ -277,7 +295,101 @@ module GroupDocs
|
|
277
295
|
def initialize(options = {}, &blk)
|
278
296
|
super(options, &blk)
|
279
297
|
file.is_a?(GroupDocs::Storage::File) or raise ArgumentError,
|
280
|
-
|
298
|
+
"You have to pass GroupDocs::Storage::File object: #{file.inspect}."
|
299
|
+
end
|
300
|
+
|
301
|
+
#
|
302
|
+
# Returns a stream of bytes representing a particular document page image.
|
303
|
+
#
|
304
|
+
#
|
305
|
+
# @param [Integer] page_number Document page number to get image for
|
306
|
+
# @param [Integer] dimension Image dimension "<width>x<height>"(500x600)
|
307
|
+
# @param [Hash] options
|
308
|
+
# @option options [Integer] :quality Image quality in range 1-100.
|
309
|
+
# @option options [Boolean] :use_pdf A flag indicating whether a document should be converted to PDF format before generating the image.
|
310
|
+
# @option options [Boolean] :expires The date and time in milliseconds since epoch the URL expires.
|
311
|
+
# @param [Hash] access Access credentials
|
312
|
+
# @option access [String] :client_id
|
313
|
+
# @option access [String] :private_key
|
314
|
+
# @return []
|
315
|
+
#
|
316
|
+
def page_image!(path, name, page_number, dimension, options = {}, access = {})
|
317
|
+
api = Api::Request.new do |request|
|
318
|
+
request[:access] = access
|
319
|
+
request[:method] = :DOWNLOAD
|
320
|
+
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/pages/#{page_number}/images/#{dimension}"
|
321
|
+
end
|
322
|
+
api.add_params(options)
|
323
|
+
response = api.execute!
|
324
|
+
|
325
|
+
filepath = "#{path}/#{name}"
|
326
|
+
Object::File.open(filepath, 'wb') do |file|
|
327
|
+
file.write(response)
|
328
|
+
end
|
329
|
+
|
330
|
+
filepath
|
331
|
+
|
332
|
+
end
|
333
|
+
|
334
|
+
|
335
|
+
#
|
336
|
+
# Returns an HTML Fixed representation of a particular document page
|
337
|
+
#
|
338
|
+
#
|
339
|
+
# @param [Integer] page_number Document page number to get html for
|
340
|
+
# @param [Hash] options
|
341
|
+
# @option options [Boolean] :expires The date and time in milliseconds since epoch the URL expires.
|
342
|
+
# @param [Hash] access Access credentials
|
343
|
+
# @option access [String] :client_id
|
344
|
+
# @option access [String] :private_key
|
345
|
+
# @return []
|
346
|
+
#
|
347
|
+
def page_fixed_html!(path, name, page_number, options = {}, access = {})
|
348
|
+
api = Api::Request.new do |request|
|
349
|
+
request[:access] = access
|
350
|
+
request[:method] = :DOWNLOAD
|
351
|
+
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/pages/#{page_number}/htmlFixed"
|
352
|
+
end
|
353
|
+
api.add_params(options)
|
354
|
+
response = api.execute!
|
355
|
+
|
356
|
+
filepath = "#{path}/#{name}"
|
357
|
+
Object::File.open(filepath, 'wb') do |file|
|
358
|
+
file.write(response)
|
359
|
+
end
|
360
|
+
|
361
|
+
filepath
|
362
|
+
|
363
|
+
end
|
364
|
+
|
365
|
+
#
|
366
|
+
# Returns an HTML representation of a particular document page
|
367
|
+
#
|
368
|
+
#
|
369
|
+
# @param [Integer] page_number Document page number to get html for
|
370
|
+
# @param [Hash] options
|
371
|
+
# @option options [Boolean] :expires The date and time in milliseconds since epoch the URL expires.
|
372
|
+
# @param [Hash] access Access credentials
|
373
|
+
# @option access [String] :client_id
|
374
|
+
# @option access [String] :private_key
|
375
|
+
# @return []
|
376
|
+
#
|
377
|
+
def page_html!(path, name, page_number, options = {}, access = {})
|
378
|
+
api = Api::Request.new do |request|
|
379
|
+
request[:access] = access
|
380
|
+
request[:method] = :DOWNLOAD
|
381
|
+
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/pages/#{page_number}/htmlRepresentations"
|
382
|
+
end
|
383
|
+
api.add_params(options)
|
384
|
+
response = api.execute!
|
385
|
+
|
386
|
+
filepath = "#{path}/#{name}"
|
387
|
+
Object::File.open(filepath, 'wb') do |file|
|
388
|
+
file.write(response)
|
389
|
+
end
|
390
|
+
|
391
|
+
filepath
|
392
|
+
|
281
393
|
end
|
282
394
|
|
283
395
|
#
|
@@ -313,6 +425,143 @@ module GroupDocs
|
|
313
425
|
json[:url]
|
314
426
|
end
|
315
427
|
|
428
|
+
#
|
429
|
+
# Returns array of URLs to html representing document pages.
|
430
|
+
#
|
431
|
+
# @example
|
432
|
+
# file = GroupDocs::Storage::Folder.list!.last
|
433
|
+
# document = file.to_document
|
434
|
+
# document.page_html_urls! 1024, 768, first_page: 0, page_count: 1
|
435
|
+
#
|
436
|
+
# @param [Hash] options
|
437
|
+
# @option options [Integer] :first_page Start page to return image for (starting with 0)
|
438
|
+
# @option options [Integer] :page_count Number of pages to return image for
|
439
|
+
# @param [Hash] access Access credentials
|
440
|
+
# @option access [String] :client_id
|
441
|
+
# @option access [String] :private_key
|
442
|
+
# @return [Array<String>]
|
443
|
+
#
|
444
|
+
def page_html_urls!(options = {}, access = {})
|
445
|
+
api = Api::Request.new do |request|
|
446
|
+
request[:access] = access
|
447
|
+
request[:method] = :GET
|
448
|
+
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/pages/htmlRepresentationUrls"
|
449
|
+
end
|
450
|
+
api.add_params(options)
|
451
|
+
json = api.execute!
|
452
|
+
|
453
|
+
json[:url]
|
454
|
+
end
|
455
|
+
|
456
|
+
#
|
457
|
+
# Returns editing metadata.
|
458
|
+
#
|
459
|
+
# @param [Hash] access Access credentials
|
460
|
+
# @option access [String] :client_id
|
461
|
+
# @option access [String] :private_key
|
462
|
+
#
|
463
|
+
def editlock!(access = {})
|
464
|
+
json = Api::Request.new do |request|
|
465
|
+
request[:access] = access
|
466
|
+
request[:method] = :GET
|
467
|
+
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/editlock"
|
468
|
+
end.execute!
|
469
|
+
|
470
|
+
json[:edit_url]
|
471
|
+
end
|
472
|
+
|
473
|
+
#
|
474
|
+
# Removes edit lock for a document and replaces the document with its edited copy
|
475
|
+
#
|
476
|
+
# @param [Hash] options
|
477
|
+
# @option options [String] :lockId Start page to return image for (starting with 0)
|
478
|
+
# @param [Hash] access Access credentials
|
479
|
+
# @option access [String] :client_id
|
480
|
+
# @option access [String] :private_key
|
481
|
+
# @return [Integer]
|
482
|
+
#
|
483
|
+
def editlock_clear!(options = {}, access = {})
|
484
|
+
api = Api::Request.new do |request|
|
485
|
+
request[:access] = access
|
486
|
+
request[:method] = :DELETE
|
487
|
+
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/editlock"
|
488
|
+
end
|
489
|
+
api.add_params(options).execute!
|
490
|
+
|
491
|
+
end
|
492
|
+
|
493
|
+
#
|
494
|
+
# Returns tags assigned to the document
|
495
|
+
#
|
496
|
+
# @param [Hash] access Access credentials
|
497
|
+
# @option access [String] :client_id
|
498
|
+
# @option access [String] :private_key
|
499
|
+
# @return [Array<String>]
|
500
|
+
#
|
501
|
+
def tags!(access = {})
|
502
|
+
Api::Request.new do |request|
|
503
|
+
request[:access] = access
|
504
|
+
request[:method] = :GET
|
505
|
+
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/tags"
|
506
|
+
end.execute!
|
507
|
+
|
508
|
+
end
|
509
|
+
|
510
|
+
#
|
511
|
+
# Assign tags to the document.
|
512
|
+
#
|
513
|
+
# @param [Hash] access Access credentials
|
514
|
+
# @option access [String] :client_id
|
515
|
+
# @option access [String] :private_key
|
516
|
+
# @return [String]
|
517
|
+
#
|
518
|
+
def tags_set!(access = {})
|
519
|
+
json = Api::Request.new do |request|
|
520
|
+
request[:access] = access
|
521
|
+
request[:method] = :PUT
|
522
|
+
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/tags"
|
523
|
+
end.execute!
|
524
|
+
|
525
|
+
json[:document_id]
|
526
|
+
end
|
527
|
+
|
528
|
+
#
|
529
|
+
# Removes tags assigned to the document
|
530
|
+
#
|
531
|
+
# @param [Hash] access Access credentials
|
532
|
+
# @option access [String] :client_id
|
533
|
+
# @option access [String] :private_key
|
534
|
+
# @return [String]
|
535
|
+
#
|
536
|
+
def tags_clear!(access = {})
|
537
|
+
json = Api::Request.new do |request|
|
538
|
+
request[:access] = access
|
539
|
+
request[:method] = :DELETE
|
540
|
+
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/tags"
|
541
|
+
end.execute!
|
542
|
+
|
543
|
+
json[:document_id]
|
544
|
+
end
|
545
|
+
|
546
|
+
#
|
547
|
+
# Returns document content
|
548
|
+
#
|
549
|
+
# @param [String] content_type Content type
|
550
|
+
# @param [Hash] access Access credentials
|
551
|
+
# @option access [String] :client_id
|
552
|
+
# @option access [String] :private_key
|
553
|
+
# @return [String]
|
554
|
+
#
|
555
|
+
def content!(content_type, access = {})
|
556
|
+
json = Api::Request.new do |request|
|
557
|
+
request[:access] = access
|
558
|
+
request[:method] = :GET
|
559
|
+
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/content/#{content_type}"
|
560
|
+
end.execute!
|
561
|
+
|
562
|
+
json[:content]
|
563
|
+
end
|
564
|
+
|
316
565
|
#
|
317
566
|
# Returns array of URLs to images representing document pages thumbnails.
|
318
567
|
#
|
@@ -344,6 +593,36 @@ module GroupDocs
|
|
344
593
|
json[:image_urls]
|
345
594
|
end
|
346
595
|
|
596
|
+
#
|
597
|
+
# Returns array of URLs to images representing document pages htmlRepresentations.
|
598
|
+
#
|
599
|
+
# @example
|
600
|
+
# file = GroupDocs::Storage::Folder.list!.last
|
601
|
+
# document = file.to_document
|
602
|
+
# document.thumbnails! first_page: 0, page_count: 1, passwordSalt: ***
|
603
|
+
#
|
604
|
+
# @param [Hash] options
|
605
|
+
# @option options [Integer] :page_number Start page to return image for (starting with 0)
|
606
|
+
# @option options [Integer] :page_count Number of pages to return image for
|
607
|
+
# @option options [Integer] :passwordSalt
|
608
|
+
# @param [Hash] access Access credentials
|
609
|
+
# @option access [String] :client_id
|
610
|
+
# @option access [String] :private_key
|
611
|
+
# @return [Array<String>]
|
612
|
+
#
|
613
|
+
def representations!(options = {}, access = {})
|
614
|
+
api = Api::Request.new do |request|
|
615
|
+
request[:access] = access
|
616
|
+
request[:method] = :POST
|
617
|
+
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/htmlRepresentations"
|
618
|
+
end
|
619
|
+
api.add_params(options)
|
620
|
+
json = api.execute!
|
621
|
+
|
622
|
+
json[:pageHtml]
|
623
|
+
end
|
624
|
+
|
625
|
+
|
347
626
|
#
|
348
627
|
# Returns access mode of document.
|
349
628
|
#
|
@@ -356,7 +635,7 @@ module GroupDocs
|
|
356
635
|
json = Api::Request.new do |request|
|
357
636
|
request[:access] = access
|
358
637
|
request[:method] = :GET
|
359
|
-
request[:path] = "/doc/{{client_id}}/files/#{file.
|
638
|
+
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/accessinfo"
|
360
639
|
end.execute!
|
361
640
|
|
362
641
|
parse_access_mode(json[:access])
|
@@ -375,7 +654,7 @@ module GroupDocs
|
|
375
654
|
api = Api::Request.new do |request|
|
376
655
|
request[:access] = access
|
377
656
|
request[:method] = :PUT
|
378
|
-
request[:path] = "/doc/{{client_id}}/files/#{file.
|
657
|
+
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/accessinfo"
|
379
658
|
end
|
380
659
|
api.add_params(:mode => ACCESS_MODES[mode])
|
381
660
|
json = api.execute!
|
@@ -474,6 +753,29 @@ module GroupDocs
|
|
474
753
|
end
|
475
754
|
end
|
476
755
|
|
756
|
+
#
|
757
|
+
# Returns an array of users a document is shared with.
|
758
|
+
# @param [String] sharers_types
|
759
|
+
# @param [Hash] options
|
760
|
+
# @option options [String] :page_index
|
761
|
+
# @option options [String] :page_size
|
762
|
+
# @option options [String] :order_by
|
763
|
+
# @option options [Boolean] :order_ask
|
764
|
+
# @param [Hash] access Access credentials
|
765
|
+
# @option access [String] :client_id
|
766
|
+
# @option access [String] :private_key
|
767
|
+
# @return [Array<GroupDocs::User>]
|
768
|
+
#
|
769
|
+
def shared_documents!(sharers_types, options = {}, access = {})
|
770
|
+
api = Api::Request.new do |request|
|
771
|
+
request[:access] = access
|
772
|
+
request[:method] = :GET
|
773
|
+
request[:path] = "/doc/{{client_id}}/shares/#{sharers_types}"
|
774
|
+
end
|
775
|
+
api.add_params(options).execute!
|
776
|
+
|
777
|
+
end
|
778
|
+
|
477
779
|
#
|
478
780
|
# Sets document sharers to given emails.
|
479
781
|
#
|
@@ -502,6 +804,44 @@ module GroupDocs
|
|
502
804
|
end
|
503
805
|
end
|
504
806
|
|
807
|
+
#
|
808
|
+
# Sets document password.
|
809
|
+
#
|
810
|
+
# @param [String] password New password for document
|
811
|
+
# @param [Hash] access Access credentials
|
812
|
+
# @option access [String] :client_id
|
813
|
+
# @option access [String] :private_key
|
814
|
+
# @return [Array<GroupDocs::User>]
|
815
|
+
#
|
816
|
+
def password_set!(password, access = {})
|
817
|
+
Api::Request.new do |request|
|
818
|
+
request[:access] = access
|
819
|
+
request[:method] = :PUT
|
820
|
+
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/password"
|
821
|
+
request[:request_body] = password
|
822
|
+
end.execute!
|
823
|
+
|
824
|
+
end
|
825
|
+
|
826
|
+
#
|
827
|
+
# Sets document user status.
|
828
|
+
#
|
829
|
+
# @param [String] status
|
830
|
+
# @param [Hash] access Access credentials
|
831
|
+
# @option access [String] :client_id
|
832
|
+
# @option access [String] :private_key
|
833
|
+
# @return [String]
|
834
|
+
#
|
835
|
+
def user_status_set!(status, access = {})
|
836
|
+
Api::Request.new do |request|
|
837
|
+
request[:access] = access
|
838
|
+
request[:method] = :PUT
|
839
|
+
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/sharer"
|
840
|
+
request[:request_body] = status
|
841
|
+
end.execute!
|
842
|
+
|
843
|
+
end
|
844
|
+
|
505
845
|
#
|
506
846
|
# Clears sharers list.
|
507
847
|
#
|
@@ -516,6 +856,7 @@ module GroupDocs
|
|
516
856
|
request[:method] = :DELETE
|
517
857
|
request[:path] = "/doc/{{client_id}}/files/#{file.id}/sharers"
|
518
858
|
end.execute![:shared_users]
|
859
|
+
|
519
860
|
end
|
520
861
|
|
521
862
|
#
|
@@ -570,7 +911,7 @@ module GroupDocs
|
|
570
911
|
#
|
571
912
|
def datasource!(datasource, options = {}, access = {})
|
572
913
|
datasource.is_a?(GroupDocs::DataSource) or raise ArgumentError,
|
573
|
-
|
914
|
+
"Datasource should be GroupDocs::DataSource object, received: #{datasource.inspect}"
|
574
915
|
|
575
916
|
api = Api::Request.new do |request|
|
576
917
|
request[:access] = access
|
@@ -583,6 +924,39 @@ module GroupDocs
|
|
583
924
|
Job.new(:id => json[:job_id])
|
584
925
|
end
|
585
926
|
|
927
|
+
#
|
928
|
+
# Creates new job to merge datasource fields into document.
|
929
|
+
#
|
930
|
+
# @param [GroupDocs::DataSource] datasource
|
931
|
+
# @param [Hash] options
|
932
|
+
# @option options [Boolean] :new_type New file format type
|
933
|
+
# @option options [Boolean] :email_results Set to true if converted document should be emailed
|
934
|
+
# @option options [Boolean] :assembly_name
|
935
|
+
# @param [Array] datasourceFields (:name [String], :value [String], :contentType [String], :type [String], :nested_fields [<Array> datasourceFields])
|
936
|
+
# @param [Hash] access Access credentials
|
937
|
+
# @option access [String] :client_id
|
938
|
+
# @option access [String] :private_key
|
939
|
+
# @return [GroupDocs::Job]
|
940
|
+
#
|
941
|
+
# @raise [ArgumentError] if datasource is not GroupDocs::DataSource object
|
942
|
+
#
|
943
|
+
def datasource_fields!(datasource, datasourceFields, options = {}, access = {})
|
944
|
+
datasource.is_a?(GroupDocs::DataSource) or raise ArgumentError,
|
945
|
+
"Datasource should be GroupDocs::DataSource object, received: #{datasource.inspect}"
|
946
|
+
|
947
|
+
api = Api::Request.new do |request|
|
948
|
+
request[:access] = access
|
949
|
+
request[:method] = :POST
|
950
|
+
request[:path] = "/merge/{{client_id}}/files/#{file.guid}/datasources/"
|
951
|
+
request[:request_body] = datasourceFields
|
952
|
+
end
|
953
|
+
api.add_params(options)
|
954
|
+
json = api.execute!
|
955
|
+
|
956
|
+
Job.new(:id => json[:job_id])
|
957
|
+
end
|
958
|
+
|
959
|
+
|
586
960
|
#
|
587
961
|
# Returns an array of questionnaires.
|
588
962
|
#
|
@@ -615,7 +989,7 @@ module GroupDocs
|
|
615
989
|
#
|
616
990
|
def add_questionnaire!(questionnaire, access = {})
|
617
991
|
questionnaire.is_a?(GroupDocs::Questionnaire) or raise ArgumentError,
|
618
|
-
|
992
|
+
"Questionnaire should be GroupDocs::Questionnaire object, received: #{questionnaire.inspect}"
|
619
993
|
|
620
994
|
Api::Request.new do |request|
|
621
995
|
request[:access] = access
|
@@ -637,7 +1011,7 @@ module GroupDocs
|
|
637
1011
|
#
|
638
1012
|
def create_questionnaire!(questionnaire, access = {})
|
639
1013
|
questionnaire.is_a?(GroupDocs::Questionnaire) or raise ArgumentError,
|
640
|
-
|
1014
|
+
"Questionnaire should be GroupDocs::Questionnaire object, received: #{questionnaire.inspect}"
|
641
1015
|
|
642
1016
|
json = Api::Request.new do |request|
|
643
1017
|
request[:access] = access
|
@@ -662,7 +1036,7 @@ module GroupDocs
|
|
662
1036
|
#
|
663
1037
|
def remove_questionnaire!(questionnaire, access = {})
|
664
1038
|
questionnaire.is_a?(GroupDocs::Questionnaire) or raise ArgumentError,
|
665
|
-
|
1039
|
+
"Questionnaire should be GroupDocs::Questionnaire object, received: #{questionnaire.inspect}"
|
666
1040
|
|
667
1041
|
Api::Request.new do |request|
|
668
1042
|
request[:access] = access
|
@@ -727,7 +1101,7 @@ module GroupDocs
|
|
727
1101
|
#
|
728
1102
|
def compare!(document, access = {})
|
729
1103
|
document.is_a?(GroupDocs::Document) or raise ArgumentError,
|
730
|
-
|
1104
|
+
"Document should be GroupDocs::Document object, received: #{document.inspect}"
|
731
1105
|
|
732
1106
|
api = Api::Request.new do |request|
|
733
1107
|
request[:access] = access
|
@@ -740,6 +1114,37 @@ module GroupDocs
|
|
740
1114
|
Job.new(:id => json[:job_id])
|
741
1115
|
end
|
742
1116
|
|
1117
|
+
#
|
1118
|
+
# Schedules a job for comparing document with given.
|
1119
|
+
#
|
1120
|
+
# @param [Array] changes Comparison changes to update (accept or reject)
|
1121
|
+
# @option id [Float] :id
|
1122
|
+
# @option type [String] :type
|
1123
|
+
# @option action [String] :action
|
1124
|
+
# @option Page [Array] :page
|
1125
|
+
# @option box [Array] :box
|
1126
|
+
# @option text [String] :text
|
1127
|
+
# @param [Hash] access Access credentials
|
1128
|
+
# @option access [String] :client_id
|
1129
|
+
# @option access [String] :private_key
|
1130
|
+
# @return [GroupDocs::Change]
|
1131
|
+
#
|
1132
|
+
def update_changes!(changes, access = {})
|
1133
|
+
|
1134
|
+
api = Api::Request.new do |request|
|
1135
|
+
request[:access] = access
|
1136
|
+
request[:method] = :PUT
|
1137
|
+
request[:path] = "/comparison/{{client_id}}/comparison/changes"
|
1138
|
+
request[:request_body] = changes
|
1139
|
+
end
|
1140
|
+
api.add_params(:resultFileId => file.guid)
|
1141
|
+
json = api.execute!
|
1142
|
+
|
1143
|
+
json[:changes].map do |change|
|
1144
|
+
Document::Change.new(change)
|
1145
|
+
end
|
1146
|
+
end
|
1147
|
+
|
743
1148
|
#
|
744
1149
|
# Returns an array of changes in document.
|
745
1150
|
#
|
@@ -769,6 +1174,33 @@ module GroupDocs
|
|
769
1174
|
end
|
770
1175
|
end
|
771
1176
|
|
1177
|
+
#
|
1178
|
+
# Download comparison result file.
|
1179
|
+
#
|
1180
|
+
# @param [Hash] options
|
1181
|
+
# @option format [String] :format Comparison result file GUID
|
1182
|
+
# @option resultFileId [String] :resultFileId Comparison result file GUID
|
1183
|
+
# @param [Hash] access Access credentials
|
1184
|
+
# @option access [String] :client_id
|
1185
|
+
# @option access [String] :private_key
|
1186
|
+
#
|
1187
|
+
#
|
1188
|
+
def download!( path, name, options = {}, access = {})
|
1189
|
+
api = Api::Request.new do |request|
|
1190
|
+
request[:access] = access
|
1191
|
+
request[:method] = :DOWNLOAD
|
1192
|
+
request[:path] = "/comparison/{{client_id}}/comparison/download"
|
1193
|
+
end
|
1194
|
+
api.add_params(options)
|
1195
|
+
response = api.execute!
|
1196
|
+
|
1197
|
+
filepath = "#{path}/#{name}"
|
1198
|
+
Object::File.open(filepath, 'wb') do |file|
|
1199
|
+
file.write(response)
|
1200
|
+
end
|
1201
|
+
|
1202
|
+
end
|
1203
|
+
|
772
1204
|
#
|
773
1205
|
# Returns document annotations collaborators.
|
774
1206
|
#
|
@@ -822,7 +1254,7 @@ module GroupDocs
|
|
822
1254
|
#
|
823
1255
|
def add_collaborator!(collaborator, access = {})
|
824
1256
|
collaborator.is_a?(GroupDocs::User) or raise ArgumentError,
|
825
|
-
|
1257
|
+
"Collaborator should be GroupDocs::User object, received: #{collaborator.inspect}"
|
826
1258
|
|
827
1259
|
Api::Request.new do |request|
|
828
1260
|
request[:access] = access
|
@@ -832,6 +1264,24 @@ module GroupDocs
|
|
832
1264
|
end.execute!
|
833
1265
|
end
|
834
1266
|
|
1267
|
+
|
1268
|
+
#
|
1269
|
+
# Delete document reviewer
|
1270
|
+
#
|
1271
|
+
# @param [String] reviewerId Reviewer Id
|
1272
|
+
# @param [Hash] access Access credentials
|
1273
|
+
# @option access [String] :client_id
|
1274
|
+
# @option access [String] :private_key
|
1275
|
+
#
|
1276
|
+
def remove_collaborators!(reviewerId, access = {})
|
1277
|
+
Api::Request.new do |request|
|
1278
|
+
request[:access] = access
|
1279
|
+
request[:method] = :DELETE
|
1280
|
+
request[:path] = "/ant/{{client_id}}/files/#{file.guid}/collaborators/#{reviewerId}"
|
1281
|
+
end.execute!
|
1282
|
+
|
1283
|
+
end
|
1284
|
+
|
835
1285
|
#
|
836
1286
|
# Sets reviewers for document.
|
837
1287
|
#
|