groupdocs 1.5.3 → 1.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. data/.travis.yml +0 -1
  2. data/README.md +2 -0
  3. data/examples/api-samples/public/docs/annotation-sample.html +167 -57
  4. data/examples/api-samples/public/docs/docco.css +459 -151
  5. data/examples/api-samples/public/docs/envelope-sample.html +373 -131
  6. data/examples/api-samples/public/docs/sample1.html +126 -26
  7. data/examples/api-samples/public/docs/sample10.html +213 -50
  8. data/examples/api-samples/public/docs/sample11.html +319 -87
  9. data/examples/api-samples/public/docs/sample12.html +165 -40
  10. data/examples/api-samples/public/docs/sample13.html +166 -41
  11. data/examples/api-samples/public/docs/sample14.html +142 -30
  12. data/examples/api-samples/public/docs/sample15.html +127 -27
  13. data/examples/api-samples/public/docs/sample16.html +125 -25
  14. data/examples/api-samples/public/docs/sample17.html +188 -37
  15. data/examples/api-samples/public/docs/sample18.html +614 -157
  16. data/examples/api-samples/public/docs/sample19.html +221 -59
  17. data/examples/api-samples/public/docs/sample2.html +142 -30
  18. data/examples/api-samples/public/docs/sample20.html +176 -51
  19. data/examples/api-samples/public/docs/sample21.html +287 -66
  20. data/examples/api-samples/public/docs/sample22.html +224 -53
  21. data/examples/api-samples/public/docs/sample23.html +256 -0
  22. data/examples/api-samples/public/docs/sample24.html +143 -0
  23. data/examples/api-samples/public/docs/sample25.html +429 -0
  24. data/examples/api-samples/public/docs/sample26.html +113 -0
  25. data/examples/api-samples/public/docs/sample27.html +433 -0
  26. data/examples/api-samples/public/docs/sample28.html +185 -0
  27. data/examples/api-samples/public/docs/sample29.html +175 -0
  28. data/examples/api-samples/public/docs/sample3.html +172 -34
  29. data/examples/api-samples/public/docs/sample30.html +144 -0
  30. data/examples/api-samples/public/docs/sample31.html +734 -0
  31. data/examples/api-samples/public/docs/sample4.html +204 -52
  32. data/examples/api-samples/public/docs/sample5.html +241 -63
  33. data/examples/api-samples/public/docs/sample6.html +209 -48
  34. data/examples/api-samples/public/docs/sample7.html +155 -43
  35. data/examples/api-samples/public/docs/sample8.html +235 -62
  36. data/examples/api-samples/public/docs/sample9.html +200 -49
  37. data/examples/api-samples/public/templates/merge_field1_doc.docx +0 -0
  38. data/examples/api-samples/public/templates/merge_field2_doc.docx +0 -0
  39. data/examples/api-samples/samples/sample23.rb +54 -0
  40. data/examples/api-samples/samples/sample24.rb +30 -0
  41. data/examples/api-samples/samples/sample25.rb +4 -4
  42. data/examples/api-samples/samples/sample26.rb +25 -0
  43. data/examples/api-samples/samples/sample27.rb +100 -0
  44. data/examples/api-samples/samples/sample28.rb +47 -0
  45. data/examples/api-samples/samples/sample29.rb +52 -0
  46. data/examples/api-samples/samples/sample30.rb +39 -0
  47. data/examples/api-samples/samples/sample31.rb +204 -0
  48. data/examples/api-samples/samples/sample5.rb +5 -3
  49. data/examples/api-samples/samples/sample6.rb +2 -0
  50. data/examples/api-samples/views/_others_samples.haml +12 -0
  51. data/examples/api-samples/views/index.haml +12 -0
  52. data/examples/api-samples/views/layout.haml +1 -0
  53. data/examples/api-samples/views/sample1.haml +3 -2
  54. data/examples/api-samples/views/sample10.haml +3 -2
  55. data/examples/api-samples/views/sample11.haml +4 -0
  56. data/examples/api-samples/views/sample12.haml +4 -0
  57. data/examples/api-samples/views/sample13.haml +4 -0
  58. data/examples/api-samples/views/sample14.haml +4 -0
  59. data/examples/api-samples/views/sample15.haml +4 -0
  60. data/examples/api-samples/views/sample16.haml +4 -0
  61. data/examples/api-samples/views/sample17.haml +4 -0
  62. data/examples/api-samples/views/sample19.haml +4 -0
  63. data/examples/api-samples/views/sample2.haml +3 -2
  64. data/examples/api-samples/views/sample20.haml +4 -0
  65. data/examples/api-samples/views/sample21.haml +4 -0
  66. data/examples/api-samples/views/sample22.haml +4 -0
  67. data/examples/api-samples/views/sample23.haml +87 -0
  68. data/examples/api-samples/views/sample24.haml +44 -0
  69. data/examples/api-samples/views/sample26.haml +54 -0
  70. data/examples/api-samples/views/sample27.haml +122 -0
  71. data/examples/api-samples/views/sample28.haml +47 -0
  72. data/examples/api-samples/views/sample29.haml +70 -0
  73. data/examples/api-samples/views/sample3.haml +3 -2
  74. data/examples/api-samples/views/sample30.haml +46 -0
  75. data/examples/api-samples/views/sample31.haml +114 -0
  76. data/examples/api-samples/views/sample4.haml +3 -2
  77. data/examples/api-samples/views/sample5.haml +3 -2
  78. data/examples/api-samples/views/sample6.haml +3 -2
  79. data/examples/api-samples/views/sample7.haml +3 -2
  80. data/examples/api-samples/views/sample8.haml +3 -2
  81. data/examples/api-samples/views/sample9.haml +3 -2
  82. data/examples/viewer/Gemfile +1 -1
  83. data/groupdocs.gemspec +3 -3
  84. data/lib/groupdocs/datasource.rb +22 -0
  85. data/lib/groupdocs/document.rb +493 -43
  86. data/lib/groupdocs/document/annotation.rb +73 -0
  87. data/lib/groupdocs/job.rb +82 -1
  88. data/lib/groupdocs/post.rb +83 -0
  89. data/lib/groupdocs/questionnaire.rb +41 -0
  90. data/lib/groupdocs/signature.rb +342 -0
  91. data/lib/groupdocs/signature/envelope.rb +56 -0
  92. data/lib/groupdocs/signature/form.rb +47 -5
  93. data/lib/groupdocs/signature/shared/field_methods.rb +37 -0
  94. data/lib/groupdocs/storage/file.rb +83 -0
  95. data/lib/groupdocs/subscription.rb +218 -0
  96. data/lib/groupdocs/user.rb +422 -1
  97. data/lib/groupdocs/version.rb +1 -1
  98. data/spec/groupdocs/job_spec.rb +4 -5
  99. data/spec/groupdocs/user_spec.rb +157 -0
  100. data/spec/support/json/annotation_resize.json +11 -0
  101. data/spec/support/json/annotation_text_color.json +10 -0
  102. data/spec/support/json/annotation_text_info.json +11 -0
  103. data/spec/support/json/document_content_get.json +8 -0
  104. data/spec/support/json/document_edit_lock_get.json +10 -0
  105. data/spec/support/json/document_editlock_remove.json +8 -0
  106. data/spec/support/json/document_page_html_urls_get.json +14 -0
  107. data/spec/support/json/document_password_set.json +19 -0
  108. data/spec/support/json/document_representations.json +25 -0
  109. data/spec/support/json/document_shared_documents_get.json +32 -0
  110. data/spec/support/json/document_tags_get.json +9 -0
  111. data/spec/support/json/document_tags_remove.json +8 -0
  112. data/spec/support/json/document_tags_set.json +8 -0
  113. data/spec/support/json/document_user_status_set.json +12 -0
  114. data/spec/support/json/job_documents.json +103 -35
  115. data/spec/support/json/job_xml_get.json +30 -0
  116. data/spec/support/json/jobs_documents.json +40 -0
  117. data/spec/support/json/user_get_profile.json +73 -0
  118. metadata +49 -177
