Class: VCloudSdk::Xml::Media

Inherits:
Wrapper
  • Object
show all
Defined in:
lib/cloud/vcloud/xml/wrapper_classes/media.rb

Instance Method Summary collapse

Methods inherited from Wrapper

#==, #[], #[]=, #add_child, #attribute_with_ns, #content, #content=, #create_child, #create_qualified_name, #create_xpath_query, #doc_namespaces, #error, #get_nodes, #href, #href_id, #initialize, #to_s, #type, #urn, #xpath

Constructor Details

This class inherits a constructor from VCloudSdk::Xml::Wrapper

Instance Method Details



43
44
45
# File 'lib/cloud/vcloud/xml/wrapper_classes/media.rb', line 43

def delete_link
  get_nodes("Link", {"rel" => "remove"}, true).first
end

#filesObject



33
34
35
# File 'lib/cloud/vcloud/xml/wrapper_classes/media.rb', line 33

def files
  get_nodes("File")
end

#image_typeObject



21
22
23
# File 'lib/cloud/vcloud/xml/wrapper_classes/media.rb', line 21

def image_type
  @root["imageType"]
end

#image_type=(image_type) ⇒ Object



25
26
27
# File 'lib/cloud/vcloud/xml/wrapper_classes/media.rb', line 25

def image_type=(image_type)
  @root["imageType"] = image_type.to_s
end

#incomplete_filesObject

Files that haven“t finished transferring



38
39
40
41
# File 'lib/cloud/vcloud/xml/wrapper_classes/media.rb', line 38

def incomplete_files
  files.find_all { |f| f["size"].to_i < 0 ||
    (f["size"].to_i > f["bytesTransferred"].to_i) }
end

#nameObject



5
6
7
# File 'lib/cloud/vcloud/xml/wrapper_classes/media.rb', line 5

def name
  @root["name"]
end

#name=(name) ⇒ Object



9
10
11
# File 'lib/cloud/vcloud/xml/wrapper_classes/media.rb', line 9

def name=(name)
  @root["name"] = name.to_s
end

#prerunning_tasksObject



47
48
49
# File 'lib/cloud/vcloud/xml/wrapper_classes/media.rb', line 47

def prerunning_tasks
  tasks.find_all { |t| PRE_RUNNING_TASK_STATUSES.include?(t.status) }
end

#running_tasksObject



51
52
53
# File 'lib/cloud/vcloud/xml/wrapper_classes/media.rb', line 51

def running_tasks
  get_nodes("Task", {"status" => "running"})
end

#sizeObject



13
14
15
# File 'lib/cloud/vcloud/xml/wrapper_classes/media.rb', line 13

def size
  @root["size"]
end

#size=(size) ⇒ Object



17
18
19
# File 'lib/cloud/vcloud/xml/wrapper_classes/media.rb', line 17

def size=(size)
  @root["size"] = size.to_s
end

#storage_profile=(storage_profile) ⇒ Object



29
30
31
# File 'lib/cloud/vcloud/xml/wrapper_classes/media.rb', line 29

def storage_profile=(storage_profile)
  add_child(storage_profile) unless storage_profile.nil?
end

#tasksObject



55
56
57
# File 'lib/cloud/vcloud/xml/wrapper_classes/media.rb', line 55

def tasks
  get_nodes("Task")
end