groupdocs 1.5.7 → 1.5.8

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.
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
@@ -109,6 +109,8 @@ module GroupDocs
109
109
  STATUSES.invert[@status]
110
110
  end
111
111
 
112
+ #
113
+ # Changed in release 1.5.8
112
114
  #
113
115
  # Adds recipient to envelope.
114
116
  #
@@ -142,7 +144,9 @@ module GroupDocs
142
144
  :lastname => recipient.last_name,
143
145
  :role => recipient.role_id,
144
146
  :order => recipient.order)
145
- api.execute!
147
+ json = api.execute!
148
+ Signature::Recipient.new(json[:recipient])
149
+
146
150
  end
147
151
 
148
152
  #
@@ -297,7 +301,7 @@ module GroupDocs
297
301
  # @option access [String] :private_key
298
302
  # @raise [ArgumentError] if recipient is not GroupDocs::Signature::Recipient
299
303
  #
300
- def sign!(recipient, options = {}, ccess = {})
304
+ def sign!(recipient, options = {}, access = {})
301
305
  recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError,
302
306
  "Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}"
303
307
 
@@ -362,7 +366,9 @@ module GroupDocs
362
366
  end
363
367
 
364
368
  #
365
- # Downloads signed document to given path.
369
+ # Changed in release 1.5.8
370
+ #
371
+ # Downloads signed document to given path.
366
372
  #
367
373
  # @param [GroupDocs::Document] document Signed document
368
374
  # @param [String] path Directory to download file to
@@ -381,7 +387,7 @@ module GroupDocs
381
387
  request[:path] = "/signature/{{client_id}}/envelopes/#{id}/document/#{document.file.guid}"
382
388
  end.execute!
383
389
 
384
- filepath = "#{path}/#{name}.pdf"
390
+ document.file.name ? filepath = "#{path}/#{document.file.name}" : filepath = "#{path}/#{name}.pdf"
385
391
 
386
392
  Object::File.open(filepath, 'wb') do |file|
387
393
  file.write(response)
@@ -483,6 +489,7 @@ module GroupDocs
483
489
  end.execute!
484
490
 
485
491
  filepath = "#{path}/#{name}."
492
+
486
493
  if documents!.size == 1
487
494
  filepath << 'pdf'
488
495
  else
@@ -545,5 +552,140 @@ module GroupDocs
545
552
 
546
553
  end
547
554
 
