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
@@ -34,6 +34,15 @@ module GroupDocs
34
34
  attr_accessor :replies
35
35
  # @attr [Hash] annotationPosition
36
36
  attr_accessor :annotationPosition
37
+ #@attr [Double] AnnotationSizeInfo
38
+ attr_accessor :width
39
+ attr_accessor :height
40
+ #@attr [String]TextFieldInfo
41
+ attr_accessor :fieldText
42
+ attr_accessor :fontFamily
43
+ attr_accessor :fontSize
44
+ #@attr [String]Font Color
45
+ attr_accessor :fontColor
37
46
 
38
47
  # Compatibility with response JSON
39
48
  alias_method :annotationGuid=, :guid=
@@ -47,6 +56,7 @@ module GroupDocs
47
56
  alias_accessor :annotation_position, :annotationPosition
48
57
  alias_accessor :position, :annotationPosition
49
58
 
59
+
50
60
  #
51
61
  # Creates new GroupDocs::Document::Annotation.
52
62
  #
@@ -271,5 +281,68 @@ module GroupDocs
271
281
  self.access = mode
272
282
  end
273
283
 
284
+ #
285
+ # Resize annotation.
286
+ #
287
+ # @param [Integer, Float] x
288
+ # @param [Integer, Float] y
289
+ # @param [Hash] access Access credentials
290
+ # @option access [String] :client_id
291
+ # @option access [String] :private_key
292
+ #
293
+ def resize!(x, y, access = {})
294
+ Api::Request.new do |request|
295
+ request[:access] = access
296
+ request[:method] = :PUT
297
+ request[:path] = "/ant/{{client_id}}/annotations/#{guid}/size"
298
+ request[:request_body] = { :x => x, :y => y }
299
+ end.execute!
300
+
301
+ self.width = x
302
+ self.height = y
303
+ end
304
+
305
+ #
306
+ # Save Text Of Text Field.
307
+ #
308
+ # @param [String] fieldText
309
+ # @param [String] fontFamily
310
+ # @param [Integer, Float] fontSize
311
+ # @param [Hash] access Access credentials
312
+ # @option access [String] :client_id
313
+ # @option access [String] :private_key
314
+ #
315
+ def text_info!(fieldText, fontFamily, fontSize, access = {})
316
+ Api::Request.new do |request|
317
+ request[:access] = access
318
+ request[:method] = :PUT
319
+ request[:path] = "/ant/{{client_id}}/annotations/#{guid}/size"
320
+ request[:request_body] = { :fieldText => fieldText, :fontFamily => fontFamily, :fontSize => fontSize }
321
+ end.execute!
322
+
323
+ self.fieldText = fieldText
324
+ self.fontFamily = fontFamily
325
+ self.fontSize = fontSize
326
+ end
327
+
328
+ #
329
+ # Save Text Of Text Color.
330
+ #
331
+ # @param [Integer, Float] fontColor
332
+ # @param [Hash] access Access credentials
333
+ # @option access [String] :client_id
334
+ # @option access [String] :private_key
335
+ #
336
+ def text_color!(font_color, access = {})
337
+ Api::Request.new do |request|
338
+ request[:access] = access
339
+ request[:method] = :PUT
340
+ request[:path] = "/ant/{{client_id}}/annotations/#{guid}/size"
341
+ request[:request_body] = { :fontColor => font_color }
342
+ end.execute!
343
+
344
+ self.fontColor = font_color
345
+ end
346
+
274
347
  end # Document::Annotation
275
348
  end # GroupDocs
data/lib/groupdocs/job.rb CHANGED
@@ -64,6 +64,52 @@ module GroupDocs
64
64
  Job.new(json)
65
65
  end
66
66
 
