Class: Rightstuff::Server
- Inherits:
-
Base
- Object
- Base
- Rightstuff::Server
show all
- Defined in:
- lib/rightstuff/server.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
extract_attributes, load_collection
Constructor Details
#initialize(client, item) ⇒ Server
Returns a new instance of Server.
7
8
9
10
11
|
# File 'lib/rightstuff/server.rb', line 7
def initialize( client, item )
@settings = nil
@inputs = nil
super
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/rightstuff/server.rb', line 17
def method_missing( name , *args, &block )
result = super
return result unless result.nil?
return nil unless @attributes[ :state ] == 'operational'
settings unless @settings
return @attributes[ name ]
end
|
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
5
6
7
|
# File 'lib/rightstuff/server.rb', line 5
def attributes
@attributes
end
|
Class Method Details
.collection_xpath ⇒ Object
13
14
15
|
# File 'lib/rightstuff/server.rb', line 13
def self.collection_xpath
'/servers/server'
end
|
Instance Method Details
#id ⇒ Object
25
26
27
|
# File 'lib/rightstuff/server.rb', line 25
def id
@attributes[ :href ].split( '/' ).last
end
|
29
30
31
32
33
|
# File 'lib/rightstuff/server.rb', line 29
def inputs
return @inputs if @inputs
end
|
#settings ⇒ Object
35
36
37
38
39
40
41
|
# File 'lib/rightstuff/server.rb', line 35
def settings
return @settings if @settings
doc = @client.get_rest( 'servers/' + id + '/settings' )
xml = Nokogiri::XML( doc )
@settings = Base.( xml.children )
@attributes.merge!( @settings )
end
|