Class: ProductSet
- Inherits:
-
Object
- Object
- ProductSet
- Defined in:
- lib/product_set.rb
Instance Attribute Summary collapse
-
#aisle_number ⇒ Object
readonly
Returns the value of attribute aisle_number.
-
#item_category ⇒ Object
readonly
Returns the value of attribute item_category.
-
#item_description ⇒ Object
readonly
Returns the value of attribute item_description.
-
#item_id ⇒ Object
readonly
Returns the value of attribute item_id.
-
#item_image ⇒ Object
readonly
Returns the value of attribute item_image.
-
#item_name ⇒ Object
readonly
Returns the value of attribute item_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ ProductSet
constructor
A new instance of ProductSet.
Constructor Details
#initialize(attributes) ⇒ ProductSet
Returns a new instance of ProductSet.
3 4 5 6 7 8 9 10 |
# File 'lib/product_set.rb', line 3 def initialize(attributes) @item_name = attributes[:item_name] @item_description = attributes[:item_description] @item_category = attributes[:item_category] @item_id = attributes[:item_id] @item_image = attributes[:item_image] @aisle_number = attributes[:aisle_number] end |
Instance Attribute Details
#aisle_number ⇒ Object (readonly)
Returns the value of attribute aisle_number.
2 3 4 |
# File 'lib/product_set.rb', line 2 def aisle_number @aisle_number end |
#item_category ⇒ Object (readonly)
Returns the value of attribute item_category.
2 3 4 |
# File 'lib/product_set.rb', line 2 def item_category @item_category end |
#item_description ⇒ Object (readonly)
Returns the value of attribute item_description.
2 3 4 |
# File 'lib/product_set.rb', line 2 def item_description @item_description end |
#item_id ⇒ Object (readonly)
Returns the value of attribute item_id.
2 3 4 |
# File 'lib/product_set.rb', line 2 def item_id @item_id end |
#item_image ⇒ Object (readonly)
Returns the value of attribute item_image.
2 3 4 |
# File 'lib/product_set.rb', line 2 def item_image @item_image end |
#item_name ⇒ Object (readonly)
Returns the value of attribute item_name.
2 3 4 |
# File 'lib/product_set.rb', line 2 def item_name @item_name end |
Class Method Details
.from_xml(xml) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/product_set.rb', line 12 def self.from_xml(xml) new( :item_name => xml.css("Itemname").text, :item_description => xml.css("ItemDescription").text, :item_category => xml.css("ItemCategory").text, :item_id => xml.css("ItemID").text, :item_image => xml.css("ItemImage").text, :aisle_number => xml.css("AisleNumber").text) end |