mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
13ed21eaa5
- 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
31 lines
705 B
Ruby
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
|