Class: TcServer::TemplateImage

Inherits:
Shared::Resource show all
Defined in:
lib/vas/tc_server/template_images.rb

Overview

A template image

Instance Attribute Summary collapse

Attributes inherited from Shared::Resource

#location, #security

Instance Method Summary collapse

Constructor Details

#initialize(location, client) ⇒ TemplateImage

Returns a new instance of TemplateImage.



53
54
55
56
57
58
59
# File 'lib/vas/tc_server/template_images.rb', line 53

def initialize(location, client)
  super(location, client)

  @name = details["name"]
  @version = details["version"]
  @size = details['size']
end

Instance Attribute Details

#nameString (readonly)

Returns the template image’s name.

Returns:

  • (String)

    the template image’s name



44
45
46
# File 'lib/vas/tc_server/template_images.rb', line 44

def name
  @name
end

#sizeString (readonly)

Returns the template image’s size.

Returns:

  • (String)

    the template image’s size



50
51
52
# File 'lib/vas/tc_server/template_images.rb', line 50

def size
  @size
end

#versionString (readonly)

Returns the template image’s version.

Returns:

  • (String)

    the template image’s version



47
48
49
# File 'lib/vas/tc_server/template_images.rb', line 47

def version
  @version
end

Instance Method Details

#templatesTemplate[]

Returns the templates that have been created from the template image.

Returns:

  • (Template[])

    the templates that have been created from the template image



62
63
64
65
66
# File 'lib/vas/tc_server/template_images.rb', line 62

def templates
  templates = []
  Util::LinkUtils.get_link_hrefs(client.get(location), "template").each { |template_location| templates << Template.new(template_location, client)}
  templates
end

#to_sString

Returns a string representation of the template image.

Returns:

  • (String)

    a string representation of the template image



69
70
71
# File 'lib/vas/tc_server/template_images.rb', line 69

def to_s
  "#<#{self.class} name='#@name' version='#@version' size='#@size'>"
end