lib/groupdocs/questionnaire.rb in groupdocs-1.5.5 vs lib/groupdocs/questionnaire.rb in groupdocs-1.5.6
- old
+ new
@@ -13,10 +13,12 @@
#
# @param [Hash] options Hash of options
# @option options [Symbol] :status Filter questionnaires by status
# @option options [Integer] :page_number Page to start with
# @option options [Integer] :page_size How many items to list
+ # @option options [String] :orderBy Order by column (optional)
+ # @option options [Bool] :isAscending Order by ascending or descending (optional)
# @param [Hash] access Access credentials
# @option access [String] :client_id
# @option access [String] :private_key
# @return [Array<GroupDocs::Questionnaire>]
#
@@ -126,52 +128,12 @@
@pages ||= Array.new
@pages << page
end
- #
- # Add job document datasource.
- #
- # @param [GroupDocs::DataSource] datasource
- # @param [String] jobId Job identifier
- # @param [String] fileId File identifier
- # @param [String] datasourceId
- # @param [Hash] access Access credentials
- # @option access [String] :client_id
- # @option access [String] :private_key
- #
- def self.add_datasource!(jobId, datasource, access = {})
- json = Api::Request.new do |request|
- request[:access] = access
- request[:method] = :PUT
- request[:path] = "/merge/{{client_id}}/jobs/#{jobId}/files/#{file.guid}/datasources/#{datasource.id}"
- end.execute!
- json[:datasource_id]
- end
-
#
- # Add job document datasource fields.
- #
- # @param [String] jobId Job identifier
- # @param [String] fileId File identifier
- # @param [Array] datasourceFields
- # @param [Hash] access Access credentials
- # @option access [String] :client_id
- # @option access [String] :private_key
- #
- def self.add_datasource_fields!(jobId, fileId, datasourceFields, access = {})
- Api::Request.new do |request|
- request[:access] = access
- request[:method] = :PUT
- request[:path] = "/merge/{{client_id}}/jobs/#{jobId}/files/#{fileId}/datasources/"
- request[:request_body] = datasourceFields
- end.execute!
-
- end
-
- #
# Creates questionnaire.
#
# @param [Hash] access Access credentials
# @option access [String] :client_id
# @option access [String] :private_key
@@ -261,24 +223,30 @@
json[:executions].map do |execution|
Execution.new(execution)
end
end
- #
+ #
# Returns an array of questionnaire collectors.
#
+ #
+ # @param [Hash] options Options
+ # @option options [String] :orderBy Order by column (required)
+ # @option options [Boolean] :isAsc Order by ascending or descending (required)
# @param [Hash] access Access credentials
# @option access [String] :client_id
# @option access [String] :private_key
# @return [Array<GroupDocs::Questionnaire::Collector>]
#
- def collectors!(access = {})
- json = Api::Request.new do |request|
+ def collectors!(options = {}, access = {})
+ api = Api::Request.new do |request|
request[:access] = access
request[:method] = :GET
request[:path] = "/merge/{{client_id}}/questionnaires/#{guid}/collectors"
- end.execute!
+ end
+ api = add_params(options)
+ json = api.execute!
json[:collectors].map do |collector|
collector.merge!(:questionnaire => self)
Collector.new(collector)
end
@@ -346,9 +314,37 @@
json = api.execute!
json[:fields].map do |field|
Document::Field.new(field)
end
+ end
+
+ #
+ # Copy file to given path.
+ #
+ # @param [String] path (required)
+ # @param [String] mode Mode (optional)
+ # @param [Hash] options
+ # @option options [String] name
+ # @param [Hash] access Access credentials
+ # @option access [String] :client_id
+ # @option access [String] :private_key
+ # @return [Array] Templates
+ #
+ def copy_to_templates!(path, mode, options = {}, access = {})
+ options[:name] ||= name
+ path = prepare_path("#{path}/#{options[:name]}")
+
+ api = Api::Request.new do |request|
+ request[:access] = access
+ request[:method] = :PUT
+ request[:headers] = { :'Groupdocs-Copy' => id }
+ request[:path] = "/merge/{{client_id}}/files/#{path}"
+ end
+ api = add_params(:mode => mode)
+ json = api.execute!
+
+ json[:templates]
end
end # Questionnaire
end # GroupDocs