@@ -182,6 +182,60 @@ module GroupDocs
182
182
  end
183
183
  end
184
184
 
185
+ #
186
+ # Adds a new storage provider configuration.
187
+ #
188
+ # @param [String] provider Storage provider name
189
+ # @param [Hash] access Access credentials
190
+ # @param [Array] provider_info
191
+ # @option access [String] :client_id
192
+ # @option access [String] :private_key
193
+ #
194
+ def add_provider!(provider, provider_info = {}, access = {})
195
+ Api::Request.new do |request|
196
+ request[:access] = access
197
+ request[:method] = :POST
198
+ request[:path] = "/mgmt/{{client_id}}/storages/#{provider}"
199
+ request[:request_body] = provider_info
200
+ end.execute!
201
+
202
+ end
203
+
204
+ #
205
+ # Updates user's storage provider configuration.
206
+ #
207
+ # @param [String] provider Storage provider name
208
+ # @param [Hash] access Access credentials
209
+ # @param [Array] provider_info
210
+ # @option access [String] :client_id
211
+ # @option access [String] :private_key
212
+ #
213
+ def update_provider!(provider, provider_info = {}, access = {})
214
+ Api::Request.new do |request|
215
+ request[:access] = access
216
+ request[:method] = :PUT
217
+ request[:path] = "/mgmt/{{client_id}}/storages/#{provider}"
218
+ request[:request_body] = provider_info
219
+ end.execute!
220
+
221
+ end
222
+
223
+
224
+ #
225
+ # Revoke.
226
+ #
227
+ # @param [Hash] access Access credentials
228
+ # @option access [String] :client_id
229
+ # @option access [String] :private_key
230
+ #
231
+ def self.revoke!(access = {})
232
+ Api::Request.new do |request|
233
+ request[:access] = access
234
+ request[:method] = :PUT
235
+ request[:path] = "/mgmt/{{client_id}}/revoke"
236
+ end.execute!
237
+
238
+ end
185
239
  #
