mida_vocabulary 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ require 'mida_vocabulary/vocabulary'
2
+ require 'mida_vocabulary/vocabularies/data_vocabulary/item'
3
+
4
+ module Mida
5
+ module DataVocabulary
6
+ class Address < Mida::Vocabulary
7
+ itemtype %r{http://data-vocabulary.org/Address}i
8
+ include_vocabulary Mida::DataVocabulary::Item
9
+
10
+ for field in %w{street-address locality region postal-code country-name}
11
+ has_many field
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ require 'mida_vocabulary/vocabulary'
2
+ require 'mida_vocabulary/vocabularies/data_vocabulary/item'
3
+
4
+ module Mida
5
+ module DataVocabulary
6
+ class Breadcrumb < Mida::Vocabulary
7
+ itemtype %r{http://data-vocabulary.org/Breadcrumb}i
8
+ include_vocabulary Mida::DataVocabulary::Item
9
+
10
+ has_many 'title'
11
+ has_many('url') { extract Mida::DataType::URL }
12
+ has_many('child') { extract self }
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,38 @@
1
+ require 'mida_vocabulary/vocabulary'
2
+ require 'mida_vocabulary/vocabularies/data_vocabulary/item'
3
+
4
+ module Mida
5
+ module DataVocabulary
6
+ autoload :Organization, 'mida_vocabulary/vocabularies/data_vocabulary/organization'
7
+ autoload :Geo, 'mida_vocabulary/vocabularies/data_vocabulary/geo'
8
+ autoload :Offer, 'mida_vocabulary/vocabularies/data_vocabulary/offer'
9
+ autoload :OfferAggregate, 'mida_vocabulary/vocabularies/data_vocabulary/offer_aggregate'
10
+
11
+ class Event < Mida::Vocabulary
12
+ itemtype %r{http://data-vocabulary.org/Event}i
13
+ include_vocabulary Mida::DataVocabulary::Item
14
+
15
+ for field in %w{summary url description eventType photo}
16
+ has_many field
17
+ end
18
+
19
+ for field in %w{startDate dtstart endDate dtend duration}
20
+ has_many(field) { extract Mida::DataType::ISO8601Date }
21
+ end
22
+
23
+ has_many 'location' do
24
+ extract Mida::DataVocabulary::Organization
25
+ extract Mida::DataVocabulary::Geo
26
+ extract Mida::DataType::Text
27
+ end
28
+
29
+ has_many 'tickets' do
30
+ extract Mida::DataVocabulary::Offer
31
+ end
32
+
33
+ has_many 'ticketAggregate' do
34
+ extract Mida::DataVocabulary::OfferAggregate
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,21 @@
1
+ require 'mida_vocabulary/vocabulary'
2
+ require 'mida_vocabulary/vocabularies/data_vocabulary/item'
3
+
4
+ module Mida
5
+ module DataVocabulary
6
+ class Geo < Mida::Vocabulary
7
+ itemtype %r{http://data-vocabulary.org/Geo}i
8
+ include_vocabulary Mida::DataVocabulary::Item
9
+
10
+ for field in %w{latitude longitude}
11
+ has_many field do
12
+ extract Mida::DataType::Float
13
+ end
14
+ end
15
+
16
+ has_many 'itemreviewed' do
17
+ extract Mida::DataVocabulary::Item
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ require 'mida_vocabulary/vocabulary'
2
+
3
+ module Mida
4
+ module DataVocabulary
5
+ class Item < Mida::Vocabulary
6
+
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,47 @@
1
+ require 'mida_vocabulary/vocabulary'
2
+ require 'mida_vocabulary/vocabularies/data_vocabulary/item'
3
+
4
+ module Mida
5
+ module DataVocabulary
6
+ autoload :Product, 'mida_vocabulary/vocabularies/data_vocabulary/product'
7
+ autoload :Organization, 'mida_vocabulary/vocabularies/data_vocabulary/organization'
8
+ autoload :Person, 'mida_vocabulary/vocabularies/data_vocabulary/person'
9
+
10
+ class Offer < Mida::Vocabulary
11
+ itemtype %r{http://data-vocabulary.org/Offer}i
12
+ include_vocabulary Mida::DataVocabulary::Item
13
+
14
+ for field in %w{price currency}
15
+ has_many field
16
+ end
17
+
18
+ has_many 'priceValidUntil' do
19
+ extract Mida::DataType::ISO8601Date
20
+ end
21
+
22
+ has_many 'seller' do
23
+ extract Mida::DataVocabulary::Organization
24
+ extract Mida::DataVocabulary::Person
25
+ end
26
+
27
+ # Available values: [new, used, refurbished]
28
+
29
+ # For example:
30
+ # <span itemprop="condition" content="new">Brand new!</span>
31
+ has_many 'condition'
32
+
33
+ # Available values: [out_of_stock, in_stock, instore_only, preorder]
34
+ # should be used in attribute 'content'
35
+ has_many 'availability'
36
+
37
+ has_many('quantity') { extract Mida::DataType::Number }
38
+ has_many('offerURL') { extract Mida::DataType::URL }
39
+ has_many 'identifier'
40
+
41
+ has_many 'itemOffered' do
42
+ extract Mida::DataVocabulary::Product
43
+ extract Mida::DataType::Text
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,27 @@
1
+ require 'mida_vocabulary/vocabulary'
2
+ require 'mida_vocabulary/vocabularies/data_vocabulary/item'
3
+
4
+ module Mida
5
+ module DataVocabulary
6
+ autoload :Product, 'mida_vocabulary/vocabularies/data_vocabulary/product'
7
+
8
+ class OfferAggregate < Mida::Vocabulary
9
+ itemtype %r{http://data-vocabulary.org/Offer-aggregate/}i
10
+ include_vocabulary Mida::DataVocabulary::Item
11
+
12
+ for field in %w{lowPrice highPrice currency condition offerURL identifier}
13
+ has_many field
14
+ end
15
+
16
+ has_many 'offerCount' do
17
+ extract Mida::DataType::Number
18
+ extract Mida::DataType::Text
19
+ end
20
+
21
+ has_many 'itemOffered' do
22
+ extract Mida::DataVocabulary::Product
23
+ extract Mida::DataType::Text
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,22 @@
1
+ require 'mida_vocabulary/vocabulary'
2
+ require 'mida_vocabulary/vocabularies/data_vocabulary/item'
3
+
4
+ module Mida
5
+ module DataVocabulary
6
+ autoload :Geo, 'mida_vocabulary/vocabularies/data_vocabulary/geo'
7
+
8
+ class Organization < Mida::Vocabulary
9
+ itemtype %r{http://data-vocabulary.org/Organization}i
10
+ include_vocabulary Mida::DataVocabulary::Item
11
+
12
+ for field in %w{name url tel}
13
+ has_many field
14
+ end
15
+
16
+ has_many 'geo' do
17
+ extract Mida::DataVocabulary::Geo
18
+ extract Mida::DataType::Text
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,34 @@
1
+ require 'mida_vocabulary/vocabulary'
2
+ require 'mida_vocabulary/vocabularies/data_vocabulary/item'
3
+
4
+ module Mida
5
+ module DataVocabulary
6
+ autoload :Organization, 'mida_vocabulary/vocabularies/data_vocabulary/organization'
7
+ autoload :Address, 'mida_vocabulary/vocabularies/data_vocabulary/address'
8
+
9
+ class Person < Mida::Vocabulary
10
+ itemtype %r{http://data-vocabulary.org/Person}i
11
+ include_vocabulary Mida::DataVocabulary::Item
12
+
13
+ for field in %w{name nickname photo title role affiliation }
14
+ has_many field
15
+ end
16
+
17
+ has_many('url') { extract Mida::DataType::URL }
18
+
19
+ has_many 'address' do
20
+ extract Mida::DataVocabulary::Address
21
+ end
22
+
23
+ has_many 'acquaintance' do
24
+ extract self
25
+ extract Mida::DataType::Text
26
+ end
27
+
28
+ has_many 'friend' do
29
+ extract self
30
+ extract Mida::DataType::Text
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,29 @@
1
+ require 'mida_vocabulary/vocabulary'
2
+ require 'mida_vocabulary/vocabularies/data_vocabulary/item'
3
+
4
+ module Mida
5
+ module DataVocabulary
6
+ autoload :Organization, 'mida_vocabulary/vocabularies/data_vocabulary/organization'
7
+
8
+ class Product < Mida::Vocabulary
9
+ itemtype %r{http://data-vocabulary.org/Product}i
10
+ include_vocabulary Mida::DataVocabulary::Item
11
+
12
+ for field in %w{name image description category identifier}
13
+ has_many field
14
+ end
15
+
16
+ # Google recommends including brand and at least one identifier for each product.
17
+ has_many 'brand' do
18
+ extract Mida::DataVocabulary::Organization
19
+ extract Mida::DataType::Text
20
+ end
21
+
22
+ has_many 'offerDetails' do
23
+ extract Mida::DataVocabulary::Offer
24
+ extract Mida::DataVocabulary::OfferAggregate
25
+ end
26
+ end
27
+ end
28
+ end
29
+
@@ -0,0 +1,35 @@
1
+ require 'mida_vocabulary/vocabulary'
2
+ require 'mida_vocabulary/vocabularies/data_vocabulary/item'
3
+
4
+ module Mida
5
+ module DataVocabulary
6
+ autoload :Person, 'mida_vocabulary/vocabularies/data_vocabulary/person'
7
+ autoload :Review, 'mida_vocabulary/vocabularies/data_vocabulary/review'
8
+
9
+ class Recipe < Mida::Vocabulary
10
+ itemtype %r{http://data-vocabulary.org/Recipe}i
11
+ include_vocabulary Mida::DataVocabulary::Item
12
+
13
+ for field in %w{name recipeType photo summary instructions ingredient}
14
+ has_many field
15
+ end
16
+
17
+ for field in %w{published prepTime cookTime totalTime}
18
+ has_many(field) { extract Mida::DataType::ISO8601Date }
19
+ end
20
+
21
+ has_many 'review' do
22
+ extract Mida::DataVocabulary::Review
23
+ extract Mida::DataType::Text
24
+ end
25
+
26
+ # [servingSize, calories, fat, saturatedFat, unsaturatedFat, carbohydrates, sugar, fiber, protein, cholesterol]
27
+ has_many 'nutrition'
28
+
29
+ has_many 'author' do
30
+ extract Mida::DataVocabulary::Person
31
+ extract Mida::DataType::Text
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,30 @@
1
+ require 'mida_vocabulary/vocabulary'
2
+ require 'mida_vocabulary/vocabularies/data_vocabulary/item'
3
+
4
+ module Mida
5
+ module DataVocabulary
6
+ autoload :Organization, 'mida_vocabulary/vocabularies/data_vocabulary/organization'
7
+
8
+ class Review < Mida::Vocabulary
9
+ itemtype %r{http://data-vocabulary.org/Review}i
10
+ include_vocabulary Mida::DataVocabulary::Item
11
+
12
+ has_one('rating') { extract Mida::DataType::Number }
13
+
14
+ has_one 'reviewer' do
15
+ extract Mida::DataVocabulary::Person
16
+ extract Mida::DataType::Text
17
+ end
18
+
19
+ has_many('dtreviewed') { extract Mida::DataType::ISO8601Date }
20
+
21
+ has_many 'description'
22
+ has_many 'summary'
23
+
24
+ has_many 'itemreviewed' do
25
+ extract Mida::DataVocabulary::Item
26
+ extract Mida::DataType::Text
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1 @@
1
+ Dir.glob(File.dirname(__FILE__) + '/data_vocabulary/*.rb') {|file| require file}
@@ -8,3 +8,4 @@ end
8
8
 
9
9
  require 'mida_vocabulary/vocabularies/genericvocabulary'
10
10
  require 'mida_vocabulary/vocabularies/schemaorg'
11
+ require 'mida_vocabulary/vocabularies/data_vocabulary'
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
2
2
  s.name = "mida_vocabulary"
3
3
  s.summary = "Microdata vocabularies for mida parser/extractor library"
4
4
  s.description = "Microdata schema.org vocabularies"
5
- s.version = "0.1.1"
5
+ s.version = "0.1.2"
6
6
  s.author = "Pavel Evstigneev"
7
7
  s.email = "pavel.evst@gmail.com"
8
8
  s.homepage = %q{http://github.com/Paxa/mida_vocabulary}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mida_vocabulary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-13 00:00:00.000000000 Z
12
+ date: 2012-02-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blankslate
16
- requirement: &2153871320 !ruby/object:Gem::Requirement
16
+ requirement: &2153572640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153871320
24
+ version_requirements: *2153572640
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &2153720340 !ruby/object:Gem::Requirement
27
+ requirement: &2153571900 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.7.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2153720340
35
+ version_requirements: *2153571900
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &2153669340 !ruby/object:Gem::Requirement
38
+ requirement: &2153571480 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2153669340
46
+ version_requirements: *2153571480
47
47
  description: Microdata schema.org vocabularies
48
48
  email: pavel.evst@gmail.com
49
49
  executables: []
@@ -70,6 +70,19 @@ files:
70
70
  - lib/mida_vocabulary/datatype/text.rb
71
71
  - lib/mida_vocabulary/datatype/url.rb
72
72
  - lib/mida_vocabulary/propertydesc.rb
73
+ - lib/mida_vocabulary/vocabularies/data_vocabulary.rb
74
+ - lib/mida_vocabulary/vocabularies/data_vocabulary/address.rb
75
+ - lib/mida_vocabulary/vocabularies/data_vocabulary/breadcrumb.rb
76
+ - lib/mida_vocabulary/vocabularies/data_vocabulary/event.rb
77
+ - lib/mida_vocabulary/vocabularies/data_vocabulary/geo.rb
78
+ - lib/mida_vocabulary/vocabularies/data_vocabulary/item.rb
79
+ - lib/mida_vocabulary/vocabularies/data_vocabulary/offer.rb
80
+ - lib/mida_vocabulary/vocabularies/data_vocabulary/offer_aggregate.rb
81
+ - lib/mida_vocabulary/vocabularies/data_vocabulary/organization.rb
82
+ - lib/mida_vocabulary/vocabularies/data_vocabulary/person.rb
83
+ - lib/mida_vocabulary/vocabularies/data_vocabulary/product.rb
84
+ - lib/mida_vocabulary/vocabularies/data_vocabulary/recipe.rb
85
+ - lib/mida_vocabulary/vocabularies/data_vocabulary/review.rb
73
86
  - lib/mida_vocabulary/vocabularies/genericvocabulary.rb
74
87
  - lib/mida_vocabulary/vocabularies/schemaorg.rb
75
88
  - lib/mida_vocabulary/vocabularies/schemaorg/aboutpage.rb