67
+ #
68
+ # Returns job by its identifier.
69
+ #
70
+ # @param [Integer] id
71
+ # @param [Hash] access Access credentials
72
+ # @option access [String] :client_id
73
+ # @option access [String] :private_key
74
+ # @return [GroupDocs::Job]
75
+ #
76
+ def self.get_xml!(id, access = {})
77
+ api = Api::Request.new do |request|
78
+ request[:access] = access
79
+ request[:method] = :GET
80
+ request[:path] = "/async/{{client_id}}/jobs/#{id}"
81
+ end
82
+ api.add_params(:format => 'xml')
83
+ json = api.execute!
84
+
85
+ Job.new(json)
86
+ end
87
+
88
+
89
+ #
90
+ # Returns job by its identifier.
91
+ #
92
+ # @param [String] options
93
+ # @option statusIds [String] :statusIds (required)
94
+ # @option actions [String] :actions
95
+ # @option excluded_actions [String] :excluded_actions
96
+ # @param [Hash] access Access credentials
97
+ # @option access [String] :client_id
98
+ # @option access [String] :private_key
99
+ # @return [GroupDocs::Job]
100
+ #
101
+ def self.get_resources!(options = {}, access = {})
102
+ api = Api::Request.new do |request|
103
+ request[:access] = access
104
+ request[:method] = :GET
105
+ request[:path] = "/async/{{client_id}}/jobs/resources"
106
+ end
107
+ api.add_params(options)
108
+ json = api.execute!
109
+
110
+ json[:dates]
111
+ end
112
+
67
113
  #
68
114
  # Creates new draft job.
69
115
  #
@@ -80,7 +126,7 @@ module GroupDocs
80
126
  def self.create!(options, access = {})
81
127
  options[:actions] or raise ArgumentError, 'options[:actions] is required.'
82
128
  options[:actions] = convert_actions_to_byte(options[:actions])
83
- options[:out_formats] = options[:out_formats].join(?;) if options[:out_formats]
129
+ #options[:out_formats] = options[:out_formats].join(?;) if options[:out_formats]
84
130
 
85
131
  api = Api::Request.new do |request|
86
132
  request[:access] = access
@@ -195,6 +241,41 @@ module GroupDocs
195
241
  documents
196
242
  end
197
243
 
244
+ #
245
+ # Returns job actions in human-readable format.
246
+ #
247
+ # @return [Array<Symbol>]
248
+ #
249
+ def actions
250
+ @actions.split(', ').map { |action| action.underscore.to_sym } if @actions
251
+ end
252
+
253
+ #
254
+ # Returns an array of input and output documents associated to jobs.
255
+ #
256
+ # @param [Hash] options
257
+ # @option page [String] Page Index
258
+ # @option count [String] Page Size
259
+ # @option actions [String] Actions
260
+ # @option excluded_actions [String] Excluded actions
261
+ # @option order_by [String] Order by
262
+ # @option order_asc [String] Order ask
263
+ # @param [Hash] access Access credentials
264
+ # @option access [String] :client_id
265
+ # @option access [String] :private_key
266
+ # @return [Hash]
267
+ #
268
+ def self.jobs_documents!(options = {}, access = {})
269
+ api = Api::Request.new do |request|
270
+ request[:access] = access
271
+ request[:method] = :GET
272
+ request[:path] = "/async/{{client_id}}/jobs/documents"
273
+ end
274
+ api.add_params(options)
275
+ api.execute!
276
+
277
+ end
278
+
198
279
  #
199
280
  # Adds document to job.
200
281
  #
