class Ddr::Structures::Agent

Wraps a Nokogiri (XML) 'agent' node

Constants

NAME_REPOSITORY_DEFAULT
ROLE_CREATOR

Public Class Methods

build(args) click to toggle source
# File lib/ddr/structures/agent.rb, line 35
def self.build(args)
  node = Nokogiri::XML::Node.new('agent', args[:document])
  node['ID'] = args[:id] if args[:id]
  node['ROLE'] = args[:role] if args[:role]
  node['OTHERROLE'] = args[:otherrole] if args[:otherrole]
  node['TYPE'] = args[:type] if args[:type]
  node['OTHERTYPE'] = args[:othertype] if args[:othertype]
  name_node = Nokogiri::XML::Node.new('name', args[:document])
  name_node.content = args[:name]
  node.add_child(name_node)
  node
end

Public Instance Methods

id() click to toggle source
# File lib/ddr/structures/agent.rb, line 11
def id
  self['ID']
end
name() click to toggle source
# File lib/ddr/structures/agent.rb, line 31
def name
  xpath('xmlns:name').first.content
end
otherrole() click to toggle source
# File lib/ddr/structures/agent.rb, line 19
def otherrole
  self['OTHERROLE']
end
othertype() click to toggle source
# File lib/ddr/structures/agent.rb, line 27
def othertype
  self['OTHERTYPE']
end
role() click to toggle source
# File lib/ddr/structures/agent.rb, line 15
def role
  self['ROLE']
end
type() click to toggle source
# File lib/ddr/structures/agent.rb, line 23
def type
  self['TYPE']
end