1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/vcloud_director/models/compute/tasks.rb
Nick Osborn 13ed21eaa5 [vcloud_director] Improve support for Tasks.
- add Organization#tasks
- add Task#cancel
- rename Task#expirity_time to expiry_time
- Task#progress is an integer
- add missing Task#start_time
- expose Task attributes introduced in 5.1 API
2013-09-10 18:07:36 +01:00

31 lines
705 B
Ruby

require 'fog/core/collection'
require 'fog/vcloud_director/models/compute/task'
module Fog
module Compute
class VcloudDirector
class Tasks < Collection
model Fog::Compute::VcloudDirector::Task
attribute :organization
def get(id)
data = service.get_task(id).body
return nil unless data
data[:id] = data[:href].split('/').last
new(data)
end
private
def item_list
data = service.get_tasks_list(organization.id).body
tasks = data[:Task].is_a?(Array) ? data[:Task] : [data[:Task]]
tasks.each {|task| service.add_id_from_href!(task)}
end
end
end
end
end