555
+ #
556
+ # Modify signature envelope field location.
557
+ #
558
+ # @example Modify field location in envelope
559
+ # envelope = GroupDocs::Signature::Envelope.get!("g94h5g84hj9g4gf23i40j")
560
+ # document = envelope.documents!.first
561
+ # recipient = envelope.recipients!.first
562
+ # field = envelope.fields!(document, recipient).first
563
+ # location = field.locations.first
564
+ # envelope.modify_field_location! location, field, document, recipient
565
+ #
566
+ # @param [GroupDocs::Signature::Field::Location] location
567
+ # @param [GroupDocs::Signature::Field] field
568
+ # @param [GroupDocs::Document] document
569
+ # @param [GroupDocs::Signature::Recipient] recipient
570
+ # @param [Integer] order Location order
571
+ # @param [Hash] access Access credentials
572
+ # @option access [String] :client_id
573
+ # @option access [String] :private_key
574
+ # @raise [ArgumentError] if location is not GroupDocs::Signature::Field::Location
575
+ # @raise [ArgumentError] if field is not GroupDocs::Signature::Field
576
+ # @raise [ArgumentError] if document is not GroupDocs::Document
577
+ # @raise [ArgumentError] if recipient is not GroupDocs::Signature::Recipient
578
+ #
579
+ def modify_field_location!(location, field, document, recipient, order, access = {})
580
+ location.is_a?(GroupDocs::Signature::Field::Location) or raise ArgumentError,
581
+ "Location should be GroupDocs::Signature::Field::Location object, received: #{location.inspect}"
582
+ field.is_a?(GroupDocs::Signature::Field) or raise ArgumentError,
583
+ "Field should be GroupDocs::Signature::Field object, received: #{field.inspect}"
584
+ document.is_a?(GroupDocs::Document) or raise ArgumentError,
585
+ "Document should be GroupDocs::Document object, received: #{document.inspect}"
586
+ recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError,
587
+ "Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}"
588
+
589
+ api = Api::Request.new do |request|
590
+ request[:access] = access
591
+ request[:method] = :PUT
592
+ request[:path] = "/signature/{{client_id}}/envelopes/#{id}/documents/#{document.file.guid}/recipient/#{recipient.id}/fields/#{field.id}/locations/#{location.id}"
593
+ end
594
+ api.add_params(:order => order)
595
+ api.execute!
596
+ end
597
+
598
+ #
599
+ # Changed in release 1.5.8
600
+ #
601
+ # Get signature envelope.
602
+ #
603
+ # @param [GroupDocs::Signature::Recipient] recipient Recipient GUID
604
+ # @param [Hash] access Access credentials
605
+ # @option access [String] :client_id
606
+ # @option access [String] :private_key
607
+ # @return [Array]
608
+ #
609
+ def public_get!(recipient, access = {})
610
+ recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError,
611
+ "Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}"
612
+
613
+ json = Api::Request.new do |request|
614
+ request[:access] = access
615
+ request[:method] = :GET
616
+ request[:path] = "/signature/public/envelopes/#{id}/recipient/#{recipient.id}"
617
+ end.execute!
618
+
619
+ Signature::Envelope.new(json[:envelope])
620
+ end
621
+
622
+ #
623
+ # Changed in release 1.5.8
624
+ #
625
+ # Public downloads signed documents to given path.
626
+ #
627
+ # If there is only one file in envelope, it's saved as PDF.
628
+ # If there are two or more files in envelope, it's saved as ZIP.
629
+ #
630
+ # @param [String] path Directory to download file to
631
+ # @param [GroupDocs::Signature::Recipient] recipient Recipient GUID
632
+ # @param [Hash] access Access credentials
633
+ # @option access [String] :client_id
634
+ # @option access [String] :private_key
635
+ # @return [Array]
636
+ #
637
+ def public_signed_documents!(path, recipient, access = {})
638
+ recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError,
639
+ "Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}"
640
+ json = Api::Request.new do |request|
641
+ request[:access] = access
642
+ request[:method] = :DOWNLOAD
643
+ request[:path] = "/signature/public/envelopes/#{id}/recipient/#{recipient.id}/documents/get"
644
+ end.execute!
645
+ filepath = "#{path}/#{name}."
646
+ if documents!.size == 1
647
+ filepath << 'pdf'
648
+ else
649
+ filepath << 'zip'
650
+ end
651
+
652
+ Object::File.open(filepath, 'wb') do |file|
653
+ file.write(json)
654
+ end
655
+
656
+ filepath
657
+ end
658
+
659
+
660
+ #
661
+ # Changed in release 1.5.8
662
+ #
663
+ #
664
+ # Get signed envelope field data.
665
+ #
666
+ # @param [GroupDocs::Signature::Recipient] recipient Recipient GUID
667
+ # @param [GroupDocs::Signature::Field] field Field GUID
668
+ # @param [Hash] access Access credentials
669
+ # @option access [String] :client_id
670
+ # @option access [String] :private_key
671
+ # @return [Array]
672
+ #
673
+ def date!(recipient, field, access = {})
674
+ field.is_a?(GroupDocs::Signature::Field) or raise ArgumentError,
675
+ "Field should be GroupDocs::Signature::Field object, received: #{field.inspect}"
676
+ recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError,
677
+ "Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}"
678
+
679
+ Api::Request.new do |request|
680
+ request[:access] = access
681
+ request[:method] = :GET
682
+ request[:path] = "/signature/public/envelopes/#{id}/fields/recipient/#{recipient.id}/field/#{field.id}"
683
+ end.execute!
684
+
685
+ end
686
+
687
+
688
+
689
+
548
690
  end # Signature::Envelope
