class Aspose::Cloud::Tasks::Document

Public Class Methods

new(filename) click to toggle source
# File lib/tasks/document.rb, line 5
def initialize(filename)
  @filename = filename
  raise 'filename not specified.' if filename.empty?
  @base_uri =  Aspose::Cloud::Common::Product.product_uri + '/tasks/' + @filename
end

Public Instance Methods

add_task(task_name, before_task_id, folder_name = '', storage_type = 'Aspose', storage_name = '') click to toggle source

Add a Task to Project @param string task_name The name of the Task. @param number before_task_id The id of the task to insert the new task before.

# File lib/tasks/document.rb, line 49
def add_task(task_name, before_task_id,  folder_name = '', storage_type = 'Aspose', storage_name = '')
  raise 'task_name not specified.' if task_name.nil?
  raise 'before_task_id not specified.' if before_task_id.nil?

  str_uri = "#{@base_uri}/tasks"
  qry = { :taskName => task_name, :beforeTaskId => before_task_id }
  str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)

  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)

  JSON.parse(RestClient.post(signed_str_uri, '', {:accept=>'application/json'}))['TaskItem']
end
delete_extended_attribute(attribute_id, folder_name = '', storage_type = 'Aspose', storage_name = '') click to toggle source

Delete a Extended Attribute from a Project @param number attribute_id The id of the attribute.

# File lib/tasks/document.rb, line 188
def delete_extended_attribute(attribute_id, folder_name = '', storage_type = 'Aspose', storage_name = '')
  raise 'attribute_id not specified.' if attribute_id.nil?

  str_uri = "#{@base_uri}/extendedAttributes/#{attribute_id}"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  json = JSON.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'}))
  json['Code'] == 200 ? true : false
end
delete_outline_code(outline_code_id, folder_name = '', storage_type = 'Aspose', storage_name = '') click to toggle source

Delete a Outline Code from a Project

# File lib/tasks/document.rb, line 151
def delete_outline_code(outline_code_id, folder_name = '', storage_type = 'Aspose', storage_name = '')
  raise 'outline_code_id not specified.' if outline_code_id.nil?

  str_uri = "#{@base_uri}/outlineCodes/#{outline_code_id}"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  json = JSON.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'}))
  json['Code'] == 200 ? true : false
end
delete_task(task_id, folder_name = '', storage_type = 'Aspose', storage_name = '') click to toggle source

Delete a Task from Project @param number task_id The id of the Task.

# File lib/tasks/document.rb, line 67
def delete_task(task_id, folder_name = '', storage_type = 'Aspose', storage_name = '')
  raise 'task_id not specified.' if task_id.nil?

  str_uri = "#{@base_uri}/tasks/#{task_id}"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  json = JSON.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'}))
  json['Code'] == 200 ? true : false
end
get_extended_attribute(attribute_id, folder_name = '', storage_type = 'Aspose', storage_name = '') click to toggle source

Get a Particular Extended Attribute from a Project @param number attribute_id The id of the attribute.

# File lib/tasks/document.rb, line 175
def get_extended_attribute(attribute_id, folder_name = '', storage_type = 'Aspose', storage_name = '')
  raise 'attribute_id not specified.' if attribute_id.nil?

  str_uri = "#{@base_uri}/extendedAttributes/#{attribute_id}"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['ExtendedAttribute']
end
get_extended_attributes(folder_name = '', storage_type = 'Aspose', storage_name = '') click to toggle source

Get all Extended Attributes from a Project

# File lib/tasks/document.rb, line 164
def get_extended_attributes(folder_name = '', storage_type = 'Aspose', storage_name = '')
  str_uri = "#{@base_uri}/extendedAttributes"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['ExtendedAttributes']
end
get_outline_code(outline_code_id, folder_name = '', storage_type = 'Aspose', storage_name = '') click to toggle source
# File lib/tasks/document.rb, line 139
def get_outline_code(outline_code_id, folder_name = '', storage_type = 'Aspose', storage_name = '')
  raise 'outline_code_id not specified.' if outline_code_id.nil?

  str_uri = "#{@base_uri}/outlineCodes/#{outline_code_id}"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['OutlineCode']
end
get_outline_codes(folder_name = '', storage_type = 'Aspose', storage_name = '') click to toggle source

Get all Outline Codes from Project

# File lib/tasks/document.rb, line 132
def get_outline_codes(folder_name = '', storage_type = 'Aspose', storage_name = '')
  str_uri = "#{@base_uri}/outlineCodes"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['OutlineCodes']
end
get_properties(folder_name = '', storage_type = 'Aspose', storage_name = '') click to toggle source

Retrieve Project Properties

# File lib/tasks/document.rb, line 14
def get_properties(folder_name = '', storage_type = 'Aspose', storage_name = '')
  str_uri = "#{@base_uri}/documentProperties"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Properties']['List']
end
get_task(task_id, folder_name = '', storage_type = 'Aspose', storage_name = '') click to toggle source

Retrieve Task Information @param number task_id The id of the Task.

# File lib/tasks/document.rb, line 35
def get_task(task_id, folder_name = '', storage_type = 'Aspose', storage_name = '')
  raise 'task_id not specified.' if task_id.nil?

  str_uri = "#{@base_uri}/tasks/#{task_id}"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Task']
end
get_tasks(folder_name = '', storage_type = 'Aspose', storage_name = '') click to toggle source

Retrieve Project Tasks

# File lib/tasks/document.rb, line 24
def get_tasks(folder_name = '', storage_type = 'Aspose', storage_name = '')
  str_uri = "#{@base_uri}/tasks"
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Tasks']['TaskItem']
end