186
240
  # Logins user using user name and password.
187
241
  #
@@ -203,6 +257,90 @@ module GroupDocs
203
257
  new(json[:user])
204
258
  end
205
259
 
260
+ #
261
+ # Logins user using user name and password.
262
+ #
263
+ # @param [String]guid
264
+ # @param [Hash] options
265
+ # @option [String] :filename File name
266
+ # @option [Boolean] :render Render
267
+ #
268
+ def self.download!(path, name, guid, options = {})
269
+ api = Api::Request.new do |request|
270
+ request[:sign] = false
271
+ request[:method] = :DOWNLOAD
272
+ request[:path] = "/shared/files/#{guid}"
273
+ end
274
+ api.add_params(options)
275
+ response = api.execute!
276
+
277
+ filepath = "#{path}/#{name}"
278
+ Object::File.open(filepath, 'wb') do |file|
279
+ file.write(response)
280
+ end
281
+
282
+ filepath
283
+ end
284
+
285
+ #
286
+ # Get file in xml.
287
+ #
288
+ #@param [String] guid
289
+ #
290
+ def self.get_xml!(path, name, guid)
291
+ response = Api::Request.new do |request|
292
+ request[:sign] = false
293
+ request[:method] = :DOWNLOAD
294
+ request[:path] = "/shared/files/#{guid}/xml"
295
+ end.execute!
296
+
297
+ filepath = "#{path}/#{name}"
298
+ Object::File.open(filepath, 'wb') do |file|
299
+ file.write(response)
300
+ end
301
+
302
+ filepath
303
+ end
304
+
305
+ #
306
+ # Get file in html.
307
+ #
308
+ #@param [String] guid
309
+ #
310
+ def self.get_html!(path, name, guid)
311
+ response = Api::Request.new do |request|
312
+ request[:sign] = false
313
+ request[:method] = :DOWNLOAD
314
+ request[:path] = "/shared/files/#{guid}/html"
315
+ end.execute!
316
+
317
+ filepath = "#{path}/#{name}"
318
+ Object::File.open(filepath, 'wb') do |file|
319
+ file.write(response)
320
+ end
321
+
322
+ filepath
323
+ end
324
+
325
+ #
326
+ # Get file in html.
327
+ #
328
+ #@param [String] path
329
+ #
330
+ def get_packages!(path)
331
+ response = Api::Request.new do |request|
332
+ request[:sign] = false
333
+ request[:method] = :GET
334
+ request[:path] = "/shared/packages/#{path}"
335
+ end.execute!
336
+
337
+ Object::File.open(path, 'wb') do |file|
338
+ file.write(response)
339
+ end
340
+
341
+ path
342
+ end
343
+
206
344
  # @attr [Integer] id
207
345
  attr_accessor :id
208
346
  # @attr [String] guid
@@ -299,7 +437,73 @@ module GroupDocs
299
437
  end
300
438
 
301
439
  #
