Sha256: 94ee39f1ee294cd7c4fdac7a725861b8dfef33b74a51985d12946aa0c060a759

Contents?: true

Size: 845 Bytes

Versions: 1

Compression:

Stored size: 845 Bytes

Contents

require 'mida_vocabulary/vocabulary'
require 'mida_vocabulary/vocabularies/data_vocabulary/item'

module Mida
  module DataVocabulary
    autoload :Organization, 'mida_vocabulary/vocabularies/data_vocabulary/organization'

    class Product < Mida::Vocabulary
      itemtype %r{http://data-vocabulary.org/Product}i
      include_vocabulary Mida::DataVocabulary::Item

      for field in %w{name image description category identifier}
        has_many field
      end

      # Google recommends including brand and at least one identifier for each product.
      has_many 'brand' do
        extract Mida::DataVocabulary::Organization
        extract Mida::DataType::Text
      end

      has_many 'offerDetails' do
        extract Mida::DataVocabulary::Offer
        extract Mida::DataVocabulary::OfferAggregate
      end
    end
  end
end
      

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mida_vocabulary-0.1.2 lib/mida_vocabulary/vocabularies/data_vocabulary/product.rb