lib/amazon_product_advertising_api/operations/browse_node.rb
# BrowseNode methods return xml consisting of a BrowseNodes tag with several BrowseNode tags inside.
BrowseNode methods return xml consisting of a BrowseNodes tag with several BrowseNode tags inside.
BrowseNode methods return xml consisting of a BrowseNodes tag with several BrowseNode tags inside .
def parse
          self.response.add_element("BrowseNodes", AmazonProductAdvertisingApi::Operations::Base::Element.new)
          (self.hpricot_data/'BrowseNodes > BrowseNode').each do |element|
            new_element = AmazonProductAdvertisingApi::Operations::Base::Element.new
            self.response.browse_nodes << new_element
            queue = []
            queue << [new_element, element.containers]
            queue.each do |pair|
              current_element  = pair[0]
              current_children = pair[1]
              current_children.each do |child|
                if child.containers.size == 0
                  current_element.add_element(child.name, child.inner_html)
                else
                  if parent_a_container?(child)
                     new_element = AmazonProductAdvertisingApi::Operations::Base::Element.new
                    current_element << new_element
                    queue           << [new_element, child.containers]
                  else
                    new_element = current_element.add_element(child.name, AmazonProductAdvertisingApi::Operations::Base::Element.new)
                    queue << [new_element, child.containers]
                  end
                end
              end
            end
          end
        end
def parse self . response . add_element ( "BrowseNodes" , AmazonProductAdvertisingApi :: Operations :: Base :: Element . new ) ( self . hpricot_data / 'BrowseNodes > BrowseNode' ) . each do | element | new_element = AmazonProductAdvertisingApi :: Operations :: Base :: Element . new self . response . browse_nodes << new_element queue = [ ] queue << [ new_element , element . containers ] queue . each do | pair | current_element = pair [ 0 ] current_children = pair [ 1 ] current_children . each do | child | if child . containers . size == 0 current_element . add_element ( child . name , child . inner_html ) else if parent_a_container? ( child ) new_element = AmazonProductAdvertisingApi :: Operations :: Base :: Element . new current_element << new_element queue << [ new_element , child . containers ] else new_element = current_element . add_element ( child . name , AmazonProductAdvertisingApi :: Operations :: Base :: Element . new ) queue << [ new_element , child . containers ] end end end end end end
BrowseNode methods return xml consisting of a BrowseNodes tag with several BrowseNode tags inside.
BrowseNode methods return xml consisting of a BrowseNodes tag with several BrowseNode tags inside .