groupdocs 0.3.11 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +150 -0
- data/README.md +6 -58
- data/Rakefile +1 -1
- data/examples/README.md +13 -0
- data/examples/annotations/Gemfile +5 -0
- data/examples/annotations/app.rb +67 -0
- data/groupdocs.gemspec +3 -3
- data/lib/groupdocs.rb +11 -2
- data/lib/groupdocs/api/entity.rb +17 -1
- data/lib/groupdocs/api/helpers/path_helper.rb +10 -10
- data/lib/groupdocs/api/helpers/rest_helper.rb +7 -2
- data/lib/groupdocs/api/helpers/url_helper.rb +2 -4
- data/lib/groupdocs/api/request.rb +2 -4
- data/lib/groupdocs/datasource.rb +2 -2
- data/lib/groupdocs/datasource/field.rb +1 -1
- data/lib/groupdocs/document.rb +6 -18
- data/lib/groupdocs/document/annotation.rb +25 -2
- data/lib/groupdocs/document/annotation/reply.rb +6 -10
- data/lib/groupdocs/document/change.rb +1 -1
- data/lib/groupdocs/document/field.rb +1 -1
- data/lib/groupdocs/document/metadata.rb +1 -1
- data/lib/groupdocs/document/rectangle.rb +1 -1
- data/lib/groupdocs/document/view.rb +1 -1
- data/lib/groupdocs/job.rb +51 -8
- data/lib/groupdocs/questionnaire.rb +2 -2
- data/lib/groupdocs/questionnaire/execution.rb +1 -1
- data/lib/groupdocs/questionnaire/page.rb +1 -1
- data/lib/groupdocs/questionnaire/question.rb +1 -1
- data/lib/groupdocs/questionnaire/question/answer.rb +1 -1
- data/lib/groupdocs/signature.rb +134 -0
- data/lib/groupdocs/signature/contact.rb +141 -0
- data/lib/groupdocs/signature/envelope.rb +376 -0
- data/lib/groupdocs/signature/envelope/log.rb +22 -0
- data/lib/groupdocs/signature/field.rb +253 -0
- data/lib/groupdocs/signature/field/location.rb +72 -0
- data/lib/groupdocs/signature/form.rb +202 -0
- data/lib/groupdocs/signature/list.rb +93 -0
- data/lib/groupdocs/signature/recipient.rb +47 -0
- data/lib/groupdocs/signature/role.rb +84 -0
- data/lib/groupdocs/signature/shared.rb +6 -0
- data/lib/groupdocs/signature/shared/document_methods.rb +98 -0
- data/lib/groupdocs/signature/shared/entity_fields.rb +94 -0
- data/lib/groupdocs/signature/shared/entity_methods.rb +145 -0
- data/lib/groupdocs/signature/shared/field_methods.rb +282 -0
- data/lib/groupdocs/signature/shared/recipient_methods.rb +63 -0
- data/lib/groupdocs/signature/shared/resource_methods.rb +65 -0
- data/lib/groupdocs/signature/template.rb +104 -0
- data/lib/groupdocs/storage/file.rb +69 -62
- data/lib/groupdocs/storage/folder.rb +54 -88
- data/lib/groupdocs/storage/package.rb +1 -1
- data/lib/groupdocs/subscription.rb +113 -0
- data/lib/groupdocs/subscription/limit.rb +24 -0
- data/lib/groupdocs/user.rb +22 -2
- data/lib/groupdocs/version.rb +1 -1
- data/spec/groupdocs/api/entity_spec.rb +14 -0
- data/spec/groupdocs/api/helpers/path_helper_spec.rb +6 -19
- data/spec/groupdocs/api/helpers/rest_helper_spec.rb +9 -0
- data/spec/groupdocs/api/request_spec.rb +2 -7
- data/spec/groupdocs/datasource_spec.rb +3 -7
- data/spec/groupdocs/document/annotation/reply_spec.rb +11 -20
- data/spec/groupdocs/document/annotation_spec.rb +35 -31
- data/spec/groupdocs/document/field_spec.rb +1 -4
- data/spec/groupdocs/document/rectangle_spec.rb +10 -22
- data/spec/groupdocs/document_spec.rb +7 -27
- data/spec/groupdocs/job_spec.rb +43 -0
- data/spec/groupdocs/questionnaire/question_spec.rb +2 -6
- data/spec/groupdocs/questionnaire_spec.rb +3 -7
- data/spec/groupdocs/signature/contact_spec.rb +129 -0
- data/spec/groupdocs/signature/envelope/log_spec.rb +23 -0
- data/spec/groupdocs/signature/envelope_spec.rb +296 -0
- data/spec/groupdocs/signature/field/location_spec.rb +73 -0
- data/spec/groupdocs/signature/field_spec.rb +264 -0
- data/spec/groupdocs/signature/form_spec.rb +174 -0
- data/spec/groupdocs/signature/list_spec.rb +92 -0
- data/spec/groupdocs/signature/recipient_spec.rb +37 -0
- data/spec/groupdocs/signature/role_spec.rb +100 -0
- data/spec/groupdocs/signature/template_spec.rb +82 -0
- data/spec/groupdocs/signature_spec.rb +117 -0
- data/spec/groupdocs/storage/file_spec.rb +76 -61
- data/spec/groupdocs/storage/folder_spec.rb +43 -90
- data/spec/groupdocs/storage/package_spec.rb +1 -2
- data/spec/groupdocs/subscription/limit_spec.rb +24 -0
- data/spec/groupdocs/subscription_spec.rb +85 -0
- data/spec/groupdocs/user_spec.rb +27 -18
- data/spec/groupdocs_spec.rb +11 -0
- data/spec/spec_helper.rb +10 -1
- data/spec/support/files/envelope.zip +0 -0
- data/spec/support/json/annotation_access_set.json +11 -0
- data/spec/support/json/contact_add.json +12 -0
- data/spec/support/json/contacts_get.json +19 -0
- data/spec/support/json/contacts_import.json +8 -0
- data/spec/support/json/envelope_get.json +46 -0
- data/spec/support/json/envelope_logs.json +16 -0
- data/spec/support/json/envelopes_all.json +48 -0
- data/spec/support/json/envelopes_resources.json +31 -0
- data/spec/support/json/form_get.json +21 -0
- data/spec/support/json/forms_all.json +23 -0
- data/spec/support/json/job_get.json +30 -0
- data/spec/support/json/list_add.json +12 -0
- data/spec/support/json/lists_get.json +19 -0
- data/spec/support/json/signature_create.json +12 -0
- data/spec/support/json/signature_field_add.json +25 -0
- data/spec/support/json/signature_fields_get.json +27 -0
- data/spec/support/json/signature_roles_get.json +17 -0
- data/spec/support/json/signatures_get.json +19 -0
- data/spec/support/json/subscription_plan_get.json +9 -0
- data/spec/support/json/subscription_plans_get.json +17 -0
- data/spec/support/json/template_get.json +35 -0
- data/spec/support/json/template_get_documents.json +15 -0
- data/spec/support/json/template_get_recipients.json +20 -0
- data/spec/support/json/templates_all.json +37 -0
- data/spec/support/json/user_users_get.json +27 -0
- data/spec/support/shared_examples/signature/shared/document_methods.rb +68 -0
- data/spec/support/shared_examples/signature/shared/entity_fields.rb +89 -0
- data/spec/support/shared_examples/signature/shared/entity_methods.rb +116 -0
- data/spec/support/shared_examples/signature/shared/field_methods.rb +188 -0
- data/spec/support/shared_examples/signature/shared/recipient_methods.rb +42 -0
- data/spec/support/shared_examples/signature/shared/resource_methods.rb +46 -0
- metadata +139 -29
- data/lib/groupdocs/extensions.rb +0 -1
- data/lib/groupdocs/extensions/lookup.rb +0 -52
- data/spec/support/shared_examples/extensions/lookup.rb +0 -57
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
require 'rest-client'
|
|
3
|
+
|
|
1
4
|
module GroupDocs
|
|
2
5
|
module Api
|
|
3
6
|
module Helpers
|
|
@@ -25,8 +28,10 @@ module GroupDocs
|
|
|
25
28
|
options[:method] = options[:method].downcase.to_sym
|
|
26
29
|
|
|
27
30
|
if options[:request_body] && !options[:request_body].is_a?(Object::File)
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
unless options[:plain]
|
|
32
|
+
options[:request_body] = options[:request_body].to_json
|
|
33
|
+
options[:headers][:content_type]= 'application/json'
|
|
34
|
+
end
|
|
30
35
|
options[:headers][:content_length] = options[:request_body].length
|
|
31
36
|
end
|
|
32
37
|
end
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
require 'base64'
|
|
2
|
-
require 'hmac-sha1'
|
|
3
2
|
require 'uri'
|
|
4
3
|
require 'cgi'
|
|
5
4
|
|
|
@@ -56,9 +55,8 @@ module GroupDocs
|
|
|
56
55
|
#
|
|
57
56
|
def sign_url
|
|
58
57
|
# calculate a hash of the path with private key
|
|
59
|
-
hash =
|
|
60
|
-
hash
|
|
61
|
-
hash = hash.digest
|
|
58
|
+
hash = OpenSSL::Digest::Digest.new('sha1')
|
|
59
|
+
hash = OpenSSL::HMAC.digest(hash, private_key, options[:path])
|
|
62
60
|
# convert hash to base64
|
|
63
61
|
hash = Base64.strict_encode64(hash)
|
|
64
62
|
# remove trailing '='
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require 'json'
|
|
2
1
|
require 'groupdocs/api/helpers'
|
|
3
2
|
|
|
4
3
|
module GroupDocs
|
|
@@ -32,7 +31,8 @@ module GroupDocs
|
|
|
32
31
|
# @option options [String] :path Path to send request to
|
|
33
32
|
# @option options [Hash] :headers Additional HTTP headers
|
|
34
33
|
# @option options [Hash] :access Access credentials hash
|
|
35
|
-
# @option options [Hash,
|
|
34
|
+
# @option options [Hash, String, Array, File] :request_body payload
|
|
35
|
+
# @option options [Boolean] :plain Send payload as plain text (i.e. do not convert to JSON)
|
|
36
36
|
#
|
|
37
37
|
# @yieldparam [Hash] options
|
|
38
38
|
#
|
|
@@ -47,7 +47,6 @@ module GroupDocs
|
|
|
47
47
|
# Executes API request to server.
|
|
48
48
|
#
|
|
49
49
|
# It performs the following actions step by step:
|
|
50
|
-
# * Normalizes path (i.e. replace // with /)
|
|
51
50
|
# * Parses path (i.e. replaces client ID)
|
|
52
51
|
# * Prepends path with version if it's set
|
|
53
52
|
# * URL encodes path
|
|
@@ -59,7 +58,6 @@ module GroupDocs
|
|
|
59
58
|
# @return [Hash, String] Parsed response
|
|
60
59
|
#
|
|
61
60
|
def execute!
|
|
62
|
-
normalize_path
|
|
63
61
|
parse_path
|
|
64
62
|
prepend_version
|
|
65
63
|
url_encode_path
|
data/lib/groupdocs/datasource.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module GroupDocs
|
|
2
|
-
class DataSource <
|
|
2
|
+
class DataSource < Api::Entity
|
|
3
3
|
|
|
4
4
|
require 'groupdocs/datasource/field'
|
|
5
5
|
|
|
@@ -153,7 +153,7 @@ module GroupDocs
|
|
|
153
153
|
request[:method] = :DELETE
|
|
154
154
|
request[:path] = "/merge/{{client_id}}/datasources/#{id}"
|
|
155
155
|
end.execute!
|
|
156
|
-
# TODO: fix this in API
|
|
156
|
+
# TODO: fix this in API - http://scotland.groupdocs.com/jira/browse/CORE-387
|
|
157
157
|
rescue RestClient::BadRequest
|
|
158
158
|
nil
|
|
159
159
|
end
|
data/lib/groupdocs/document.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module GroupDocs
|
|
2
|
-
class Document <
|
|
2
|
+
class Document < Api::Entity
|
|
3
3
|
|
|
4
4
|
require 'groupdocs/document/annotation'
|
|
5
5
|
require 'groupdocs/document/change'
|
|
@@ -15,23 +15,9 @@ module GroupDocs
|
|
|
15
15
|
public: 3,
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
extend Extensions::Lookup
|
|
19
18
|
include Api::Helpers::AccessMode
|
|
20
19
|
include Api::Helpers::Status
|
|
21
20
|
|
|
22
|
-
#
|
|
23
|
-
# Returns an array of all documents on server.
|
|
24
|
-
#
|
|
25
|
-
# @param [String] path Starting path to look for documents
|
|
26
|
-
# @param [Hash] access Access credentials
|
|
27
|
-
# @option access [String] :client_id
|
|
28
|
-
# @option access [String] :private_key
|
|
29
|
-
# @return [Array<GroupDocs::Storage::Document>]
|
|
30
|
-
#
|
|
31
|
-
def self.all!(path = '/', access = {})
|
|
32
|
-
Storage::File.all!(path, access).map(&:to_document)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
21
|
#
|
|
36
22
|
# Returns an array of views for all documents.
|
|
37
23
|
#
|
|
@@ -67,6 +53,8 @@ module GroupDocs
|
|
|
67
53
|
attr_accessor :output_formats
|
|
68
54
|
# @attr [Symbol] status
|
|
69
55
|
attr_accessor :status
|
|
56
|
+
# @attr [Integet] order
|
|
57
|
+
attr_accessor :order
|
|
70
58
|
|
|
71
59
|
#
|
|
72
60
|
# Coverts passed array of attributes hash to array of GroupDocs::Storage::File.
|
|
@@ -303,7 +291,7 @@ module GroupDocs
|
|
|
303
291
|
# Converts document to given format.
|
|
304
292
|
#
|
|
305
293
|
# @example
|
|
306
|
-
# document = GroupDocs::
|
|
294
|
+
# document = GroupDocs::Storage::Folder.list!.first.to_document
|
|
307
295
|
# job = document.convert!(:docx)
|
|
308
296
|
# sleep(5) # wait for server to finish converting
|
|
309
297
|
# original_document = job.documents!.first
|
|
@@ -522,8 +510,8 @@ module GroupDocs
|
|
|
522
510
|
# Returns an array of changes in document.
|
|
523
511
|
#
|
|
524
512
|
# @example
|
|
525
|
-
# document_one = GroupDocs::
|
|
526
|
-
# document_two = GroupDocs::
|
|
513
|
+
# document_one = GroupDocs::Storage::Folder.list![0].to_document
|
|
514
|
+
# document_two = GroupDocs::Storage::Folder.list![1].to_document
|
|
527
515
|
# job = document_one.compare!(document_two)
|
|
528
516
|
# sleep(5) # wait for server to finish comparing
|
|
529
517
|
# result = job.documents!.first
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module GroupDocs
|
|
2
|
-
class Document::Annotation <
|
|
2
|
+
class Document::Annotation < Api::Entity
|
|
3
3
|
|
|
4
4
|
require 'groupdocs/document/annotation/reply'
|
|
5
5
|
|
|
@@ -17,6 +17,8 @@ module GroupDocs
|
|
|
17
17
|
attr_accessor :sessionGuid
|
|
18
18
|
# @attr [String] documentGuid
|
|
19
19
|
attr_accessor :documentGuid
|
|
20
|
+
# @attr [String] creatorGuid
|
|
21
|
+
attr_accessor :creatorGuid
|
|
20
22
|
# @attr [String] replyGuid
|
|
21
23
|
attr_accessor :replyGuid
|
|
22
24
|
# @attr [Time] createdOn
|
|
@@ -40,6 +42,8 @@ module GroupDocs
|
|
|
40
42
|
alias_method :session_guid=, :sessionGuid=
|
|
41
43
|
alias_method :document_guid, :documentGuid
|
|
42
44
|
alias_method :document_guid=, :documentGuid=
|
|
45
|
+
alias_method :creator_guid, :creatorGuid
|
|
46
|
+
alias_method :creator_guid=, :creatorGuid=
|
|
43
47
|
alias_method :reply_guid, :replyGuid
|
|
44
48
|
alias_method :reply_guid=, :replyGuid=
|
|
45
49
|
alias_method :created_on, :createdOn
|
|
@@ -156,7 +160,7 @@ module GroupDocs
|
|
|
156
160
|
# Creates new annotation.
|
|
157
161
|
#
|
|
158
162
|
# @example
|
|
159
|
-
# document = GroupDocs::
|
|
163
|
+
# document = GroupDocs::Storage::Folder.list!.first.to_document
|
|
160
164
|
# annotation = GroupDocs::Document::Annotation.new(document: document)
|
|
161
165
|
# annotation.create!
|
|
162
166
|
#
|
|
@@ -272,5 +276,24 @@ module GroupDocs
|
|
|
272
276
|
self.annotation_position = { x: x, y: y }
|
|
273
277
|
end
|
|
274
278
|
|
|
279
|
+
#
|
|
280
|
+
# Sets access mode.
|
|
281
|
+
#
|
|
282
|
+
# @param [Symbol] mode
|
|
283
|
+
# @param [Hash] access Access credentials
|
|
284
|
+
# @option access [String] :client_id
|
|
285
|
+
# @option access [String] :private_key
|
|
286
|
+
#
|
|
287
|
+
def set_access!(mode, access = {})
|
|
288
|
+
Api::Request.new do |request|
|
|
289
|
+
request[:access] = access
|
|
290
|
+
request[:method] = :PUT
|
|
291
|
+
request[:path] = "/ant/{{client_id}}/annotations/#{guid}/annotationAccess"
|
|
292
|
+
request[:request_body] = %w(public private).index(mode.to_s)
|
|
293
|
+
end.execute!
|
|
294
|
+
|
|
295
|
+
self.access = mode
|
|
296
|
+
end
|
|
297
|
+
|
|
275
298
|
end # Document::Annotation
|
|
276
299
|
end # GroupDocs
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module GroupDocs
|
|
2
|
-
class Document::Annotation::Reply <
|
|
2
|
+
class Document::Annotation::Reply < Api::Entity
|
|
3
3
|
|
|
4
4
|
#
|
|
5
5
|
# Return an array of replies for given annotation.
|
|
@@ -88,8 +88,8 @@ module GroupDocs
|
|
|
88
88
|
# Creates reply.
|
|
89
89
|
#
|
|
90
90
|
# @example
|
|
91
|
-
# document = GroupDocs::
|
|
92
|
-
# annotation =
|
|
91
|
+
# document = GroupDocs::Storage::Folder.list!.first.to_document
|
|
92
|
+
# annotation = document.annotations!.first
|
|
93
93
|
# reply = GroupDocs::Document::Annotation::Reply.new(annotation: annotation)
|
|
94
94
|
# reply.text = "Reply text"
|
|
95
95
|
# reply.create!
|
|
@@ -98,14 +98,12 @@ module GroupDocs
|
|
|
98
98
|
# @option access [String] :client_id
|
|
99
99
|
# @option access [String] :private_key
|
|
100
100
|
#
|
|
101
|
-
# @raise [NameError] if annotation or annotation_guid are not set
|
|
102
|
-
#
|
|
103
101
|
def create!(access = {})
|
|
104
102
|
json = Api::Request.new do |request|
|
|
105
103
|
request[:access] = access
|
|
106
104
|
request[:method] = :POST
|
|
107
105
|
request[:path] = "/ant/{{client_id}}/annotations/#{get_annotation_guid}/replies"
|
|
108
|
-
request[:request_body] = text
|
|
106
|
+
request[:request_body] = { text: text }
|
|
109
107
|
end.execute!
|
|
110
108
|
|
|
111
109
|
self.guid = json[:replyGuid]
|
|
@@ -116,7 +114,7 @@ module GroupDocs
|
|
|
116
114
|
# Edits reply.
|
|
117
115
|
#
|
|
118
116
|
# @example
|
|
119
|
-
# document = GroupDocs::
|
|
117
|
+
# document = GroupDocs::Storage::Folder.list!.first.to_document
|
|
120
118
|
# annotation = document.annotations!.first
|
|
121
119
|
# reply = annotation.replies!.first
|
|
122
120
|
# reply.text = "New reply text"
|
|
@@ -142,8 +140,6 @@ module GroupDocs
|
|
|
142
140
|
# @option access [String] :client_id
|
|
143
141
|
# @option access [String] :private_key
|
|
144
142
|
#
|
|
145
|
-
# @todo currently not implemented in API
|
|
146
|
-
#
|
|
147
143
|
def remove!(access = {})
|
|
148
144
|
Api::Request.new do |request|
|
|
149
145
|
request[:access] = access
|
|
@@ -157,7 +153,7 @@ module GroupDocs
|
|
|
157
153
|
#
|
|
158
154
|
# Returns annotation guid.
|
|
159
155
|
#
|
|
160
|
-
# @
|
|
156
|
+
# @return [String]
|
|
161
157
|
#
|
|
162
158
|
def get_annotation_guid
|
|
163
159
|
annotation_guid || annotation.guid
|
data/lib/groupdocs/job.rb
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module GroupDocs
|
|
2
|
-
class Job <
|
|
2
|
+
class Job < Api::Entity
|
|
3
3
|
|
|
4
4
|
extend Api::Helpers::Actions
|
|
5
5
|
include Api::Helpers::Status
|
|
6
6
|
|
|
7
7
|
#
|
|
8
|
-
# Returns array of
|
|
8
|
+
# Returns array of jobs.
|
|
9
9
|
#
|
|
10
10
|
# @param [Hash] options Hash of options
|
|
11
11
|
# @option options [Integer] :page Page to start with
|
|
@@ -29,6 +29,25 @@ module GroupDocs
|
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
#
|
|
33
|
+
# Returns job by its identifier.
|
|
34
|
+
#
|
|
35
|
+
# @param [Integer] id
|
|
36
|
+
# @param [Hash] access Access credentials
|
|
37
|
+
# @option access [String] :client_id
|
|
38
|
+
# @option access [String] :private_key
|
|
39
|
+
# @return [GroupDocs::Job]
|
|
40
|
+
#
|
|
41
|
+
def self.get!(id, access = {})
|
|
42
|
+
json = Api::Request.new do |request|
|
|
43
|
+
request[:access] = access
|
|
44
|
+
request[:method] = :GET
|
|
45
|
+
request[:path] = "/async/{{client_id}}/jobs/#{id}"
|
|
46
|
+
end.execute!
|
|
47
|
+
|
|
48
|
+
Job.new(json)
|
|
49
|
+
end
|
|
50
|
+
|
|
32
51
|
#
|
|
33
52
|
# Creates new draft job.
|
|
34
53
|
#
|
|
@@ -55,11 +74,17 @@ module GroupDocs
|
|
|
55
74
|
end
|
|
56
75
|
json = api.execute!
|
|
57
76
|
|
|
58
|
-
Job.new(id: json[:job_id])
|
|
77
|
+
Job.new(id: json[:job_id], guid: json[:job_guid])
|
|
59
78
|
end
|
|
60
79
|
|
|
61
80
|
# @attr [Integer] id
|
|
62
81
|
attr_accessor :id
|
|
82
|
+
# @attr [String] guid
|
|
83
|
+
attr_accessor :guid
|
|
84
|
+
# @attr [String] name
|
|
85
|
+
attr_accessor :name
|
|
86
|
+
# @attr [Integer] priority
|
|
87
|
+
attr_accessor :priority
|
|
63
88
|
# @attr [Array<Symbol>] actions
|
|
64
89
|
attr_accessor :actions
|
|
65
90
|
# @attr [Boolean] email_results
|
|
@@ -130,9 +155,13 @@ module GroupDocs
|
|
|
130
155
|
end.execute!
|
|
131
156
|
|
|
132
157
|
self.status = json[:job_status]
|
|
133
|
-
json[:inputs]
|
|
134
|
-
|
|
135
|
-
|
|
158
|
+
if json[:inputs]
|
|
159
|
+
json[:inputs].map do |document|
|
|
160
|
+
document.merge!(file: GroupDocs::Storage::File.new(document))
|
|
161
|
+
Document.new(document)
|
|
162
|
+
end
|
|
163
|
+
else
|
|
164
|
+
[]
|
|
136
165
|
end
|
|
137
166
|
end
|
|
138
167
|
|
|
@@ -164,6 +193,22 @@ module GroupDocs
|
|
|
164
193
|
json[:document_id]
|
|
165
194
|
end
|
|
166
195
|
|
|
196
|
+
#
|
|
197
|
+
# Deletes document with guid from job.
|
|
198
|
+
#
|
|
199
|
+
# @param [String] guid
|
|
200
|
+
# @param [Hash] access Access credentials
|
|
201
|
+
# @option access [String] :client_id
|
|
202
|
+
# @option access [String] :private_key
|
|
203
|
+
#
|
|
204
|
+
def delete_document!(guid, access = {})
|
|
205
|
+
Api::Request.new do |request|
|
|
206
|
+
request[:access] = access
|
|
207
|
+
request[:method] = :DELETE
|
|
208
|
+
request[:path] = "/async/{{client_id}}/jobs/#{id}/documents/#{guid}"
|
|
209
|
+
end.execute!
|
|
210
|
+
end
|
|
211
|
+
|
|
167
212
|
#
|
|
168
213
|
# Adds datasource to job document.
|
|
169
214
|
#
|
|
@@ -176,8 +221,6 @@ module GroupDocs
|
|
|
176
221
|
# @raise [ArgumentError] If document is not a GroupDocs::Document object
|
|
177
222
|
# @raise [ArgumentError] If datasource is not a GroupDocs::DataSource object
|
|
178
223
|
#
|
|
179
|
-
# @todo returns 404 (http://scotland.groupdocs.com/jira/browse/CORE-384)
|
|
180
|
-
#
|
|
181
224
|
def add_datasource!(document, datasource, access = {})
|
|
182
225
|
document.is_a?(GroupDocs::Document) or raise ArgumentError,
|
|
183
226
|
"Document should be GroupDocs::Document object. Received: #{document.inspect}"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module GroupDocs
|
|
2
|
-
class Questionnaire <
|
|
2
|
+
class Questionnaire < Api::Entity
|
|
3
3
|
|
|
4
4
|
require 'groupdocs/questionnaire/execution'
|
|
5
5
|
require 'groupdocs/questionnaire/page'
|
|
@@ -157,7 +157,7 @@ module GroupDocs
|
|
|
157
157
|
request[:method] = :DELETE
|
|
158
158
|
request[:path] = "/merge/{{client_id}}/questionnaires/#{id}"
|
|
159
159
|
end.execute!
|
|
160
|
-
# TODO: fix this in API
|
|
160
|
+
# TODO: fix this in API - http://scotland.groupdocs.com/jira/browse/CORE-391
|
|
161
161
|
rescue RestClient::BadRequest
|
|
162
162
|
nil
|
|
163
163
|
end
|