Class: Aspose::Cloud::Tasks::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/tasks/document.rb

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ Document

Returns a new instance of Document.



5
6
7
8
9
# 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

Instance Method Details

Add a Task Link to Project

@param string link URL of the link.
@param number index 
@param number predecessor_uid Predecessor UID.
@param number successor_uid  Successor UID.
@param string link_type Type of the link.
@param number lag
@param string lag_format


97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/tasks/document.rb', line 97

def add_link(link, index, predecessor_uid, successor_uid, link_type, lag, lag_format, folder_name = '', storage_type = 'Aspose', storage_name = '')
  raise 'link not specified.' if link.empty?
  raise 'index not specified.' if index.nil?
  raise 'predecessor_uid not specified.' if predecessor_uid.nil?
  raise 'successor_uid not specified.' if successor_uid.nil?
  raise 'link_type not specified.' if link_type.empty?
  raise 'lag not specified.' if lag.nil?
  raise 'lag_format not specified.' if lag_format.empty?

  data = { :Link=> link, :Index=> index, :PredecessorUid=> predecessor_uid, :SuccessorUid=> successor_uid, :LinkType=> link_type, :Lag=> lag, :LagFormat=> lag_format }
  json_data = data.to_json
   
  str_uri = "#{@base_uri}/taskLinks"
  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(Aspose::Cloud::Common::Utils.process_command(signed_str_uri,'POST','JSON',json_data))['Code'] == 200 ? true : false
end

#add_task(task_name, before_task_id, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object

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.


49
50
51
52
53
54
55
56
57
58
59
60
61
# 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 = '') ⇒ Object

Delete a Extended Attribute from a Project

@param number attribute_id The id of the attribute.


188
189
190
191
192
193
194
195
196
# 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 a Task from Project

@param number link_index The index of the Link.


119
120
121
122
123
124
125
126
127
# File 'lib/tasks/document.rb', line 119

def delete_link(link_index, folder_name = '', storage_type = 'Aspose', storage_name = '')
  raise 'link_index not specified.' if link_index.nil?

  str_uri = "#{@base_uri}/taskLinks/#{link_index}"
  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 = '') ⇒ Object

Delete a Outline Code from a Project



151
152
153
154
155
156
157
158
159
# 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 = '') ⇒ Object

Delete a Task from Project

@param number task_id The id of the Task.


67
68
69
70
71
72
73
74
75
# 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 = '') ⇒ Object

Get a Particular Extended Attribute from a Project

@param number attribute_id The id of the attribute.


175
176
177
178
179
180
181
182
# 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 = '') ⇒ Object

Get all Extended Attributes from a Project



164
165
166
167
168
169
# 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

Retrieve Task Links Information from a Project



80
81
82
83
84
85
# File 'lib/tasks/document.rb', line 80

def get_links(folder_name = '', storage_type = 'Aspose', storage_name = '')
  str_uri = "#{@base_uri}/taskLinks"
  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'}))['TaskLinks']
end

#get_outline_code(outline_code_id, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object



139
140
141
142
143
144
145
146
# 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 = '') ⇒ Object

Get all Outline Codes from Project



132
133
134
135
136
137
# 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 = '') ⇒ Object

Retrieve Project Properties



14
15
16
17
18
19
# 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 = '') ⇒ Object

Retrieve Task Information

@param number task_id The id of the Task.


35
36
37
38
39
40
41
42
# 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 = '') ⇒ Object

Retrieve Project Tasks



24
25
26
27
28
29
# 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