Class: TcServer::Revision

Inherits:
Shared::StateResource show all
Defined in:
lib/vas/tc_server/revisions.rb

Overview

A revision of an application

Instance Attribute Summary collapse

Attributes inherited from Shared::Resource

#location, #security

Instance Method Summary collapse

Methods inherited from Shared::StateResource

#start, #state, #stop

Constructor Details

#initialize(location, client) ⇒ Revision

Returns a new instance of Revision.



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

def initialize(location, client)
  super(location, client)
  
  @version = details['version']
  @application = Application.new(Util::LinkUtils.get_link_href(details, 'group-application'), client)
  
  revision_image_location = Util::LinkUtils.get_link_href(details, 'revision-image')
  @revision_image = RevisionImage.new(revision_image_location, client) unless revision_image_location.nil?
end

Instance Attribute Details

#applicationApplication (readonly)

Returns the revision’s application.

Returns:



45
46
47
# File 'lib/vas/tc_server/revisions.rb', line 45

def application
  @application
end

#revision_imageRevisionImage (readonly)

Returns the revision image, if any, that was used to create the revision.

Returns:

  • (RevisionImage)

    the revision image, if any, that was used to create the revision



48
49
50
# File 'lib/vas/tc_server/revisions.rb', line 48

def revision_image
  @revision_image
end

#versionString (readonly)

Returns the revision’s version.

Returns:

  • (String)

    the revision’s version



42
43
44
# File 'lib/vas/tc_server/revisions.rb', line 42

def version
  @version
end

Instance Method Details

#node_revisionsNodeRevision[]

Returns the revision’s node revisions.

Returns:



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

def node_revisions
  node_revisions = []
  Util::LinkUtils.get_link_hrefs(client.get(location), 'node-revision').each {
      |node_revision_location| node_revisions << NodeRevision.new(node_revision_location, client)}
  node_revisions
end

#to_sString

Returns a string representation of the revision.

Returns:

  • (String)

    a string representation of the revision



70
71
72
# File 'lib/vas/tc_server/revisions.rb', line 70

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