schema_dot_org 0.5.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +11 -50
- data/lib/schema_dot_org/organization.rb +5 -1
- data/lib/schema_dot_org/version.rb +1 -1
- data/test-script.rb +7 -5
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aeaaa5ba2b21c92d56fec94da4e9326270fa751320365461f092ca44e55c0a65
|
|
4
|
+
data.tar.gz: 5747c59f5e1060866a115e7a5a02419091901817a5890e22c51e5efcb828c8bc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bf34451c2987395d35b62c946fed6ed937b0f938c29ee5dd8825b2892357e41f98965b337df3bd727d1622971260791d230790a4e66a567c6961b925a2bf238b
|
|
7
|
+
data.tar.gz: 75a43fbd24fd903079598e0ad748d882856f6157002d6cd71631acf76823f5242fc8c07a6e59fc8abd40a3b01db4d500fe5dd81c79a0feda80de9ccf8ba452e4
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -18,15 +18,17 @@ include SchemaDotOrg
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
@public_law = Organization.new do |org|
|
|
21
|
-
org.name
|
|
22
|
-
org.email
|
|
23
|
-
org.url
|
|
21
|
+
org.name = 'Public.Law'
|
|
22
|
+
org.email = 'say_hi@public.law'
|
|
23
|
+
org.url = 'https://www.public.law'
|
|
24
|
+
org.logo = 'https://www.public.law/favicon-196x196.png'
|
|
25
|
+
org.same_as = 'https://www.facebook.com/PublicDotLaw'
|
|
24
26
|
org.founding_date = Date.new(2009, 3, 6)
|
|
25
27
|
org.founder = Person.new do |person|
|
|
26
|
-
person.name =
|
|
28
|
+
person.name = 'Robb Shecter'
|
|
27
29
|
end
|
|
28
30
|
org.founding_location = Place.new do |place|
|
|
29
|
-
place.address =
|
|
31
|
+
place.address = 'Portland, OR'
|
|
30
32
|
end
|
|
31
33
|
end
|
|
32
34
|
```
|
|
@@ -45,6 +47,8 @@ SchemaDotOrg will validate your code, and if correct, will generate Schema.org J
|
|
|
45
47
|
"name": "Public.Law",
|
|
46
48
|
"email": "say_hi@public.law",
|
|
47
49
|
"url": "https://www.public.law",
|
|
50
|
+
"logo": "https://www.public.law/favicon-196x196.png",
|
|
51
|
+
"same_as": "https://www.facebook.com/PublicDotLaw",
|
|
48
52
|
"foundingDate": "2009-03-06",
|
|
49
53
|
"founder": {
|
|
50
54
|
"@type": "Person",
|
|
@@ -61,7 +65,7 @@ Notice how the `foundingDate` is in the required ISO-8601 format. The attribute
|
|
|
61
65
|
`Date` and so can ensure correct formatting. In the same way, the `foundingLocation` is a `Place`
|
|
62
66
|
which adds the proper `@type` attribute.
|
|
63
67
|
|
|
64
|
-
### You cannot create invalid markup
|
|
68
|
+
### You cannot create invalid markup
|
|
65
69
|
|
|
66
70
|
E.g., If you use the wrong type or try to set an unknown attribute, SchemaDotOrg will
|
|
67
71
|
refuse to create the incorrect JSON-LD. Instead, you'll get a message explaining
|
|
@@ -82,50 +86,7 @@ This type safety comes from the [ValidatedObject gem](https://github.com/dogweat
|
|
|
82
86
|
|
|
83
87
|
## The Goal: Rich enough vocabulary for Google Schema.org parsing
|
|
84
88
|
|
|
85
|
-
The
|
|
86
|
-
|
|
87
|
-
```html
|
|
88
|
-
<script type="application/ld+json">
|
|
89
|
-
{
|
|
90
|
-
"@context": "http://schema.org",
|
|
91
|
-
"@type": "Organization",
|
|
92
|
-
"email": "sayhi@public.law",
|
|
93
|
-
"founder": {
|
|
94
|
-
"@type": "Person",
|
|
95
|
-
"name": "Robb Shecter"
|
|
96
|
-
},
|
|
97
|
-
"foundingDate": "2009-03-06",
|
|
98
|
-
"foundingLocation": {
|
|
99
|
-
"@type": "Place",
|
|
100
|
-
"address": "Portland, Oregon"
|
|
101
|
-
},
|
|
102
|
-
"logo": "https://www.public.law/favicon-196x196.png",
|
|
103
|
-
"name": "Public.Law",
|
|
104
|
-
"sameAs": [
|
|
105
|
-
"https://twitter.com/law_is_code",
|
|
106
|
-
"https://www.facebook.com/PublicDotLaw",
|
|
107
|
-
"https://www.linkedin.com/company/9170633/"
|
|
108
|
-
],
|
|
109
|
-
"url": "https://www.public.law"
|
|
110
|
-
}
|
|
111
|
-
</script>
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
And it should do it in a **typesafe** way. That is, not merely syntactically correct,
|
|
115
|
-
but also _semantically_ correct. It should, e.g., ensure that only allowed
|
|
116
|
-
attributes are used.
|
|
117
|
-
|
|
118
|
-
## Schema Development Roadmap
|
|
119
|
-
|
|
120
|
-
| Type | Planned | Completed |
|
|
121
|
-
| ---------------------------------------------- | :-----: | :-------: |
|
|
122
|
-
| [Place](http://schema.org/Place) | X | X |
|
|
123
|
-
| [Person](http://schema.org/Person) | X |
|
|
124
|
-
| [Organization](http://schema.org/Organization) | X |
|
|
125
|
-
| [Date](http://schema.org/Date) | X |
|
|
126
|
-
| [URL](http://schema.org/URL) | X |
|
|
127
|
-
|
|
128
|
-
The plan is to implement a small subset of types and attributes relevant to the Google web crawler.
|
|
89
|
+
The plan is to implement a subset of types and attributes relevant to the Google web crawler.
|
|
129
90
|
Propose new types and attributes by opening an Issue.
|
|
130
91
|
|
|
131
92
|
## Installation
|
|
@@ -4,13 +4,15 @@ require 'schema_dot_org'
|
|
|
4
4
|
|
|
5
5
|
module SchemaDotOrg
|
|
6
6
|
class Organization < SchemaType
|
|
7
|
-
attr_accessor :email, :founder, :founding_date, :founding_location, :name, :url
|
|
7
|
+
attr_accessor :email, :founder, :founding_date, :founding_location, :logo, :name, :same_as, :url
|
|
8
8
|
|
|
9
9
|
validates :email, type: String
|
|
10
10
|
validates :founder, type: Person
|
|
11
11
|
validates :founding_date, type: Date
|
|
12
12
|
validates :founding_location, type: Place
|
|
13
|
+
validates :logo, type: String
|
|
13
14
|
validates :name, type: String
|
|
15
|
+
validates :same_as, type: String
|
|
14
16
|
validates :url, type: String
|
|
15
17
|
|
|
16
18
|
def to_json_struct
|
|
@@ -19,6 +21,8 @@ module SchemaDotOrg
|
|
|
19
21
|
"name" => name,
|
|
20
22
|
"email" => email,
|
|
21
23
|
"url" => url,
|
|
24
|
+
"logo" => logo,
|
|
25
|
+
"same_as" => same_as,
|
|
22
26
|
"founder" => founder.to_json_struct,
|
|
23
27
|
"foundingDate" => founding_date.to_s,
|
|
24
28
|
"foundingLocation" => founding_location.to_json_struct
|
data/test-script.rb
CHANGED
|
@@ -7,15 +7,17 @@ include SchemaDotOrg
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
public_law = Organization.new do |org|
|
|
10
|
-
org.name =
|
|
10
|
+
org.name = 'Public.Law'
|
|
11
11
|
org.founding_date = Date.new(2009, 3, 6)
|
|
12
|
-
org.email =
|
|
13
|
-
org.url =
|
|
12
|
+
org.email = 'say_hi@public.law'
|
|
13
|
+
org.url = 'https://www.public.law'
|
|
14
|
+
org.logo = 'https://www.public.law/favicon-196x196.png'
|
|
15
|
+
org.same_as = 'https://www.facebook.com/PublicDotLaw'
|
|
14
16
|
org.founder = Person.new do |person|
|
|
15
|
-
person.name =
|
|
17
|
+
person.name = 'Robb Shecter'
|
|
16
18
|
end
|
|
17
19
|
org.founding_location = Place.new do |place|
|
|
18
|
-
place.address =
|
|
20
|
+
place.address = 'Portland, OR'
|
|
19
21
|
end
|
|
20
22
|
end
|
|
21
23
|
|