Class: ArrayOfProduct

Inherits:
Object
  • Object
show all
Defined in:
lib/array_of_product.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(product_sets) ⇒ ArrayOfProduct

Returns a new instance of ArrayOfProduct.



5
6
7
# File 'lib/array_of_product.rb', line 5

def initialize(product_sets)
  @product_sets = product_sets
end

Instance Attribute Details

#product_setsObject (readonly)

Returns the value of attribute product_sets.



4
5
6
# File 'lib/array_of_product.rb', line 4

def product_sets
  @product_sets
end

Class Method Details

.parse(xml) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/array_of_product.rb', line 9

def self.parse(xml)
  # debugger
  # doc = Nokogiri::XML(xml) 
  sets = xml.css("ArrayOfProduct > Product").map do |product| 
    ProductSet.from_xml(product) 
  end 
  new(sets)
end