@@ -0,0 +1,83 @@
1
+ module GroupDocs
2
+ class Post < Api::Entity
3
+
4
+
5
+ # Rename by post.
6
+ #
7
+ # @param [Hash] options
8
+ # @option file_id [String] :file_id
9
+ # @option new_name [String] :new_name
10
+ # @option user_id [String]:user_id
11
+ # @return [Array]
12
+ #
13
+ def self.rename!(options = {})
14
+ api = Api::Request.new do |request|
15
+ request[:method] = :POST
16
+ request[:path] = '/post/file.rename'
17
+ end
18
+ api.add_params(options)
19
+ json = api.execute!
20
+
21
+ new(json)
22
+ end
23
+
24
+ # Delete by post.
25
+ #
26
+ # @param [Hash] options
27
+ # @option file_id [String] :file_id
28
+ # @option user_id [String]:user_id
29
+ # @return [Array]
30
+ #
31
+ def self.delete!(options = {})
32
+ api = Api::Request.new do |request|
33
+ request[:method] = :POST
34
+ request[:path] = '/post/file.delete'
35
+ end
36
+ api.add_params(options)
37
+ json = api.execute!
38
+
39
+ new(json)
40
+ end
41
+
42
+ # Delete from folder by post.
43
+ #
44
+ # @param [Hash] options
45
+ # @option user_id [String] :user_id
46
+ # @option path [String] :path
47
+ # @return [Array]
48
+ #
49
+ def self.delete_from_folder!(options = {})
50
+ api = Api::Request.new do |request|
51
+ request[:method] = :POST
52
+ request[:path] = '/post/file.delete.in'
53
+ end
54
+ api.add_params(options)
55
+ json = api.execute!
56
+
57
+ new(json)
58
+ end
59
+
60
+ # Compress by post.
61
+ #
62
+ # @param [Hash] options
63
+ # @option user_id [String] :user_id
64
+ # @option file_id [String] :file_id
65
+ # @option archive [String] :archive_type
66
+ # @return [Array]
67
+ #
68
+ def self.compress!(options = {})
69
+ api = Api::Request.new do |request|
70
+ request[:method] = :POST
71
+ request[:path] = '/post/file.compress'
72
+ end
73
+ api.add_params(options)
74
+ json = api.execute!
75
+
76
+ new(json)
77
+ end
78
+
79
+
80
+
81
+
82
+ end # Post
83
+ end # GroupDocs
@@ -128,6 +128,47 @@ module GroupDocs
128
128
  @pages << page
129
129
  end
130
130
 
131
+ #
132
+ # Add job document datasource.
133
+ #
134
+ # @param [GroupDocs::DataSource] datasource
135
+ # @param [String] jobId Job identifier
136
+ # @param [String] fileId File identifier
137
+ # @param [String] datasourceId
138
+ # @param [Hash] access Access credentials
139
+ # @option access [String] :client_id
140
+ # @option access [String] :private_key
141
+ #
142
+ def self.add_datasource!(jobId, datasource, access = {})
143
+ json = Api::Request.new do |request|
144
+ request[:access] = access
145
+ request[:method] = :PUT
146
+ request[:path] = "/merge/{{client_id}}/jobs/#{jobId}/files/#{file.guid}/datasources/#{datasource.id}"
147
+ end.execute!
148
+
149
+ json[:datasource_id]
150
+ end
151
+
152
+ #
153
+ # Add job document datasource fields.
154
+ #
155
+ # @param [String] jobId Job identifier
156
+ # @param [String] fileId File identifier
157
+ # @param [Array] datasourceFields
158
+ # @param [Hash] access Access credentials
159
+ # @option access [String] :client_id
160
+ # @option access [String] :private_key
161
+ #
162
+ def self.add_datasource_fields!(jobId, fileId, datasourceFields, access = {})
163
+ Api::Request.new do |request|
164
+ request[:access] = access
165
+ request[:method] = :PUT
166
+ request[:path] = "/merge/{{client_id}}/jobs/#{jobId}/files/#{fileId}/datasources/"
167
+ request[:request_body] = datasourceFields
168
+ end.execute!
169
+
170
+ end
171
+
131
172
  #
132
173
  # Creates questionnaire.
133
174
  #
@@ -33,6 +33,348 @@ module GroupDocs
33
33
  end
34
34
  end
35
35
 
