Class: Firecrawl::Models::ProductProfile

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

Overview

Structured product information extracted from a product page via the ‘product` scrape format.

Defined Under Namespace

Classes: Availability, Image, Price, Sale, Variant

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ ProductProfile

Returns a new instance of ProductProfile.



69
70
71
72
73
74
75
76
# File 'lib/firecrawl/models/product_profile.rb', line 69

def initialize(data)
  @title = data["title"]
  @brand = data["brand"]
  @category = data["category"]
  @url = data["url"]
  @description = data["description"]
  @variants = (data["variants"] || []).map { |variant| Variant.new(variant) }
end

Instance Attribute Details

#brandObject (readonly)

Returns the value of attribute brand.



67
68
69
# File 'lib/firecrawl/models/product_profile.rb', line 67

def brand
  @brand
end

#categoryObject (readonly)

Returns the value of attribute category.



67
68
69
# File 'lib/firecrawl/models/product_profile.rb', line 67

def category
  @category
end

#descriptionObject (readonly)

Returns the value of attribute description.



67
68
69
# File 'lib/firecrawl/models/product_profile.rb', line 67

def description
  @description
end

#titleObject (readonly)

Returns the value of attribute title.



67
68
69
# File 'lib/firecrawl/models/product_profile.rb', line 67

def title
  @title
end

#urlObject (readonly)

Returns the value of attribute url.



67
68
69
# File 'lib/firecrawl/models/product_profile.rb', line 67

def url
  @url
end

#variantsObject (readonly)

Returns the value of attribute variants.



67
68
69
# File 'lib/firecrawl/models/product_profile.rb', line 67

def variants
  @variants
end

Instance Method Details

#to_sObject



78
79
80
# File 'lib/firecrawl/models/product_profile.rb', line 78

def to_s
  "ProductProfile{title=#{title || 'untitled'}, url=#{url || 'unknown'}}"
end