class UPnPAction

Attributes

arguments[RW]
name[RW]

Public Class Methods

new() click to toggle source
# File lib/upnp_model.rb, line 280
def initialize
  @arguments = []
end
read_xml_node(node) click to toggle source
# File lib/upnp_model.rb, line 323
def UPnPAction.read_xml_node(node)
  action = UPnPAction.new
  node.elements.each do |elem|
    if elem.name == 'name'
      action.name = elem.text
    elsif elem.name == 'argumentList'
      elem.elements.each { |argument_node|
        if argument_node.name == 'argument'
          action.arguments << UPnPActionArgument.read_xml_node(argument_node)
        end
      }
    end
  end
  return action
end

Public Instance Methods

get_argument(name) click to toggle source
# File lib/upnp_model.rb, line 287
def get_argument(name)
  @arguments.each { |argument|
    if argument.name == name
      return argument
    end
  }
  nil
end
in_arguments() click to toggle source
# File lib/upnp_model.rb, line 296
def in_arguments
  @arguments.select { |argument| argument.direction == 'in' }
end
out_arguments() click to toggle source
# File lib/upnp_model.rb, line 300
def out_arguments
  @arguments.select { |argument| argument.direction == 'out' }
end
to_s() click to toggle source
# File lib/upnp_model.rb, line 304
def to_s
  "UPnPAction -- #{@name}"
end
to_xml() click to toggle source
# File lib/upnp_model.rb, line 308
def to_xml
  action = XmlTag.new 'action'
  
  prop = action.append XmlTag.new 'name'
  prop.append XmlText.new @name

  argument_list = action.append XmlTag.new 'argumentList'
  @arguments.each { |argument|
    argument_list.append argument.to_xml
  }

  return action.to_s
end