36
+
37
+ #
38
+ # Fill in envelope field.
39
+ #
40
+ # @param [String] envelope Envelope GUID
41
+ # @param [String] document Document GUID
42
+ # @param [String] recipient Recipient GUID
43
+ # @param [String] field Field GUID
44
+ # @param [Hash] post_data Data to be placed in field
45
+ # @param [Hash] access Access credentials
46
+ # @option access [String] :client_id
47
+ # @option access [String] :private_key
48
+ # @return [Array]
49
+ #
50
+ def fill_envelope!(envelope, document, recipient, field, post_data, access = {})
51
+ json = Api::Request.new do |request|
52
+ request[:access] = access
53
+ request[:method] = :PUT
54
+ request[:path] = "/signature/public/envelopes/#{envelope}/documents/#{document}/recipient/#{recipient}/field/#{field}"
55
+ request[:request_body] = post_data
56
+ end.execute!
57
+
58
+ json[:field]
59
+ end
60
+
61
+ #
62
+ # Sing envelope
63
+ #
64
+ # @param [String] envelope Envelope GUID
65
+ # @param [String] recipient Recipient GUID
66
+ # @param [Hash] access Access credentials
67
+ # @option access [String] :client_id
68
+ # @option access [String] :private_key
69
+ # @return [Array]
70
+ #
71
+ def sign_envelope!(envelope, recipient, access = {})
72
+ json = Api::Request.new do |request|
73
+ request[:access] = access
74
+ request[:method] = :PUT
75
+ request[:path] = "/signature/public/envelopes/#{envelope}/recipient/#{recipient}/sign"
76
+ end.execute!
77
+
78
+ new(json)
79
+ end
80
+
81
+ #
82
+ # Sing envelope
83
+ #
84
+ # @param [String] envelope Envelope GUID
85
+ # @param [Hash] access Access credentials
86
+ # @option access [String] :client_id
87
+ # @option access [String] :private_key
88
+ # @return [Array]
89
+ #
90
+ def recipient!(envelope, access = {})
91
+ json = Api::Request.new do |request|
92
+ request[:access] = access
93
+ request[:method] = :GET
94
+ request[:path] = "/signature/public/envelopes/#{envelope}/recipient/"
95
+ end.execute!
96
+
97
+ json[:recipient]
98
+ end
99
+
100
+ #
101
+ # Get signature field for document in envelope per recipient.
102
+ #
103
+ # @param [String] envelope Envelope GUID
104
+ # @param [Hash] options
105
+ # @option [String] document Document GUID
106
+ # @option [String] recipient Recipient GUID
107
+ # @param [Hash] access Access credentials
108
+ # @option access [String] :client_id
109
+ # @option access [String] :private_key
110
+ # @return [Array]
111
+ #
112
+ def field_envelope_recipient!(envelope, options = {}, access = {})
113
+ api = Api::Request.new do |request|
114
+ request[:access] = access
115
+ request[:method] = :GET
116
+ request[:path] = "/signature/public/envelopes/#{envelope}/fields"
117
+ end
118
+ api.add_params(options)
119
+ json = api.execute!
120
+
121
+ json[:field]
122
+ end
123
+
124
+ #
125
+ # Get signed envelope field data.
126
+ #
127
+ # @param [String] envelope Envelope GUID
128
+ # @param [String] recipient Recipient GUID
129
+ # @param [String] field Field GUID
130
+ # @param [Hash] access Access credentials
131
+ # @option access [String] :client_id
132
+ # @option access [String] :private_key
133
+ # @return [Array]
134
+ #
135
+ def field_envelope_date!(envelope, recipient, field,access = {})
136
+ Api::Request.new do |request|
137
+ request[:access] = access
138
+ request[:method] = :GET
139
+ request[:path] = "/signature/public/envelopes/#{envelope}/fields/recipient/#{recipient}/field/#{field}"
140
+ end.execute!
141
+
142
+ end
143
+
144
+ #
145
+ # Get signature envelope.
146
+ #
147
+ # @param [String] envelope Envelope GUID
148
+ # @param [String] recipient Recipient GUID
149
+ # @param [Hash] access Access credentials
150
+ # @option access [String] :client_id
151
+ # @option access [String] :private_key
152
+ # @return [Array]
153
+ #
154
+ def get_sign_envelope!(envelope, recipient, access = {})
155
+ json = Api::Request.new do |request|
156
+ request[:access] = access
157
+ request[:method] = :GET
158
+ request[:path] = "/signature/public/envelopes/#{envelope}/recipient/#{recipient}"
159
+ end.execute!
160
+
161
+ json[:envelope]
162
+ end
163
+
164
+ #
165
+ # Get signature envelope.
166
+ #
167
+ # @param [String] envelope Envelope GUID
168
+ # @param [String] recipient Recipient GUID
169
+ # @param [Hash] access Access credentials
170
+ # @option access [String] :client_id
171
+ # @option access [String] :private_key
172
+ # @return [Array]
173
+ #
174
+ def get_signed_documents!(envelope, recipient, access = {})
175
+ json = Api::Request.new do |request|
176
+ request[:access] = access
177
+ request[:method] = :GET
178
+ request[:path] = "/signature/public/envelopes/#{envelope}/recipient/#{recipient}/documents/get"
179
+ end.execute!
180
+
181
+ new(json)
182
+ end
183
+
184
+ #
185
+ # Get signature envelope.
186
+ #
187
+ # @param [String] form Form GUID
188
+ # @param [Hash] access Access credentials
189
+ # @option access [String] :client_id
190
+ # @option access [String] :private_key
191
+ # @return [Array]
192
+ #
193
+ def fill_signature_form!(form, access = {})
194
+ json = Api::Request.new do |request|
195
+ request[:access] = access
196
+ request[:method] = :GET
197
+ request[:path] = "/signature/public/forms/#{form}/fill"
198
+ end.execute!
199
+
200
+ json[:participant]
201
+ end
202
+
203
+ #
204
+ # Fill form field.
205
+ #
206
+ # @param [String] form Form GUID
207
+ # @param [String] document Document GUID
208
+ # @param [String] participant Participant GUID
209
+ # @param [String] field Field GUID
210
+ # @param [String] authentication Authentication signature
211
+ # @param [Hash] access Access credentials
212
+ # @option access [String] :client_id
213
+ # @option access [String] :private_key
214
+ # @return [Array]
215
+ #
216
+ def fill_form_field!(form, document, participant, field, authentication, access = {})
217
+ api = Api::Request.new do |request|
218
+ request[:access] = access
219
+ request[:method] = :PUT
220
+ request[:path] = "/signature/public/forms/#{form}/documents/#{document}/participant/#{participant}/field/#{field}"
221
+ end
222
+ api.add_params(:participantAuthSignature => authentication)
223
+ json = api.execute!
224
+
225
+ json[:field]
226
+ end
227
+
228
+ #
229
+ # Sign form.
230
+ #
231
+ # @param [String] form Form GUID
232
+ # @param [String] participant Participant GUID
233
+ # @param [String] authentication Authentication signature
234
+ # @param [Hash] access Access credentials
235
+ # @option access [String] :client_id
236
+ # @option access [String] :private_key
237
+ # @return [Array]
238
+ #
239
+ def sign_form!(form, participant, authentication, access = {})
240
+ api = Api::Request.new do |request|
241
+ request[:access] = access
242
+ request[:method] = :PUT
243
+ request[:path] = "/signature/public/forms/#{form}/participant/#{participant}/sign"
244
+ end
245
+ api.add_params(:participantAuthSignature => authentication)
246
+ json = api.execute!
247
+
248
+ json[:field]
249
+ end
250
+
251
+ #
252
+ # Get form fields for document in form per participant
253
+ #
254
+ # @param [String] form Form GUID
255
+ # @param [Hash] options
256
+ # @option [String] document Document GUID
257
+ # @option [String] participant Participant GUID
258
+ # @param [Hash] access Access credentials
259
+ # @option access [String] :client_id
260
+ # @option access [String] :private_key
261
+ # @return [Array]
262
+ #
263
+ def get_sign_form!(form, options = {}, access = {})
264
+ api = Api::Request.new do |request|
265
+ request[:access] = access
266
+ request[:method] = :GET
267
+ request[:path] = "/signature/public/forms/#{form}/fields"
268
+ end
269
+ api.add_params(options)
270
+ json = api.execute!
271
+
272
+ json[:field]
273
+ end
274
+
275
+ #
276
+ # Get signed form documents.
277
+ #
278
+ # @param [String] form Form GUID
279
+ # @param [String] participant Participant GUID
280
+ # @param [Hash] access Access credentials
281
+ # @option access [String] :client_id
282
+ # @option access [String] :private_key
283
+ # @return [Array]
284
+ #
285
+ def get_signed_documents_form!(form, participant, access = {})
286
+ json = Api::Request.new do |request|
287
+ request[:access] = access
288
+ request[:method] = :GET
289
+ request[:path] = "/signature/public/forms/#{form}/participant/#{participant}/documents/get"
290
+ end.execute!
291
+
292
+ new(json)
293
+ end
294
+
295
+ #
296
+ # Get signature form participant.
297
+ #
298
+ # @param [String] form Form GUID
299
+ # @param [String] participant Participant GUID
300
+ # @param [Hash] access Access credentials
301
+ # @option access [String] :client_id
302
+ # @option access [String] :private_key
303
+ # @return [Array]
304
+ #
305
+ def get_sign_form_participant!(form, participant, access = {})
306
+ json = Api::Request.new do |request|
307
+ request[:access] = access
308
+ request[:method] = :GET
309
+ request[:path] = "/signature/public/forms/#{form}/participant/#{participant}"
310
+ end.execute!
311
+
312
+ json[:participant]
313
+ end
314
+
315
+ #
316
+ # Sign document
317
+ #
318
+ # @param [String] document Document GUID
319
+ # @param [Hash] settings Settings of the signing document
320
+ # @param [Hash] access Access credentials
321
+ # @option access [String] :client_id
322
+ # @option access [String] :private_key
323
+ # @return [Array]
324
+ #
325
+ def sign_document!(document, settings = {}, access = {})
326
+ json = Api::Request.new do |request|
327
+ request[:access] = access
328
+ request[:method] = :POST
329
+ request[:path] = "/signature/public/documents/#{document}/sign"
330
+ request[:request_body] = settings
331
+ end.execute!
332
+
333
+ json[:jobId]
334
+ end
335
+
336
+ #
337
+ # Verify to document
338
+ #
339
+ # @param [String] document Document GUID
340
+ # @param [Hash] settings Settings of the signing document
341
+ # @param [Hash] access Access credentials
342
+ # @option access [String] :client_id
343
+ # @option access [String] :private_key
344
+ # @return [Array]
345
+ #
346
+ def self.verify!(access = {})
347
+ json = Api::Request.new do |request|
348
+ request[:access] = access
349
+ request[:method] = :POST
350
+ request[:path] = "/signature/public/verify"
351
+ request[:request_body] = streem
352
+ end.execute!
353
+
354
+ nev(json)
355
+ end
356
+
357
+ #
358
+ # Sign document
359
+ #
360
+ # @param [String] job Job GUID
361
+ # @param [Hash] access Access credentials
362
+ # @option access [String] :client_id
363
+ # @option access [String] :private_key
364
+ # @return [Array]
365
+ #
366
+ def sign_document_status!(job, access = {})
367
+ json = Api::Request.new do |request|
368
+ request[:access] = access
369
+ request[:method] = :GET
370
+ request[:path] = "/signature/public/documents/#{job}/status"
371
+ end.execute!
372
+
373
+ new(json)
374
+ end
375
+
376
+
377
+
36
378
  #
37
379
  # Returns a list of all signatures for recipient.
38
380
  #