Class: Firecrawl::Models::ProductProfile::Variant

Inherits:
Object
  • Object
show all
Defined in:
lib/firecrawl/models/product_profile.rb

Overview

A purchasable variant of a product. Pricing, availability, and images live here rather than on the top-level product.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Variant

Returns a new instance of Variant.



55
56
57
58
59
60
61
62
63
64
# File 'lib/firecrawl/models/product_profile.rb', line 55

def initialize(data)
  @id = data["id"]
  @sku = data["sku"]
  @title = data["title"]
  @values = data["values"]
  @price = data["price"] && Price.new(data["price"])
  @sale = data["sale"] && Sale.new(data["sale"])
  @availability = Availability.new(data["availability"])
  @images = (data["images"] || []).map { |img| Image.new(img) }
end

Instance Attribute Details

#availabilityObject (readonly)

Returns the value of attribute availability.



52
53
54
# File 'lib/firecrawl/models/product_profile.rb', line 52

def availability
  @availability
end

#idObject (readonly)

Returns the value of attribute id.



52
53
54
# File 'lib/firecrawl/models/product_profile.rb', line 52

def id
  @id
end

#imagesObject (readonly)

Returns the value of attribute images.



52
53
54
# File 'lib/firecrawl/models/product_profile.rb', line 52

def images
  @images
end

#priceObject (readonly)

Returns the value of attribute price.



52
53
54
# File 'lib/firecrawl/models/product_profile.rb', line 52

def price
  @price
end

#saleObject (readonly)

Returns the value of attribute sale.



52
53
54
# File 'lib/firecrawl/models/product_profile.rb', line 52

def sale
  @sale
end

#skuObject (readonly)

Returns the value of attribute sku.



52
53
54
# File 'lib/firecrawl/models/product_profile.rb', line 52

def sku
  @sku
end

#titleObject (readonly)

Returns the value of attribute title.



52
53
54
# File 'lib/firecrawl/models/product_profile.rb', line 52

def title
  @title
end

#valuesObject (readonly)

Returns the value of attribute values.



52
53
54
# File 'lib/firecrawl/models/product_profile.rb', line 52

def values
  @values
end