Class: Shoppr::Product
- Inherits:
-
Object
- Object
- Shoppr::Product
- Defined in:
- lib/shoppr/product.rb
Instance Attribute Summary collapse
-
#feature_rating ⇒ Object
Returns the value of attribute feature_rating.
-
#overall_rating ⇒ Object
Returns the value of attribute overall_rating.
-
#rating ⇒ Object
Returns the value of attribute rating.
-
#rating_image ⇒ Object
Returns the value of attribute rating_image.
-
#review_count ⇒ Object
Returns the value of attribute review_count.
-
#review_url ⇒ Object
Returns the value of attribute review_url.
Instance Method Summary collapse
-
#initialize(cat_mash) ⇒ Product
constructor
A new instance of Product.
Constructor Details
#initialize(cat_mash) ⇒ Product
Returns a new instance of Product.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/shoppr/product.rb', line 5 def initialize(cat_mash) Shoppr.map_mash_attrs(self, cat_mash) @offers = self.offers && self.offers.offer ? self.offers.offer.map {|offer| Offer.new(offer) } : [] @overall_rating = self.reviews.averageRating.overallRating rescue nil @reviews = self.reviews.consumerReview ? [self.reviews.consumerReview].flatten.map {|rev| ConsumerReview.new(rev)} : [] rescue [] @review_count = self..reviewCount @review_url = self..reviewURL @rating_image = Image.new(self..) rescue nil @rating = self.. @images = self.images.image.map {|image| Image.new(image) } rescue [] @specifications = self.specifications.featureGroup.map {|spec| FeatureGroup.new(spec)} rescue [] end |
Instance Attribute Details
#feature_rating ⇒ Object
Returns the value of attribute feature_rating.
3 4 5 |
# File 'lib/shoppr/product.rb', line 3 def @feature_rating end |
#overall_rating ⇒ Object
Returns the value of attribute overall_rating.
3 4 5 |
# File 'lib/shoppr/product.rb', line 3 def @overall_rating end |
#rating ⇒ Object
Returns the value of attribute rating.
3 4 5 |
# File 'lib/shoppr/product.rb', line 3 def @rating end |
#rating_image ⇒ Object
Returns the value of attribute rating_image.
3 4 5 |
# File 'lib/shoppr/product.rb', line 3 def @rating_image end |
#review_count ⇒ Object
Returns the value of attribute review_count.
3 4 5 |
# File 'lib/shoppr/product.rb', line 3 def review_count @review_count end |
#review_url ⇒ Object
Returns the value of attribute review_url.
3 4 5 |
# File 'lib/shoppr/product.rb', line 3 def review_url @review_url end |