Class: RichSnippet::Product
- Defined in:
- app/models/rich_snippet/product.rb
Instance Method Summary collapse
Methods inherited from Thing
#array_json, #module, #name, #type, #warnings
Instance Method Details
#to_json(render_childs = false) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/models/rich_snippet/product.rb', line 17 def to_json(render_childs = false) { "@context": "http://schema.org/", "@type": "Product", name: name, image: image, description: description, mpn: mpn, award: awards, brand: brand ? brand.to_json : nil, offers: array_json(offers), itemCondition: "https://schema.org/#{item_condition}Condition", category: category, color: color, height: height, width: width, depth: depth, weight: weight, manufacturer: manufacturer ? manufacturer.to_json : nil, releaseDate: release_date }.delete_if { |k, v| !v.present? } end |