groupdocs 1.5.5 → 1.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/groupdocs/datasource.rb +66 -1
- data/lib/groupdocs/document.rb +21 -31
- data/lib/groupdocs/document/annotation.rb +8 -5
- data/lib/groupdocs/job.rb +4 -3
- data/lib/groupdocs/post.rb +4 -12
- data/lib/groupdocs/questionnaire.rb +40 -44
- data/lib/groupdocs/signature.rb +47 -30
- data/lib/groupdocs/signature/envelope.rb +35 -7
- data/lib/groupdocs/signature/field.rb +1 -0
- data/lib/groupdocs/signature/field/location.rb +6 -0
- data/lib/groupdocs/signature/form.rb +33 -1
- data/lib/groupdocs/signature/shared/document_methods.rb +1 -0
- data/lib/groupdocs/storage/file.rb +19 -10
- data/lib/groupdocs/subscription.rb +3 -10
- data/lib/groupdocs/version.rb +1 -1
- data/spec/groupdocs/datasource_spec.rb +41 -0
- data/spec/groupdocs/document/annotation_spec.rb +38 -6
- data/spec/groupdocs/document_spec.rb +258 -25
- data/spec/groupdocs/job_spec.rb +52 -0
- data/spec/groupdocs/questionnaire_spec.rb +45 -9
- data/spec/groupdocs/signature_spec.rb +13 -0
- data/spec/groupdocs/storage/file_spec.rb +68 -0
- data/spec/groupdocs/subscription_spec.rb +119 -0
- data/spec/groupdocs/user_spec.rb +75 -3
- data/spec/support/json/annotation_collaborators_add.json +31 -0
- data/spec/support/json/annotation_collaborators_clear.json +22 -0
- data/spec/support/json/document_html_urls.json +12 -0
- data/spec/support/json/document_shared_documents_get.json +2 -1
- data/spec/support/json/job_resources_get.json +16 -0
- data/spec/support/json/jobs_documents.json +49 -30
- data/spec/support/json/subscription_billing_set.json +21 -0
- data/spec/support/json/subscription_countries_get.json +93 -0
- data/spec/support/json/subscription_get.json +23 -0
- data/spec/support/json/subscription_get_plan.json +48 -0
- data/spec/support/json/subscription_invoices_get.json +18 -0
- data/spec/support/json/subscription_states_get.json +93 -0
- data/spec/support/json/subscription_wizard_get.json +8 -0
- metadata +13 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTM5YTU3Y2Q2MTY1M2RmMjdhODZkMTZhNDdmZGE5YjdlZWY1ZDc5Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmUwM2M1N2Y5ZmJiYTFkNGYyNDQ5NzcyOGY4ZWVhNDQwODRlMTEzMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OWY0NTg5N2I3YTQzNjJhOGI5NTYzYjk5M2FlODRhNDJmMjllM2EwYTg0M2Mx
|
10
|
+
MWNmMWRhMjc5NjNhZjRkOGNjY2E0MWU1ZDRkY2JmNWY1N2Q1MmNlMzg5ZTNk
|
11
|
+
Mzc2NDgwOWVjMTlkOWQ0NzMxM2E4MTExZTQyNjNlOTM0NGMwZjg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjMwNmYxNzU4YWQ2N2RmN2MwZGU1NDYwODlmYTdkYmVmNjBmN2VmN2M4MWY1
|
14
|
+
NjI1ODQyZTVhNGYwZjFhMTQzYmEyNDZhYTA5MTJmMzNjOWFkZDc0NmNmODk5
|
15
|
+
MWMwY2UxNGNkMDMzYTlmYjkyMzcyNjRiNjFmYTA4OWQ3MGM4MDc=
|
data/lib/groupdocs/datasource.rb
CHANGED
@@ -97,7 +97,7 @@ module GroupDocs
|
|
97
97
|
# Adds datasource.
|
98
98
|
#
|
99
99
|
# @example
|
100
|
-
# field = GroupDocs::DataSource::Field.new(
|
100
|
+
# field = GroupDocs::DataSource::Field.new(name: 'test', values: %w(test test))
|
101
101
|
# datasource = GroupDocs::DataSource.new
|
102
102
|
# datasource.add_field(field)
|
103
103
|
# datasource.add!
|
@@ -179,5 +179,70 @@ module GroupDocs
|
|
179
179
|
nil
|
180
180
|
end
|
181
181
|
|
182
|
+
#
|
183
|
+
# Add job document datasource.
|
184
|
+
#
|
185
|
+
# @example
|
186
|
+
# file = GroupDocs::Storage::File.new(guid => "(file guid)").to_document
|
187
|
+
# field = GroupDocs::DataSource::Field.new(:name => "test")
|
188
|
+
# datasource = GroupDocs::DataSource.new
|
189
|
+
# datasource.add_field(field).add!()
|
190
|
+
# job = GroupDocs::Job.create!()
|
191
|
+
# file_id = job.add_document!(file)
|
192
|
+
# datasource = add_datasourse!(job, file_id, datasource)
|
193
|
+
#
|
194
|
+
# @param [GroupDocs::DataSource] datasource
|
195
|
+
# @param [String] jobId Job identifier
|
196
|
+
# @param [String] fileId File identifier
|
197
|
+
# @param [String] datasourceId
|
198
|
+
# @param [Hash] access Access credentials
|
199
|
+
# @option access [String] :client_id
|
200
|
+
# @option access [String] :private_key
|
201
|
+
#
|
202
|
+
def add_datasource!(job, file_id, datasource, access = {})
|
203
|
+
datasource.is_a?(GroupDocs::DataSource) or raise ArgumentError,
|
204
|
+
"Datasource should be GroupDocs::DataSource object, received: #{datasource.inspect}"
|
205
|
+
|
206
|
+
Api::Request.new do |request|
|
207
|
+
request[:access] = access
|
208
|
+
request[:method] = :PUT
|
209
|
+
request[:path] = "/merge/{{client_id}}/jobs/#{job.id}/files/#{file_id}/datasources/#{datasource.id}"
|
210
|
+
end.execute!
|
211
|
+
end
|
212
|
+
|
213
|
+
#
|
214
|
+
# Add job document datasource fields.
|
215
|
+
#
|
216
|
+
#
|
217
|
+
# @example
|
218
|
+
# file = GroupDocs::Storage::File.new(guid => "(file guid)").to_document
|
219
|
+
# field = GroupDocs::DataSource::Field.new(:name => "test")
|
220
|
+
# datasource = GroupDocs::DataSource.new
|
221
|
+
# datasource.add_field(field)
|
222
|
+
# job = GroupDocs::Job.create!()
|
223
|
+
# file_id = job.add_document!(file)
|
224
|
+
# datasource = add_datasourse!(job, file_id, datasource)
|
225
|
+
#
|
226
|
+
#
|
227
|
+
#
|
228
|
+
# @param [String] jobId Job identifier
|
229
|
+
# @param [String] fileId File identifier
|
230
|
+
# @param [Array] datasourceFields
|
231
|
+
# @param [Hash] access Access credentials
|
232
|
+
# @option access [String] :client_id
|
233
|
+
# @option access [String] :private_key
|
234
|
+
#
|
235
|
+
def add_datasource_fields!(job, file_id, datasource, access = {})
|
236
|
+
datasource.is_a?(GroupDocs::DataSource) or raise ArgumentError,
|
237
|
+
"Datasource should be GroupDocs::DataSource object, received: #{datasource.inspect}"
|
238
|
+
Api::Request.new do |request|
|
239
|
+
request[:access] = access
|
240
|
+
request[:method] = :PUT
|
241
|
+
request[:path] = "/merge/{{client_id}}/jobs/#{job.id}/files/#{file_id}/datasources"
|
242
|
+
request[:request_body] = datasource.fields
|
243
|
+
end.execute!
|
244
|
+
|
245
|
+
end
|
246
|
+
|
182
247
|
end # DataSource
|
183
248
|
end # GroupDocs
|
data/lib/groupdocs/document.rb
CHANGED
@@ -106,16 +106,17 @@ module GroupDocs
|
|
106
106
|
documents_to_sign = []
|
107
107
|
documents.map(&:file).each do |file|
|
108
108
|
document = { :name => file.name }
|
109
|
-
contents = File.
|
109
|
+
contents = File.open(file.local_path, 'rb').read
|
110
110
|
contents = Base64.strict_encode64(contents)
|
111
111
|
document.merge!(:data => "data:#{mime_type(file.local_path)};base64,#{contents}")
|
112
112
|
|
113
113
|
documents_to_sign << document
|
114
|
+
|
114
115
|
end
|
115
116
|
|
116
117
|
signers = []
|
117
118
|
signatures.each do |signature|
|
118
|
-
contents = File.
|
119
|
+
contents = File.open(signature.image_path, 'rb').read
|
119
120
|
contents = Base64.strict_encode64(contents)
|
120
121
|
signer = { :name => signature.name, :data => "data:#{mime_type(signature.image_path)};base64,#{contents}" }
|
121
122
|
signer.merge!(signature.position)
|
@@ -123,6 +124,7 @@ module GroupDocs
|
|
123
124
|
signer.merge!(:placeSignatureOn => nil)
|
124
125
|
|
125
126
|
signers << signer
|
127
|
+
|
126
128
|
end
|
127
129
|
|
128
130
|
json = Api::Request.new do |request|
|
@@ -131,14 +133,8 @@ module GroupDocs
|
|
131
133
|
request[:path] = '/signature/{{client_id}}/sign'
|
132
134
|
request[:request_body] = { :documents => documents_to_sign, :signers => signers }
|
133
135
|
end.execute!
|
136
|
+
json[:jobId]
|
134
137
|
|
135
|
-
signed_documents = []
|
136
|
-
json[:documents].each_with_index do |document, i|
|
137
|
-
file = Storage::File.new(:guid => document[:documentId], :name => "#{documents[i].file.name}_signed.pdf")
|
138
|
-
signed_documents << Document.new(:file => file)
|
139
|
-
end
|
140
|
-
|
141
|
-
signed_documents
|
142
138
|
end
|
143
139
|
|
144
140
|
#
|
@@ -182,7 +178,7 @@ module GroupDocs
|
|
182
178
|
metadata.views_count = json[:views_count]
|
183
179
|
if json[:last_view]
|
184
180
|
metadata.last_view = json[:last_view]
|
185
|
-
|
181
|
+
|
186
182
|
end
|
187
183
|
end
|
188
184
|
end
|
@@ -301,7 +297,10 @@ module GroupDocs
|
|
301
297
|
#
|
302
298
|
# Returns a stream of bytes representing a particular document page image.
|
303
299
|
#
|
304
|
-
#
|
300
|
+
# @param [String] path Document path
|
301
|
+
# @param [String] name Name document (format - jpg)
|
302
|
+
# @example path = "#{File.dirname(__FILE__)}"
|
303
|
+
# name = "test.jpg"
|
305
304
|
# @param [Integer] page_number Document page number to get image for
|
306
305
|
# @param [Integer] dimension Image dimension "<width>x<height>"(500x600)
|
307
306
|
# @param [Hash] options
|
@@ -431,7 +430,7 @@ module GroupDocs
|
|
431
430
|
# @example
|
432
431
|
# file = GroupDocs::Storage::Folder.list!.last
|
433
432
|
# document = file.to_document
|
434
|
-
# document.page_html_urls!
|
433
|
+
# document.page_html_urls! first_page: 0, page_count: 1
|
435
434
|
#
|
436
435
|
# @param [Hash] options
|
437
436
|
# @option options [Integer] :first_page Start page to return image for (starting with 0)
|
@@ -461,13 +460,11 @@ module GroupDocs
|
|
461
460
|
# @option access [String] :private_key
|
462
461
|
#
|
463
462
|
def editlock!(access = {})
|
464
|
-
|
463
|
+
Api::Request.new do |request|
|
465
464
|
request[:access] = access
|
466
465
|
request[:method] = :GET
|
467
466
|
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/editlock"
|
468
467
|
end.execute!
|
469
|
-
|
470
|
-
json[:edit_url]
|
471
468
|
end
|
472
469
|
|
473
470
|
#
|
@@ -487,7 +484,6 @@ module GroupDocs
|
|
487
484
|
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/editlock"
|
488
485
|
end
|
489
486
|
api.add_params(options).execute!
|
490
|
-
|
491
487
|
end
|
492
488
|
|
493
489
|
#
|
@@ -504,7 +500,6 @@ module GroupDocs
|
|
504
500
|
request[:method] = :GET
|
505
501
|
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/tags"
|
506
502
|
end.execute!
|
507
|
-
|
508
503
|
end
|
509
504
|
|
510
505
|
#
|
@@ -516,13 +511,11 @@ module GroupDocs
|
|
516
511
|
# @return [String]
|
517
512
|
#
|
518
513
|
def tags_set!(access = {})
|
519
|
-
|
514
|
+
Api::Request.new do |request|
|
520
515
|
request[:access] = access
|
521
516
|
request[:method] = :PUT
|
522
517
|
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/tags"
|
523
518
|
end.execute!
|
524
|
-
|
525
|
-
json[:document_id]
|
526
519
|
end
|
527
520
|
|
528
521
|
#
|
@@ -534,13 +527,11 @@ module GroupDocs
|
|
534
527
|
# @return [String]
|
535
528
|
#
|
536
529
|
def tags_clear!(access = {})
|
537
|
-
|
530
|
+
Api::Request.new do |request|
|
538
531
|
request[:access] = access
|
539
532
|
request[:method] = :DELETE
|
540
533
|
request[:path] = "/doc/{{client_id}}/files/#{file.guid}/tags"
|
541
534
|
end.execute!
|
542
|
-
|
543
|
-
json[:document_id]
|
544
535
|
end
|
545
536
|
|
546
537
|
#
|
@@ -706,7 +697,6 @@ module GroupDocs
|
|
706
697
|
metadata.views_count = json[:views_count]
|
707
698
|
if json[:last_view]
|
708
699
|
metadata.last_view = json[:last_view]
|
709
|
-
metadata.last_view.document = self
|
710
700
|
end
|
711
701
|
end
|
712
702
|
end
|
@@ -940,15 +930,15 @@ module GroupDocs
|
|
940
930
|
#
|
941
931
|
# @raise [ArgumentError] if datasource is not GroupDocs::DataSource object
|
942
932
|
#
|
943
|
-
def datasource_fields!(datasource,
|
933
|
+
def datasource_fields!(datasource, options = {}, access = {})
|
944
934
|
datasource.is_a?(GroupDocs::DataSource) or raise ArgumentError,
|
945
935
|
"Datasource should be GroupDocs::DataSource object, received: #{datasource.inspect}"
|
946
936
|
|
947
937
|
api = Api::Request.new do |request|
|
948
938
|
request[:access] = access
|
949
939
|
request[:method] = :POST
|
950
|
-
request[:path] = "/merge/{{client_id}}/files/#{file.guid}/datasources
|
951
|
-
request[:request_body] =
|
940
|
+
request[:path] = "/merge/{{client_id}}/files/#{file.guid}/datasources"
|
941
|
+
request[:request_body] = datasource.fields
|
952
942
|
end
|
953
943
|
api.add_params(options)
|
954
944
|
json = api.execute!
|
@@ -1099,7 +1089,7 @@ module GroupDocs
|
|
1099
1089
|
#
|
1100
1090
|
# @raise [ArgumentError] if document is not GroupDocs::Document object
|
1101
1091
|
#
|
1102
|
-
def compare!(document, access = {})
|
1092
|
+
def compare!(document, callback, access = {})
|
1103
1093
|
document.is_a?(GroupDocs::Document) or raise ArgumentError,
|
1104
1094
|
"Document should be GroupDocs::Document object, received: #{document.inspect}"
|
1105
1095
|
|
@@ -1108,7 +1098,7 @@ module GroupDocs
|
|
1108
1098
|
request[:method] = :GET
|
1109
1099
|
request[:path] = "/comparison/{{client_id}}/comparison/compare"
|
1110
1100
|
end
|
1111
|
-
api.add_params(:source => file.guid, :target => document.file.guid)
|
1101
|
+
api.add_params(:source => file.guid, :target => document.file.guid, :callback => callback)
|
1112
1102
|
json = api.execute!
|
1113
1103
|
|
1114
1104
|
Job.new(:id => json[:job_id])
|
@@ -1185,7 +1175,7 @@ module GroupDocs
|
|
1185
1175
|
# @option access [String] :private_key
|
1186
1176
|
#
|
1187
1177
|
#
|
1188
|
-
def download!( path,
|
1178
|
+
def download!( path, options = {}, access = {})
|
1189
1179
|
api = Api::Request.new do |request|
|
1190
1180
|
request[:access] = access
|
1191
1181
|
request[:method] = :DOWNLOAD
|
@@ -1194,7 +1184,7 @@ module GroupDocs
|
|
1194
1184
|
api.add_params(options)
|
1195
1185
|
response = api.execute!
|
1196
1186
|
|
1197
|
-
filepath = "#{path}/#{name}"
|
1187
|
+
filepath = "#{path}/#{file.name}"
|
1198
1188
|
Object::File.open(filepath, 'wb') do |file|
|
1199
1189
|
file.write(response)
|
1200
1190
|
end
|
@@ -166,19 +166,22 @@ module GroupDocs
|
|
166
166
|
#
|
167
167
|
# @example
|
168
168
|
# document = GroupDocs::Storage::Folder.list!.first.to_document
|
169
|
-
# annotation = GroupDocs::Document::Annotation.new(document: document)
|
169
|
+
# annotation = GroupDocs::Document::Annotation.new(document: document) #
|
170
170
|
# annotation.create!
|
171
171
|
#
|
172
|
+
# @param [Hash] info Annotation info
|
173
|
+
# @option info [Array] :box
|
174
|
+
# @option info [Array] :annotationPosition
|
172
175
|
# @param [Hash] access Access credentials
|
173
176
|
# @option access [String] :client_id
|
174
177
|
# @option access [String] :private_key
|
175
178
|
#
|
176
|
-
def create!(access = {})
|
179
|
+
def create!(info, access = {})
|
177
180
|
json = Api::Request.new do |request|
|
178
181
|
request[:access] = access
|
179
182
|
request[:method] = :POST
|
180
183
|
request[:path] = "/ant/{{client_id}}/files/#{document.file.guid}/annotations"
|
181
|
-
request[:request_body] =
|
184
|
+
request[:request_body] = info
|
182
185
|
end.execute!
|
183
186
|
|
184
187
|
json.each do |field, value|
|
@@ -193,7 +196,7 @@ module GroupDocs
|
|
193
196
|
# @option access [String] :client_id
|
194
197
|
# @option access [String] :private_key
|
195
198
|
#
|
196
|
-
def remove!(access = {})
|
199
|
+
def self.remove!(guid, access = {})
|
197
200
|
Api::Request.new do |request|
|
198
201
|
request[:access] = access
|
199
202
|
request[:method] = :DELETE
|
@@ -295,7 +298,7 @@ module GroupDocs
|
|
295
298
|
request[:access] = access
|
296
299
|
request[:method] = :PUT
|
297
300
|
request[:path] = "/ant/{{client_id}}/annotations/#{guid}/size"
|
298
|
-
request[:request_body] = { :
|
301
|
+
request[:request_body] = { :width => x, :height => y }
|
299
302
|
end.execute!
|
300
303
|
|
301
304
|
self.width = x
|
data/lib/groupdocs/job.rb
CHANGED
@@ -89,16 +89,17 @@ module GroupDocs
|
|
89
89
|
#
|
90
90
|
# Returns job by its identifier.
|
91
91
|
#
|
92
|
-
# @param [
|
92
|
+
# @param [Hash] options
|
93
93
|
# @option statusIds [String] :statusIds (required)
|
94
|
-
# @option actions [
|
94
|
+
# @option actions [Integer] :actions
|
95
95
|
# @option excluded_actions [String] :excluded_actions
|
96
96
|
# @param [Hash] access Access credentials
|
97
97
|
# @option access [String] :client_id
|
98
98
|
# @option access [String] :private_key
|
99
99
|
# @return [GroupDocs::Job]
|
100
100
|
#
|
101
|
-
def self.get_resources!(options = {}, access = {})
|
101
|
+
def self.get_resources!(options = {} , access = {})
|
102
|
+
options[:actions] = convert_actions_to_byte(options[:actions])
|
102
103
|
api = Api::Request.new do |request|
|
103
104
|
request[:access] = access
|
104
105
|
request[:method] = :GET
|
data/lib/groupdocs/post.rb
CHANGED
@@ -16,9 +16,7 @@ module GroupDocs
|
|
16
16
|
request[:path] = '/post/file.rename'
|
17
17
|
end
|
18
18
|
api.add_params(options)
|
19
|
-
|
20
|
-
|
21
|
-
new(json)
|
19
|
+
api.execute!
|
22
20
|
end
|
23
21
|
|
24
22
|
# Delete by post.
|
@@ -34,9 +32,7 @@ module GroupDocs
|
|
34
32
|
request[:path] = '/post/file.delete'
|
35
33
|
end
|
36
34
|
api.add_params(options)
|
37
|
-
|
38
|
-
|
39
|
-
new(json)
|
35
|
+
api.execute!
|
40
36
|
end
|
41
37
|
|
42
38
|
# Delete from folder by post.
|
@@ -52,9 +48,7 @@ module GroupDocs
|
|
52
48
|
request[:path] = '/post/file.delete.in'
|
53
49
|
end
|
54
50
|
api.add_params(options)
|
55
|
-
|
56
|
-
|
57
|
-
new(json)
|
51
|
+
api.execute!
|
58
52
|
end
|
59
53
|
|
60
54
|
# Compress by post.
|
@@ -71,9 +65,7 @@ module GroupDocs
|
|
71
65
|
request[:path] = '/post/file.compress'
|
72
66
|
end
|
73
67
|
api.add_params(options)
|
74
|
-
|
75
|
-
|
76
|
-
new(json)
|
68
|
+
api.execute!
|
77
69
|
end
|
78
70
|
|
79
71
|
|
@@ -15,6 +15,8 @@ module GroupDocs
|
|
15
15
|
# @option options [Symbol] :status Filter questionnaires by status
|
16
16
|
# @option options [Integer] :page_number Page to start with
|
17
17
|
# @option options [Integer] :page_size How many items to list
|
18
|
+
# @option options [String] :orderBy Order by column (optional)
|
19
|
+
# @option options [Bool] :isAscending Order by ascending or descending (optional)
|
18
20
|
# @param [Hash] access Access credentials
|
19
21
|
# @option access [String] :client_id
|
20
22
|
# @option access [String] :private_key
|
@@ -128,46 +130,6 @@ module GroupDocs
|
|
128
130
|
@pages << page
|
129
131
|
end
|
130
132
|
|
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
133
|
|
172
134
|
#
|
173
135
|
# Creates questionnaire.
|
@@ -263,20 +225,26 @@ module GroupDocs
|
|
263
225
|
end
|
264
226
|
end
|
265
227
|
|
266
|
-
|
228
|
+
#
|
267
229
|
# Returns an array of questionnaire collectors.
|
268
230
|
#
|
231
|
+
#
|
232
|
+
# @param [Hash] options Options
|
233
|
+
# @option options [String] :orderBy Order by column (required)
|
234
|
+
# @option options [Boolean] :isAsc Order by ascending or descending (required)
|
269
235
|
# @param [Hash] access Access credentials
|
270
236
|
# @option access [String] :client_id
|
271
237
|
# @option access [String] :private_key
|
272
238
|
# @return [Array<GroupDocs::Questionnaire::Collector>]
|
273
239
|
#
|
274
|
-
def collectors!(access = {})
|
275
|
-
|
240
|
+
def collectors!(options = {}, access = {})
|
241
|
+
api = Api::Request.new do |request|
|
276
242
|
request[:access] = access
|
277
243
|
request[:method] = :GET
|
278
244
|
request[:path] = "/merge/{{client_id}}/questionnaires/#{guid}/collectors"
|
279
|
-
end
|
245
|
+
end
|
246
|
+
api = add_params(options)
|
247
|
+
json = api.execute!
|
280
248
|
|
281
249
|
json[:collectors].map do |collector|
|
282
250
|
collector.merge!(:questionnaire => self)
|
@@ -349,6 +317,34 @@ module GroupDocs
|
|
349
317
|
Document::Field.new(field)
|
350
318
|
end
|
351
319
|
end
|
320
|
+
|
321
|
+
#
|
322
|
+
# Copy file to given path.
|
323
|
+
#
|
324
|
+
# @param [String] path (required)
|
325
|
+
# @param [String] mode Mode (optional)
|
326
|
+
# @param [Hash] options
|
327
|
+
# @option options [String] name
|
328
|
+
# @param [Hash] access Access credentials
|
329
|
+
# @option access [String] :client_id
|
330
|
+
# @option access [String] :private_key
|
331
|
+
# @return [Array] Templates
|
332
|
+
#
|
333
|
+
def copy_to_templates!(path, mode, options = {}, access = {})
|
334
|
+
options[:name] ||= name
|
335
|
+
path = prepare_path("#{path}/#{options[:name]}")
|
336
|
+
|
337
|
+
api = Api::Request.new do |request|
|
338
|
+
request[:access] = access
|
339
|
+
request[:method] = :PUT
|
340
|
+
request[:headers] = { :'Groupdocs-Copy' => id }
|
341
|
+
request[:path] = "/merge/{{client_id}}/files/#{path}"
|
342
|
+
end
|
343
|
+
api = add_params(:mode => mode)
|
344
|
+
json = api.execute!
|
345
|
+
|
346
|
+
json[:templates]
|
347
|
+
end
|
352
348
|
|
353
349
|
end # Questionnaire
|
354
350
|
end # GroupDocs
|