Class: Appdynamics::Tier

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

Constant Summary collapse

ATTRIBUTES =
[:id, :agentType, :description, :name, :numberOfNodes, :type]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller, application, attrs) ⇒ Tier

Returns a new instance of Tier.



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

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

Instance Attribute Details

#applicationObject

Returns the value of attribute application.



6
7
8
# File 'lib/appdynamics/tier.rb', line 6

def application
  @application
end

#controllerObject

Returns the value of attribute controller.



6
7
8
# File 'lib/appdynamics/tier.rb', line 6

def controller
  @controller
end

Class Method Details

.from_hash(hsh, controller, application) ⇒ Object



23
24
25
# File 'lib/appdynamics/tier.rb', line 23

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

Instance Method Details

#relative_route(*_) ⇒ Object



27
28
29
# File 'lib/appdynamics/tier.rb', line 27

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

#to_hashObject



16
17
18
19
20
21
# File 'lib/appdynamics/tier.rb', line 16

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