302
- # Returns an array of users associated to current user account.
440
+ # Updates user profile.
441
+ #
442
+ # @example
443
+ # user = GroupDocs::User.get!
444
+ # old_password = user.password_salt
445
+ # new_password = 'Smith'
446
+ # user.update_password!
447
+ # @param [Array] pas_info ([old_password, new_password, reset_token])
448
+ # @param [Hash] access Access credentials
449
+ # @option access [String] :client_id
450
+ # @option access [String] :private_key
451
+ #
452
+ def self.update_password!(pas_info = {}, access = {})
453
+ Api::Request.new do |request|
454
+ request[:access] = access
455
+ request[:method] = :PUT
456
+ request[:path] = '/mgmt/{{client_id}}/profile/password'
457
+ request[:request_body] = pas_info
458
+ end.execute!
459
+ end
460
+
461
+ #
462
+ # Get user profile by reset token
463
+ #
464
+ # @param [String] callerId
465
+ # @param [Array] options
466
+ # @option [Hash] :token
467
+ # @param [Hash] access Access credentials
468
+ # @option access [String] :client_id
469
+ # @option access [String] :private_key
470
+ # @return [String]
471
+ #
472
+ def self.reset_token!(caller_id, options ={}, access = {})
473
+ api = Api::Request.new do |request|
474
+ request[:access] = access
475
+ request[:method] = :GET
476
+ request[:path] = "/mgmt/#{caller_id}/reset-tokens"
477
+ end
478
+ api.add_params(options)
479
+ api.execute!
480
+
481
+ end
482
+
483
+ #
484
+ # Get user profile by reset token
485
+ #
486
+ # @param [String] callerId
487
+ # @param [Array] options
488
+ # @option [Hash] :token
489
+ # @param [Hash] access Access credentials
490
+ # @option access [String] :client_id
491
+ # @option access [String] :private_key
492
+ # @return [String]
493
+ #
494
+ def self.verif_token!(caller_id, options ={}, access = {})
495
+ api = Api::Request.new do |request|
496
+ request[:access] = access
497
+ request[:method] = :GET
498
+ request[:path] = "/mgmt/#{caller_id}/verif-tokens"
499
+ end
500
+ api.add_params(options)
501
+ api.execute!
502
+
503
+ end
504
+
505
+ #
506
+ # Get user profile by verif token
303
507
  #
304
508
  # @param [Hash] access Access credentials
305
509
  # @option access [String] :client_id
@@ -318,6 +522,152 @@ module GroupDocs
318
522
  end
319
523
  end
320
524
 
525
+ #
526
+ # Get user profile by claimed token
527
+ #
528
+ # @param [String] callerId
529
+ # @param [Array] options
530
+ # @option [Hash] :token
531
+ # @param [Hash] access Access credentials
532
+ # @option access [String] :client_id
533
+ # @option access [String] :private_key
534
+ # @return [String]
535
+ #
536
+ def self.claimed_token!(caller_id, options ={}, access = {})
537
+ api = Api::Request.new do |request|
538
+ request[:access] = access
539
+ request[:method] = :GET
540
+ request[:path] = "/mgmt/#{caller_id}/claimed-tokens"
541
+ end
542
+ api.add_params(options)
543
+ api.execute!
544
+
545
+ end
546
+
547
+ #
548
+ # Get alien user profile
549
+ #
550
+ # @param [String] callerId
551
+ # @param [Hash] access Access credentials
552
+ # @option access [String] :client_id
553
+ # @option access [String] :private_key
554
+ # @return [String]
555
+ #
556
+ def self.get_profile!(caller_id, access = {})
557
+ json = Api::Request.new do |request|
558
+ request[:access] = access
559
+ request[:method] = :GET
560
+ request[:path] = "/mgmt/#{caller_id}/user/{{client_id}}/profile"
561
+ end.execute!
562
+
563
+ json[:user]
564
+ end
565
+
566
+ #
567
+ # Update alien user profile
568
+ #
569
+ # @param [String] callerId
570
+ # @param [Hash] access Access credentials
571
+ # @option access [String] :client_id
572
+ # @option access [String] :private_key
573
+ # @return [String]
574
+ #
575
+ def update_profile!(caller_id, access = {})
576
+ json = Api::Request.new do |request|
577
+ request[:access] = access
578
+ request[:method] = :PUT
579
+ request[:path] = "/mgmt/#{caller_id}/user/{{client_id}}/profile"
580
+ request[:request_body] = to_hash
581
+ end.execute!
582
+
583
+ json[:user_guid]
584
+ end
585
+
586
+ #
587
+ # Create new user
588
+ #
589
+ # @param [String] callerId
590
+ # @param [Hash] access Access credentials
591
+ # @option access [String] :client_id
592
+ # @option access [String] :private_key
593
+ # @return [GroupDocs::User]
594
+ #
595
+ def create_user!(caller_id, access = {})
596
+ json = Api::Request.new do |request|
597
+ request[:access] = access
598
+ request[:method] = :POST
599
+ request[:path] = "/mgmt/#{caller_id}/user"
600
+ request[:request_body] = to_hash
601
+ end.execute!
602
+
603
+ end
604
+
605
+ #
606
+ # Create new login
607
+ #
608
+ # @param [String] callerId
609
+ # @param [Hash] options
610
+ # @option options [String] :password
611
+ # @param [Hash] access Access credentials
612
+ # @option access [String] :client_id
613
+ # @option access [String] :private_key
614
+ # @return [GroupDocs::User]
615
+ #
616
+ def self.create_login!(caller_id, options = {}, access = {})
617
+ api = Api::Request.new do |request|
618
+ request[:access] = access
619
+ request[:method] = :POST
620
+ request[:path] = "/mgmt/#{caller_id}/user/{{client_id}}/logins"
621
+ end
622
+ api.add_params(options)
623
+ api.execute!
624
+
625
+ end
626
+
627
+ #
628
+ # Change alien user password.
629
+ #
630
+ # @example
631
+ # user = GroupDocs::User.get!
632
+ # old_password = user.password_salt
633
+ # new_password = 'Smith'
634
+ # user.update_password!
635
+ #
636
+ # @param [String] callerId
637
+ # @param [Array] pas_info ([old_password, new_password, reset_token])
638
+ # @param [Hash] access Access credentials
639
+ # @option access [String] :client_id
640
+ # @option access [String] :private_key
641
+ #
642
+ def self.update_alien_password!(caller_id, pas_info = {}, access = {})
643
+ json = Api::Request.new do |request|
644
+ request[:access] = access
645
+ request[:method] = :PUT
646
+ request[:path] = "/mgmt/#{caller_id}/users/{{client_id}}password"
647
+ request[:request_body] = pas_info
648
+ end.execute!
649
+
650
+ json[:user_guid]
651
+ end
652
+
653
+ #
654
+ # Change alien user password.
655
+ #
656
+ # @param [String] callerId
657
+ # @param [Hash] access Access credentials
658
+ # @option access [String] :client_id
659
+ # @option access [String] :private_key
660
+ #
661
+ def self.reset_alien_password!(caller_id, access = {})
662
+ json = Api::Request.new do |request|
663
+ request[:access] = access
664
+ request[:method] = :DELETE
665
+ request[:path] = "/mgmt/#{caller_id}/users/{{client_id}}password"
666
+ end.execute!
667
+
668
+ json[:user_name]
669
+ end
670
+
321
671
  #
