2010-10-04 17:02:08 -04:00
|
|
|
require 'fog/core/model'
|
2010-04-16 03:20:02 -04:00
|
|
|
|
|
|
|
module Fog
|
2010-05-17 23:57:13 -04:00
|
|
|
module Terremark
|
2010-04-16 03:20:02 -04:00
|
|
|
module Shared
|
|
|
|
|
|
|
|
class Task < Fog::Model
|
|
|
|
|
|
|
|
identity :id
|
|
|
|
|
2010-09-07 14:30:02 -04:00
|
|
|
attribute :end_time, :aliases => 'endTime'
|
|
|
|
attribute :owner, :aliases => 'Owner'
|
|
|
|
attribute :result, :aliases => 'Result'
|
|
|
|
attribute :start_time, :aliases => 'startTime'
|
2010-04-16 03:20:02 -04:00
|
|
|
attribute :status
|
2010-09-07 14:30:02 -04:00
|
|
|
attribute :link, :aliases => 'Link'
|
|
|
|
attribute :error, :aliases => 'Error'
|
2010-04-16 03:20:02 -04:00
|
|
|
|
|
|
|
def initialize(attributes = {})
|
|
|
|
new_owner = attributes.delete('Owner')
|
|
|
|
new_result = attributes.delete('Result')
|
2010-05-16 15:20:19 -04:00
|
|
|
new_error = attributes.delete('Error')
|
|
|
|
new_cancel_link = attributes.delete('Link')
|
|
|
|
|
2010-04-16 03:20:02 -04:00
|
|
|
super
|
|
|
|
@owner = connection.parse(new_owner)
|
2010-04-25 14:42:35 -04:00
|
|
|
if new_result
|
|
|
|
@result = connection.parse(new_result)
|
|
|
|
end
|
2010-05-16 15:20:19 -04:00
|
|
|
@error = connection.parse(new_error) if new_error
|
|
|
|
@cancel_link = connection.parse(new_cancel_link) if new_cancel_link
|
2010-04-16 03:20:02 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def ready?
|
|
|
|
@status == 'success'
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def href=(new_href)
|
|
|
|
@id = new_href.split('/').last.to_i
|
|
|
|
end
|
|
|
|
|
|
|
|
def type=(new_type); end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|