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

37 lines
765 B
Ruby
Raw Normal View History

2013-06-20 13:36:34 -04:00
require 'fog/core/collection'
2013-08-27 05:19:54 -04:00
require 'fog/vcloud_director/models/compute/task'
2013-06-20 13:36:34 -04:00
module Fog
module Compute
2013-08-27 05:19:54 -04:00
class VcloudDirector
class Tasks < Collection
include Fog::VcloudDirector::Query
2013-08-27 05:19:54 -04:00
model Fog::Compute::VcloudDirector::Task
2013-06-20 13:36:34 -04:00
attribute :organization
def query_type
"task"
end
2013-07-04 07:24:25 -04:00
def get(id)
data = service.get_task(id).body
return nil unless data
data[:id] = data[:href].split('/').last
data[:progress] ||= 0
2013-07-04 07:24:25 -04:00
new(data)
end
private
def item_list
data = service.get_task_list(organization.id).body
data[:Task].each {|task| service.add_id_from_href!(task)}
end
2013-06-20 13:36:34 -04:00
end
end
end
end