Class: Zinc::Product
Instance Attribute Summary collapse
- #all_variants ⇒ Object
- #asin ⇒ Object
- #authors ⇒ Object
- #brand ⇒ Object
- #categories ⇒ Object
- #epids ⇒ Object
- #epids_map ⇒ Object
- #feature_bullets ⇒ Object
- #images ⇒ Object
- #item_location ⇒ Object
- #item_number ⇒ Object
- #main_image ⇒ Object
- #original_retail_price ⇒ Object
- #package_dimensions ⇒ Object
- #price ⇒ Object
- #product_description ⇒ Object
- #product_details ⇒ Object
- #product_id ⇒ Object
- #quantity ⇒ Object
- #question_count ⇒ Object
- #retailer ⇒ Object
- #review_count ⇒ Object
- #seller_selection_criteria ⇒ Object
- #stars ⇒ Object
- #status ⇒ Object
- #timestamp ⇒ Object
- #title ⇒ Object
- #variant_specifics ⇒ Object
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash) ⇒ Product
constructor
A new instance of Product.
Methods inherited from Model
Constructor Details
#initialize(hash) ⇒ Product
Returns a new instance of Product.
34 35 36 37 |
# File 'lib/zinc/product.rb', line 34 def initialize(hash) super(hash, exclude: %w(seller_selection_criteria)) @seller_selection_criteria = SellerSelectionCriteria.new(hash['seller_selection_criteria']) if hash['seller_selection_criteria'] end |
Instance Attribute Details
#all_variants ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def all_variants @all_variants end |
#asin ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def asin @asin end |
#authors ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def @authors end |
#brand ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def brand @brand end |
#categories ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def categories @categories end |
#epids ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def epids @epids end |
#epids_map ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def epids_map @epids_map end |
#feature_bullets ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def feature_bullets @feature_bullets end |
#images ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def images @images end |
#item_location ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def item_location @item_location end |
#item_number ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def item_number @item_number end |
#main_image ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def main_image @main_image end |
#original_retail_price ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def original_retail_price @original_retail_price end |
#package_dimensions ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def package_dimensions @package_dimensions end |
#price ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def price @price end |
#product_description ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def product_description @product_description end |
#product_details ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def product_details @product_details end |
#product_id ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def product_id @product_id end |
#quantity ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def quantity @quantity end |
#question_count ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def question_count @question_count end |
#retailer ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def retailer @retailer end |
#review_count ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def review_count @review_count end |
#seller_selection_criteria ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def seller_selection_criteria @seller_selection_criteria end |
#stars ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def stars @stars end |
#status ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def status @status end |
#timestamp ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def @timestamp end |
#title ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def title @title end |
#variant_specifics ⇒ Object
5 6 7 |
# File 'lib/zinc/product.rb', line 5 def variant_specifics @variant_specifics end |
Class Method Details
.find(id, retailer:, async: false, max_age: nil, newer_than: nil) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/zinc/product.rb', line 40 def find(id, retailer:, async: false, max_age: nil, newer_than: nil) unless Zinc::RETAILERS.include?(retailer) raise StandardError, "#{retailer} is not supported - the supported retailers are #{Zinc::RETAILERS.to_sentence}" end params = {} params['retailer'] = retailer params['async'] = true if async params['max_age'] = max_age if max_age params['newer_than'] = newer_than if newer_than get(path: "products/#{id}?#{URI.encode_www_form(params)}") end |