Class: Libis::Services::Rosetta::ProducerAgent
- Inherits:
-
Object
- Object
- Libis::Services::Rosetta::ProducerAgent
- Defined in:
- lib/libis/services/rosetta/producer_agent.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_xml(xml) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/libis/services/rosetta/producer_agent.rb', line 42 def self.from_xml(xml) xml_doc = Libis::Tools::XmlDocument.parse(xml) hash = xml_doc.to_hash( strip_namespaces: true, delete_namespace_attributes: true, empty_tag_value: nil, convert_tags_to: lambda(&:to_sym) ) # noinspection RubyArgCount self.new(hash[:producer_info]) end |
Instance Method Details
#to_hash ⇒ Object
26 27 28 |
# File 'lib/libis/services/rosetta/producer_agent.rb', line 26 def to_hash attributes.cleanup end |
#to_xml ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/libis/services/rosetta/producer_agent.rb', line 30 def to_xml Libis::Tools::XmlDocument.build do |xml| # noinspection RubyResolve xml.user_info { xml.parent.default_namespace = 'http://www.exlibrisgroup.com/xsd/dps/backoffice/service' self.attributes.each do |name, value| xml.send(name, xmlns: '').text(value) if value end } end.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::DEFAULT_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION) end |