lib/amazon_product_advertising_api/operations/item.rb
# Item methods return xml consisting of an Items tag with several Item tags inside.
Item methods return xml consisting of an Items tag with several Item tags inside.
Item methods return xml consisting of an Items tag with several Item tags inside .
def parse
          self.response.add_element("Items", AmazonProductAdvertisingApi::Operations::Base::Element.new)
          (self.hpricot_data/'Items > Item').each do |element|
            new_element = AmazonProductAdvertisingApi::Operations::Base::Element.new
            self.response.items << 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 ( "Items" , AmazonProductAdvertisingApi :: Operations :: Base :: Element . new ) ( self . hpricot_data / 'Items > Item' ) . each do | element | new_element = AmazonProductAdvertisingApi :: Operations :: Base :: Element . new self . response . items << 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
Item methods return xml consisting of an Items tag with several Item tags inside.
Item methods return xml consisting of an Items tag with several Item tags inside .