Sha256: 28dc589bbb96fb7c308f35a0b6e46f32e53405cfece8b4fbdf6512bdbb42ee5d

Contents?: true

Size: 1.4 KB

Versions: 4

Compression:

Stored size: 1.4 KB

Contents

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

module Mida
  module DataVocabulary
    autoload :Product, 'mida_vocabulary/vocabularies/data_vocabulary/product'
    autoload :Organization, 'mida_vocabulary/vocabularies/data_vocabulary/organization'
    autoload :Person, 'mida_vocabulary/vocabularies/data_vocabulary/person'
    
    class Offer < Mida::Vocabulary
      itemtype %r{http://data-vocabulary.org/Offer}i
      include_vocabulary Mida::DataVocabulary::Item

      for field in %w{price currency}
        has_many field
      end

      has_many 'priceValidUntil' do
        extract Mida::DataType::ISO8601Date
      end

      has_many 'seller' do
        extract Mida::DataVocabulary::Organization
        extract Mida::DataVocabulary::Person
      end

      # Available values: [new, used, refurbished]

      # For example:
      # <span itemprop="condition" content="new">Brand new!</span>
      has_many 'condition'

      # Available values: [out_of_stock, in_stock, instore_only, preorder]
      # should be used in attribute 'content'
      has_many 'availability'

      has_many('quantity') { extract Mida::DataType::Number }
      has_many('offerURL') { extract Mida::DataType::URL }
      has_many 'identifier'
      
      has_many 'itemOffered' do
        extract Mida::DataVocabulary::Product
        extract Mida::DataType::Text
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mida_vocabulary-0.2.2 lib/mida_vocabulary/vocabularies/data_vocabulary/offer.rb
mida_vocabulary-0.2 lib/mida_vocabulary/vocabularies/data_vocabulary/offer.rb
mida_vocabulary-0.1.3 lib/mida_vocabulary/vocabularies/data_vocabulary/offer.rb
mida_vocabulary-0.1.2 lib/mida_vocabulary/vocabularies/data_vocabulary/offer.rb