lib/lipseys/catalog.rb in lipseys-2.0.7 vs lib/lipseys/catalog.rb in lipseys-2.0.8
- old
+ new
@@ -53,13 +53,13 @@
else
hash = map_hash(node)
availability = inventory.select { |i| i[:item_identifier] == hash[:item_identifier] }.first
if availability
- hash[:price] = availability[:price]
- hash[:quantity] = availability[:quantity]
- hash[:map_price] = availability[:map_price]
+ hash[:price] = availability[:price]
+ hash[:quantity] = availability[:quantity]
+ hash[:map_price] = availability[:map_price]
chunker.add(hash)
end
end
end
@@ -105,33 +105,37 @@
items
end
def map_hash(node)
+ model = content_for(node, 'Model')
+ mfg_number = content_for(node, 'MFGModelNo')
+ name = "#{model} #{mfg_number}"
+
{
- name: content_for(node, 'Desc1'),
- model: content_for(node, 'Model'),
+ name: name,
+ model: model,
upc: content_for(node, 'UPC'),
short_description: content_for(node, 'Desc2'),
category: content_for(node, 'Type'),
price: nil,
weight: content_for(node, 'Weight'),
item_identifier: content_for(node, 'ItemNo'),
brand: content_for(node, 'MFG'),
- mfg_number: content_for(node, 'MFGModelNo'),
+ mfg_number: mfg_number,
image_url: "http://www.lipseys.net/images/#{content_for(node, 'Image')}",
features: {
- caliber: content_for(node, 'Caliber'),
- action: content_for(node, 'Action'),
- barrel: content_for(node, 'Barrel'),
+ caliber: content_for(node, 'Caliber'),
+ action: content_for(node, 'Action'),
+ barrel: content_for(node, 'Barrel'),
capacity: content_for(node, 'Capacity'),
- finish: content_for(node, 'Finish'),
- length: content_for(node, 'Length'),
+ finish: content_for(node, 'Finish'),
+ length: content_for(node, 'Length'),
receiver: content_for(node, 'Receiver'),
- safety: content_for(node, 'Safety'),
- sights: content_for(node, 'Sights'),
+ safety: content_for(node, 'Safety'),
+ sights: content_for(node, 'Sights'),
magazine: content_for(node, 'Magazine'),
- chamber: content_for(node, 'Chamber')
+ chamber: content_for(node, 'Chamber')
}
}
end
end