Class: Rightstuff::Server

Inherits:
Base
  • Object
show all
Defined in:
lib/rightstuff/server.rb

Overview

Instance Attribute Summary

Attributes inherited from Base

#attributes

Instance Method Summary (collapse)

Methods inherited from Base

collection_xpath, extract_attributes, #id, load_collection, #method_missing, type

Constructor Details

- (Server) initialize(client, item)



5
6
7
8
9
# File 'lib/rightstuff/server.rb', line 5

def initialize( client, item )
  @settings = nil
  @inputs   = nil
  super
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Rightstuff::Base

Instance Method Details

- (Boolean) active?



11
12
13
# File 'lib/rightstuff/server.rb', line 11

def active?
  @attributes[ :state ] == 'operational'
end

- (Object) inputs



15
16
17
18
19
# File 'lib/rightstuff/server.rb', line 15

def inputs
  return @inputs if @inputs
  # Add inputs to instance data
  # @client.get( @attributes[ 'href' ] )
end

- (Object) settings



21
22
23
24
25
26
27
# File 'lib/rightstuff/server.rb', line 21

def settings
  return @settings if @settings
  doc       = @client.get_rest( "#{ type.pluralize }/#{ id }/settings" )
  xml       = Nokogiri::XML( doc )
  @settings = Base.extract_attributes( xml.children )
  @attributes.merge!( @settings )
end