Class: Appdynamics::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/appdynamics/node.rb

Constant Summary collapse

ATTRIBUTES =
[:id, :name, :type, :tierId, :tierName, :machineId, :machineName, :machineOSType, :ipAddresses,
:machineAgentPresent, :machineAgentVersion, :appAgentPresent, :appAgentVersion, :nodeUniqueLocalId]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller, application, attrs) ⇒ Node

Returns a new instance of Node.



9
10
11
12
13
14
15
# File 'lib/appdynamics/node.rb', line 9

def initialize controller, application, attrs
    @controller = controller
    @application = application
    attrs.keys.each do |key|
        self.send "#{key}=", attrs[key]
    end
end

Class Method Details

.from_hash(hsh, controller, application) ⇒ Object



24
25
26
# File 'lib/appdynamics/node.rb', line 24

def self.from_hash hsh, controller, application
    Node.new controller, application, hsh
end

Instance Method Details

#relative_route(*_) ⇒ Object



28
29
30
# File 'lib/appdynamics/node.rb', line 28

def relative_route *_
    "#{application.relative_route}/nodes/#{id}"
end

#to_hashObject



17
18
19
20
21
22
# File 'lib/appdynamics/node.rb', line 17

def to_hash
    ATTRIBUTES.inject({}){|hsh, attr|
        hsh[attr] = self.send(attr)
        hsh
    }
end