549
691
  end # GroupDocs
@@ -70,7 +70,7 @@ module GroupDocs
70
70
  attr_accessor :isSystem
71
71
  # @attr [Boolean] mandatory
72
72
  attr_accessor :mandatory
73
- # @attr [Symbol] fieldType
73
+ # @attr [Integer] fieldType
74
74
  attr_accessor :fieldType
75
75
  # @attr [Array<String>] acceptableValues
76
76
  attr_accessor :acceptableValues
@@ -91,6 +91,19 @@ module GroupDocs
91
91
  # @attr [Array<GroupDocs::Signature::Field::Location>] locations
92
92
  attr_accessor :locations
93
93
 
94
+ # added in realise 1.5.8
95
+ # @attr [Integer] pageWidth
96
+ attr_accessor :pageWidth
97
+ # @attr [Integer] pageHeight
98
+ attr_accessor :pageHeight
99
+ # @attr [String] groupName
100
+ attr_accessor :groupName
101
+ # @attr [String] settings
102
+ attr_accessor :settings
103
+ # @attr [Integer] align
104
+ attr_accessor :align
105
+ # @attr [String] guidanceText
106
+ attr_accessor :guidanceText
94
107
 
95
108
  # Human-readable accessors
96
109
  alias_accessor :template_id, :templateId
@@ -113,6 +126,12 @@ module GroupDocs
113
126
  alias_accessor :default_value, :defaultValue
114
127
  alias_accessor :text_rows, :textRows
115
128
  alias_accessor :text_columns, :textColumns
129
+ # added in release 1.5.8
130
+ alias_accessor :page_width, :pageWidth
131
+ alias_accessor :page_height, :pageHeight
132
+ alias_accessor :group_name, :groupName
133
+ alias_accessor :guidance_text, :guidanceText
134
+
116
135
 
117
136
  #
118
137
  # Converts location to GroupDocs::Signature::Field::Location object.
@@ -7,15 +7,15 @@ module GroupDocs
7
7
  attr_accessor :documentId
8
8
  # @attr [String] fieldId
9
9
  attr_accessor :fieldId
10
- # @attr [Integer] page
10
+ # @attr [Integer] page (required)
11
11
  attr_accessor :page
12
- # @attr [Float] locationX
12
+ # @attr [Float] locationX (required)
13
13
  attr_accessor :locationX
14
- # @attr [Float] locationY
14
+ # @attr [Float] locationY (required)
15
15
  attr_accessor :locationY
16
- # @attr [Float] locationWidth
16
+ # @attr [Float] locationWidth (required)
17
17
  attr_accessor :locationWidth
18
- # @attr [Float] locationHeight
18
+ # @attr [Float] locationHeight (required)
19
19
  attr_accessor :locationHeight
20
20
  # @attr [String] fontName
21
21
  attr_accessor :fontName
@@ -34,6 +34,15 @@ module GroupDocs
34
34
  # @attr [String] page
35
35
  attr_accessor :page
36
36
 
37
+ # added in realise 1.5.8
38
+ # @attr [Integer] pageWidth
39
+ attr_accessor :pageWidth
40
+ # @attr [Integer] pageHeight
41
+ attr_accessor :pageHeight
42
+ # @attr [Integer] align
43
+ attr_accessor :align
44
+
45
+
37
46
  # Human-readable accessors
38
47
  alias_accessor :document_id, :documentId
39
48
  alias_accessor :field_id, :fieldId
@@ -53,8 +62,10 @@ module GroupDocs
53
62
  alias_accessor :font_bold, :fontBold
54
63
  alias_accessor :font_italic, :fontItalic
55
64
  alias_accessor :font_underline, :fontUnderline
