Class: Sonos::TopologyNode

Inherits:
Object
  • Object
show all
Defined in:
lib/sonos/topology_node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ TopologyNode

Returns a new instance of TopologyNode.



5
6
7
8
9
10
11
# File 'lib/sonos/topology_node.rb', line 5

def initialize(node)
  node.attributes.each do |k, v|
    self.send("#{k}=", v.inner_text) if self.respond_to?(k.to_sym)
  end

  self.name = node.inner_text
end

Instance Attribute Details

#coordinatorObject

Returns the value of attribute coordinator.



3
4
5
# File 'lib/sonos/topology_node.rb', line 3

def coordinator
  @coordinator
end

#groupObject

Returns the value of attribute group.



3
4
5
# File 'lib/sonos/topology_node.rb', line 3

def group
  @group
end

#locationObject

Returns the value of attribute location.



3
4
5
# File 'lib/sonos/topology_node.rb', line 3

def location
  @location
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/sonos/topology_node.rb', line 3

def name
  @name
end

#uuidObject

Returns the value of attribute uuid.



3
4
5
# File 'lib/sonos/topology_node.rb', line 3

def uuid
  @uuid
end

#versionObject

Returns the value of attribute version.



3
4
5
# File 'lib/sonos/topology_node.rb', line 3

def version
  @version
end

Instance Method Details

#deviceObject



17
18
19
# File 'lib/sonos/topology_node.rb', line 17

def device
  @device ||= Device::Base.detect(ip)
end

#ipObject



13
14
15
# File 'lib/sonos/topology_node.rb', line 13

def ip
  @ip ||= URI.parse(location).host
end