Sha256: 8af16caa8d8c4a1b40115da585efa2fe8d8f27049e5e800f68ad80c98855e908

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

module Shoppr
  class Product
    include ROXML
    xml_convention {|val| val.camelize(:lower) }
    xml_reader :id, :from => '@id', :as => Integer
    xml_reader :name
    xml_reader :short_description
    xml_reader :full_description
    xml_reader :images, :as => [Image], :in => 'images'
    
    xml_reader :review_count, :as => Integer, :from => 'rating/reviewCount'
    xml_reader :rating, :as => Float, :from => 'rating/rating'
    xml_reader :rating_image, :as => Image, :from => 'rating/ratingImage'
    xml_reader :review_url, :from => 'reviewURL', :from => 'rating/reviewURL'
    
    xml_reader :reviews, :as => [ConsumerReview], :from => 'reviews/consumerReview'
    xml_reader :overall_rating, :as => Float, :from => 'reviews/averageRating/overallRating'
    xml_reader :feature_ratings, :as => [FeatureRating], :from => 'reviews/averageRating/featureRating'
    xml_reader :write_review_url, :from => 'reviews/writeReviewURL'
    
    xml_reader :min_price, :as => Float
    xml_reader :max_price, :as => Float
    xml_reader :product_offers_url, :from => 'productOffersURL'
    xml_reader :product_specs_url, :from => 'productSpecsURL'
    xml_reader :offers, :as => [Offer], :in => 'offers'
    xml_reader :specifications, :as => [FeatureGroup], :from => 'specifications/featureGroup'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shoppr-0.1.1 lib/shoppr/product.rb
shoppr-0.1.0 lib/shoppr/product.rb