Class: Fog::Terremark::Shared::Task

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/terremark/models/shared/task.rb

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

#initialize(attributes = {}) ⇒ Task

Returns a new instance of Task.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fog/terremark/models/shared/task.rb', line 19

def initialize(attributes = {})
  new_owner  = attributes.delete('Owner')
  new_result = attributes.delete('Result')
  new_error = attributes.delete('Error')
  new_cancel_link = attributes.delete('Link')

  super
  self.owner = service.parse(new_owner)
  if new_result
    self.result = service.parse(new_result)
  end
  self.error = service.parse(new_error) if new_error
  @cancel_link = service.parse(new_cancel_link) if new_cancel_link
end

Instance Method Details

#ready?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/fog/terremark/models/shared/task.rb', line 34

def ready?
  @status == 'success'
end