56
- alias_accessor :forceNewField, :forceNewField
57
- alias_accessor :page, :page
65
+ alias_accessor :force_new_field, :forceNewField
66
+ # added in release 1.5.8
67
+ alias_accessor :page_width, :pageWidth
68
+ alias_accessor :page_height, :pageHeight
58
69
 
59
70
  end # Signature::Field::Location
60
71
  end # GroupDocs
@@ -30,7 +30,7 @@ module GroupDocs
30
30
  # @param [Hash] access Access credentials
31
31
  # @option access [String] :client_id
32
32
  # @option access [String] :private_key
33
- # @return [Array<GroupDocs::Signature::Envelope>]
33
+ # @return [Array<GroupDocs::Signature::Form>]
34
34
  #
35
35
  def self.all!(options = {}, access = {})
36
36
  status_id = options.delete(:status_id)
@@ -117,7 +117,7 @@ module GroupDocs
117
117
  alias_accessor :can_participant_download_form, :canParticipantDownloadForm
118
118
  alias_accessor :water_mark_text, :waterMarkText
119
119
  alias_accessor :water_mark_image, :waterMarkImage
120
- alias_accessor :notifyOwnerOnSign, :notifyOwnerOnSign
120
+ alias_accessor :notify_owner_on_sign, :notifyOwnerOnSign
121
121
 
122
122
 
123
123
  #
@@ -154,7 +154,7 @@ module GroupDocs
154
154
  # @example
155
155
  # form = GroupDocs::Signature::Form.new
156
156
  # form.name = "Form"
157
- # form.create! template
157
+ # form.create!
158
158
  #
159
159
  # @param [Hash] options Hash of options
160
160
  # @option options [String] :template_id Template GUID to create form from
@@ -258,24 +258,30 @@ module GroupDocs
258
258
  end.execute!
259
259
  end
260
260
 
261
+ #
262
+ # Changed in release 1.5.8
261
263
  #
262
264
  # Returns an array of fields for document per participant.
263
265
  #
264
266
  # @param [GroupDocs::Document] document
267
+ # @param [Hash] options
268
+ # @option options [String] :field Field GUID
265
269
  # @param [Hash] access Access credentials
266
270
  # @option access [String] :client_id
267
271
  # @option access [String] :private_key
268
272
  # @raise [ArgumentError] if document is not GroupDocs::Document
269
273
  #
270
- def fields!(document, access = {})
274
+ def fields!(document, options = {}, access = {})
271
275
  document.is_a?(GroupDocs::Document) or raise ArgumentError,
272
276
  "Document should be GroupDocs::Document object, received: #{document.inspect}"
273
277
 
274
- json = Api::Request.new do |request|
278
+ api = Api::Request.new do |request|
275
279
  request[:access] = access
276
280
  request[:method] = :GET
277
281
  request[:path] = "/signature/{{client_id}}/forms/#{id}/documents/#{document.file.guid}/fields"
278
- end.execute!
282
+ end
283
+ api.add_params(options)
284
+ json = api.execute!
279
285
 
280
286
  json[:fields].map do |field|
281
287
  Signature::Field.new(field)
@@ -347,7 +353,7 @@ module GroupDocs
347
353
  # @raise [ArgumentError] if field is not GroupDocs::Signature::Field
348
354
  # @raise [ArgumentError] if document is not GroupDocs::Document
349
355
  #
350
- def modify_field_location!(location, field, document, recipient, access = {})
356
+ def modify_field_location!(location, field, document, access = {})
351
357
  location.is_a?(GroupDocs::Signature::Field::Location) or raise ArgumentError,
352
358
  "Location should be GroupDocs::Signature::Field::Location object, received: #{location.inspect}"
353
359
  field.is_a?(GroupDocs::Signature::Field) or raise ArgumentError,
@@ -388,9 +394,8 @@ module GroupDocs
388
394
  #
389
395
  # @example
