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.



22
23
24
25
26
# File 'lib/tasks/document.rb', line 22

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_task(task_name, before_task_id, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/tasks/document.rb', line 51

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



131
132
133
134
135
136
137
138
# File 'lib/tasks/document.rb', line 131

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.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'}))
end


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

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.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'}))
end

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



106
107
108
109
110
111
112
113
# File 'lib/tasks/document.rb', line 106

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.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'}))
end

#delete_task(task_id, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object



65
66
67
68
69
70
71
72
# File 'lib/tasks/document.rb', line 65

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.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'}))
end

#get_extended_attribute(attribute_id, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object



122
123
124
125
126
127
128
129
# File 'lib/tasks/document.rb', line 122

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



115
116
117
118
119
120
# File 'lib/tasks/document.rb', line 115

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


74
75
76
77
78
79
# File 'lib/tasks/document.rb', line 74

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



97
98
99
100
101
102
103
104
# File 'lib/tasks/document.rb', line 97

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



90
91
92
93
94
95
# File 'lib/tasks/document.rb', line 90

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



28
29
30
31
32
33
# File 'lib/tasks/document.rb', line 28

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



42
43
44
45
46
47
48
49
# File 'lib/tasks/document.rb', line 42

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



35
36
37
38
39
40
# File 'lib/tasks/document.rb', line 35

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