Sha256: 1aa497393eb2dece85ddbbda6983ab82f8758d8ea8dc340f3d5f2d03463eb342
Contents?: true
Size: 661 Bytes
Versions: 1
Compression:
Stored size: 661 Bytes
Contents
require 'active_support/core_ext/hash' module Prestashopper # Has methods to convert the XML returned from the API to a ruby hash class Product # Convert a product XML returned by the Prestashop API to a ruby hash, more manageable # @param xml [String] XML returned by the Prestashop API # @return [Hash] the product converted to a hash representation def self.xml2hash(xml) xml_doc = Nokogiri::XML( xml).remove_namespaces! # Strip surrounding tag nodes = xml_doc.xpath '/prestashop/*' product_xml = nodes.to_s product_hash = Hash.from_xml product_xml return product_hash['product'] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
prestashopper-0.2.0 | lib/prestashopper/product.rb |