390
396
  # form = GroupDocs::Signature::Form.get!("g94h5g84hj9g4gf23i40j")
391
- # document = envelope.documents!.first
392
- # recipient = envelope.recipients!.first
393
- # field = envelope.fields!(document, recipient).first
397
+ # document = form.documents!.first
398
+ # field = form.fields!(document).first
394
399
  # field.name = "Field"
395
400
  # envelope.modify_field! field, document
396
401
  #
@@ -416,6 +421,8 @@ module GroupDocs
416
421
  end.execute!
417
422
  end
418
423
 
424
+ #
425
+ # Changed in release 1.5.8
419
426
  #
420
427
  # Downloads signed documents to given path.
421
428
  # If there is only one file in envelope, it's saved as PDF.
@@ -434,6 +441,188 @@ module GroupDocs
434
441
  request[:path] = "/signature/{{client_id}}/forms/#{id}/documents/get"
435
442
  end.execute!
436
443
 
444
+ filepath = "#{path}/#{name}.zip"
445
+
446
+
447
+ Object::File.open(filepath, 'wb') do |file|
448
+ file.write(response)
449
+ end
450
+
451
+ filepath
452
+ end
453
+
454
+ #
455
+ # Changed in release 1.5.8
456
+ #
457
+ # Public fill signature form.
458
+ #
459
+ # @param [String] form Form GUID
460
+ # @param [Hash] access Access credentials
461
+ # @option access [String] :client_id
462
+ # @option access [String] :private_key
463
+ # @return [Array]
464
+ #
465
+ def public_fill!(access = {})
466
+ Api::Request.new do |request|
467
+ request[:access] = access
468
+ request[:method] = :GET
469
+ request[:path] = "/signature/public/forms/#{id}/fill"
470
+ end.execute!
471
+ end
472
+
473
+ #
474
+ # Changed in release 1.5.8
475
+ #
476
+ # Public fill form field.
477
+ #
478
+ # @example Fill single line field
479
+ # form = GroupDocs::Signature::Form.get!("g94h5g84hj9g4gf23i40j")
480
+ # document = form.documents!.first
481
+ # field = form.fields!(document).first
482
+ # fill_form = form.public_fill!
483
+ # participant = fill_form[:participant][:id]
484
+ # envelope.fill_field! "my_data", field, document, participant
485
+ #
486
+ # @example Fill signature field
487
+ # form = GroupDocs::Signature::Form.get!("g94h5g84hj9g4gf23i40j")
488
+ # document = form.documents!.first
489
+ # field = form.fields!(document).first
490
+ # fill_form = form.public_fill!
491
+ # participant = fill_form[:participant][:id]
492
+ # signature = GroupDocs::Signature.get!.first
493
+ # form.fill_field! signature, field, document, participant
494
+ #
495
+ # @example Fill checkbox field
496
+ # form = GroupDocs::Signature::Form.get!("g94h5g84hj9g4gf23i40j")
497
+ # document = form.documents!.first
498
+ # field = form.fields!(document).first
499
+ # fill_form = form.public_fill!
500
+ # participant = fill_form[:participant][:id]
501
+ # form.fill_field! false, field, document, participant
502
+ #
503
+ #
504
+ # @param [GroupDocs::Document] document Document GUID
505
+ # @param [String] participant Participant ID
506
+ # @param [GroupDocs::Signature::Field] field Field GUID
507
+ # @param [String] authentication Authentication signature
508
+ # @param [File Stream] value Data to be placed in field
509
+ # @param [Hash] access Access credentials
510
+ # @option access [String] :client_id
511
+ # @option access [String] :private_key
512
+ # @return [Array]
513
+ #
514
+ def public_fill_field!(value, field, document, participant, authentication, access = {})
515
+ field.is_a?(GroupDocs::Signature::Field) or raise ArgumentError,
516
+ "Field should be GroupDocs::Signature::Field object, received: #{field.inspect}"
517
+ document.is_a?(GroupDocs::Document) or raise ArgumentError,
518
+ "Document should be GroupDocs::Document object, received: #{document.inspect}"
519
+
520
+ api = Api::Request.new do |request|
521
+ request[:access] = access
522
+ request[:method] = :PUT
523
+ request[:path] = "/signature/public/forms/#{id}/documents/#{document.guid}/participant/#{participant}/field/#{field.id}"
524
+ request[:request_body] = value
525
+ request[:plain] = true
526
+ end
527
+ api.add_params(:participantAuthSignature => authentication)
528
+ json = api.execute!
529
+ Signature::Field.new(json[:field])
530
+ end
531
+
532
+ #
533
+ # Changed in release 1.5.8
534
+ #
535
+ # Public sign form.
536
+ #
537
+ # @param [String] form Form GUID
538
+ # @param [String] participant Participant GUID
539
+ # @param [String] authentication Authentication signature
540
+ # @param [String] participant_name Participant Name
541
+ # @param [Hash] access Access credentials
542
+ # @option access [String] :client_id
543
+ # @option access [String] :private_key
544
+ # @return [Array]
545
+ #
546
+ def sign!( participant, authentication, participant_name, access = {})
547
+ api = Api::Request.new do |request|
548
+ request[:access] = access
549
+ request[:method] = :PUT
550
+ request[:path] = "/signature/public/forms/#{id}/participant/#{participant}/sign"
551
+ end
552
+ api.add_params(:participantAuthSignature => authentication, :name => participant_name)
553
+ api.execute!
554
+ end
555
+
556
+ #
557
+ # Changed in release 1.5.8
558
+ #
559
+ #
560
+ # Get form fields for document in form per participant
561
+ #
562
+ # @param [Hash] options
563
+ # @option [String] :document Document GUID
564
+ # @option [String] :participant Participant GUID
565
+ # @param [Hash] access Access credentials
566
+ # @option access [String] :client_id
567
+ # @option access [String] :private_key
568
+ # @return [Array]
569
+ #
570
+ def public_fields!(options = {}, access = {})
571
+ api = Api::Request.new do |request|
572
+ request[:access] = access
573
+ request[:method] = :GET
574
+ request[:path] = "/signature/public/forms/#{id}/fields"
575
+ end
576
+ api.add_params(options)
577
+ json = api.execute!
578
+
579
+ json[:fields].map do |field|
580
+ Signature::Field.new(field)
581
+ end
582
+ end
583
+
584
+ #
585
+ # Changed in release 1.5.8
586
+ #
587
+ #
588
+ # Get signature form participant.
589
+ #
590
+ # @param [String] participant Participant GUID
591
+ # @param [Hash] access Access credentials
592
+ # @option access [String] :client_id
593
+ # @option access [String] :private_key
594
+ # @return [Array]
595
+ #
596
+ def participant!(participant, access = {})
597
+ json = Api::Request.new do |request|
598
+ request[:access] = access
599
+ request[:method] = :GET
600
+ request[:path] = "/signature/public/forms/#{form}/participants/#{participant}"
601
+ end.execute!
602
+
603
+ json[:participant]
604
+ end
605
+
606
+ #
607
+ # Changed in release 1.5.8
608
+ #
609
+ #
610
+ # Get signed form documents.
611
+ #
612
+ # @param [String] participant Participant GUID
613
+ # @param [Hash] access Access credentials
614
+ # @option access [String] :client_id
615
+ # @option access [String] :private_key
616
+ # @return [Array]
617
+ #
618
+ def public_signed_documents!(path, participant, access = {})
619
+ response = Api::Request.new do |request|
620
+ request[:access] = access
621
+ request[:method] = :DOWNLOAD
622
+ request[:path] = "/signature/public/forms/#{id}/participant/#{participant}/documents/get"
623
+ end.execute!
624
+
625
+
437
626
  filepath = "#{path}/#{name}."
438
627
  if documents!.size == 1
439
628
  filepath << 'pdf'