322
672
  # Returns an array of roles.
323
673
  #
@@ -336,5 +686,76 @@ module GroupDocs
336
686
  json[:roles]
337
687
  end
338
688
 
689
+ #
690
+ # Returns an array of roles.
691
+ #
692
+ # # @param [String] callerId
693
+ # @param [Hash] access Access credentials
694
+ # @option access [String] :client_id
695
+ # @option access [String] :private_key
696
+ # @return [Array]
697
+ #
698
+ def self.user_roles!(caller_id, access = {})
699
+ json = Api::Request.new do |request|
700
+ request[:access] = access
701
+ request[:method] = :GET
702
+ request[:path] = "/mgmt/#{caller_id}/users/{{client_id}}/roles"
703
+ end.execute!
704
+
705
+ json[:roles]
706
+ end
707
+
708
+ #
709
+ # Set user roles.
710
+ #
711
+ # @param [String] callerId
712
+ # @param [Hash] role_info (:id, :name)
713
+ # @param [Hash] access Access credentials
714
+ # @option access [String] :client_id
715
+ # @option access [String] :private_key
716
+ # @return [Array]
717
+ #
718
+ def self.set_user_roles!(caller_id, role_info = {}, access = {})
719
+ Api::Request.new do |request|
720
+ request[:access] = access
721
+ request[:method] = :GET
722
+ request[:path] = "/mgmt/#{caller_id}/users/{{client_id}}/roles"
723
+ request[:request_body] = role_info
724
+ end.execute!
725
+
726
+ end
727
+
728
+ #
729
+ # Returns an account information
730
+ #
731
+ # @param [Hash] access Access credentials
732
+ # @option access [String] :client_id
733
+ # @option access [String] :private_key
734
+ # @return [Array]
735
+ #
736
+ def self.get_account!(access = {})
737
+ Api::Request.new do |request|
738
+ request[:access] = access
739
+ request[:method] = :GET
740
+ request[:path] = "/mgmt/{{client_id}}/account"
741
+ end.execute!
742
+ end
743
+
744
+ #
745
+ # Remove account user.
746
+ #
747
+ # @param [Hash] access Access credentials
748
+ # @option access [String] :client_id
749
+ # @option access [String] :private_key
750
+ # @return [String]
751
+ #
752
+ def self.remove_account!(access = {})
753
+ Api::Request.new do |request|
754
+ request[:access] = access
755
+ request[:method] = :DELETE
756
+ request[:path] = "/mgmt/{{client_id}}/account"
757
+ end.execute!
758
+ end
759
+
339
760
  end # User
340
761
  end # GroupDocs