schema_dot_org 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -5
- data/README.md +7 -6
- data/lib/schema_dot_org/web_site.rb +2 -1
- data/run-script +1 -0
- data/schema_dot_org.gemspec +1 -1
- data/test-script.rb +16 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9039661fa215dd59b1b15d4bb22bee6ae739ac5c030f5fe9a27942e1dd635ee2
|
4
|
+
data.tar.gz: dda30e0482e5b6433ac6f44a526a0f0d0e6105864542b415c44ecbc0a9bca22b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7180f16b57736871d59b252ab724016638ac0c2bf9f760aa13781a20cf2d46f11913c6ae5ba9ea4b976049876c8be5cc583aae7b974e88ba4ff70e4ad0671cca
|
7
|
+
data.tar.gz: 2d000cf439ddfdd7635249ee75a7a9dc7b6c812f51ae901a75853ef90a6e659907de93e6a9b0320718ff7c9ca06c93a949ad52b9660d1c7c695f555f9690df8e
|
data/Gemfile.lock
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
schema_dot_org (1.5.
|
4
|
+
schema_dot_org (1.5.1)
|
5
5
|
validated_object (~> 2.0.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (5.
|
11
|
-
activesupport (= 5.
|
12
|
-
activesupport (5.
|
10
|
+
activemodel (5.2.0)
|
11
|
+
activesupport (= 5.2.0)
|
12
|
+
activesupport (5.2.0)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 0.7, < 2)
|
15
15
|
minitest (~> 5.1)
|
16
16
|
tzinfo (~> 1.1)
|
17
17
|
concurrent-ruby (1.0.5)
|
18
18
|
diff-lcs (1.3)
|
19
|
-
i18n (1.0.
|
19
|
+
i18n (1.0.1)
|
20
20
|
concurrent-ruby (~> 1.0)
|
21
21
|
minitest (5.11.3)
|
22
22
|
rake (10.5.0)
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
[![
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/schema_dot_org.svg)](https://badge.fury.io/rb/schema_dot_org) [![Maintainability](https://api.codeclimate.com/v1/badges/e0c60b4cbc998563a484/maintainability)](https://codeclimate.com/github/dogweather/schema-dot-org/maintainability)
|
2
2
|
|
3
3
|
# SchemaDotOrg
|
4
4
|
|
5
|
-
Let's create [Structured Data](https://developers.google.com/search/docs/guides/intro-structured-data)
|
5
|
+
Let's create [Structured Data](https://developers.google.com/search/docs/guides/intro-structured-data) with correct **syntax** and **semantics**,
|
6
6
|
every single time. Good structured data [helps enhance a website's search result appearance](https://developers.google.com/search/docs/guides/enhance-site).
|
7
7
|
|
8
8
|
> Google Search works hard to understand the content of a page. You can help us by providing explicit clues about the meaning of a page . . .
|
@@ -33,7 +33,7 @@ Let's say you have a Rails app. If you put this in a controller:
|
|
33
33
|
<%= @public_law %>
|
34
34
|
```
|
35
35
|
|
36
|
-
...you'll get this HTML:
|
36
|
+
...you'll get this in the HTML:
|
37
37
|
|
38
38
|
```html
|
39
39
|
<script type="application/ld+json">
|
@@ -60,14 +60,15 @@ Let's say you have a Rails app. If you put this in a controller:
|
|
60
60
|
</script>
|
61
61
|
```
|
62
62
|
|
63
|
-
Strong typing is at work here. SchemaDotOrg will validate your code, and if correct, will generate Schema.org JSON-LD markup.
|
63
|
+
Strong typing is at work here. `SchemaDotOrg` will validate your code, and if correct, will generate Schema.org JSON-LD markup. If not, you'll get a descriptive error message.
|
64
|
+
|
64
65
|
Notice how the `foundingDate` is in the required ISO-8601 format. [The founding date must be a Ruby
|
65
66
|
Date object](https://github.com/dogweather/schema-dot-org/blob/master/lib/schema_dot_org/organization.rb#L11) and so we can ensure correct formatting. In the same way, the `foundingLocation` is a `Place`
|
66
67
|
which adds the proper `@type` attribute.
|
67
68
|
|
68
|
-
### You
|
69
|
+
### You are prevented from creating invalid markup
|
69
70
|
|
70
|
-
|
71
|
+
If you use the wrong type or try to set an unknown attribute, SchemaDotOrg will
|
71
72
|
refuse to create the incorrect JSON-LD. Instead, you'll get a message explaining
|
72
73
|
the problem:
|
73
74
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'schema_dot_org'
|
4
|
+
require 'schema_dot_org/search_action'
|
4
5
|
|
5
6
|
|
6
7
|
module SchemaDotOrg
|
@@ -10,7 +11,7 @@ module SchemaDotOrg
|
|
10
11
|
attr_accessor :name, :url, :potential_action
|
11
12
|
validates :name, type: String, presence: true
|
12
13
|
validates :url, type: String, presence: true
|
13
|
-
validates :potential_action, type: SearchAction, allow_nil: true
|
14
|
+
validates :potential_action, type: SchemaDotOrg::SearchAction, allow_nil: true
|
14
15
|
|
15
16
|
def _to_json_struct
|
16
17
|
{
|
data/run-script
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby -I lib ./test-script.rb
|
data/schema_dot_org.gemspec
CHANGED
data/test-script.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'date'
|
2
4
|
|
3
5
|
require 'schema_dot_org/person'
|
@@ -15,12 +17,23 @@ public_law = Organization.new(
|
|
15
17
|
email: 'say_hi@public.law',
|
16
18
|
url: 'https://www.public.law',
|
17
19
|
logo: 'https://www.public.law/favicon-196x196.png',
|
18
|
-
|
20
|
+
same_as: [
|
21
|
+
'https://twitter.com/law_is_code',
|
22
|
+
'https://www.facebook.com/PublicDotLaw'
|
23
|
+
]
|
24
|
+
)
|
25
|
+
|
26
|
+
puts public_law
|
27
|
+
|
19
28
|
|
20
29
|
site_info = WebSite.new(
|
21
30
|
name: 'Texas Public Law',
|
22
|
-
url: 'https://texas.public.law'
|
31
|
+
url: 'https://texas.public.law',
|
32
|
+
potential_action: SearchAction.new(
|
33
|
+
target: 'https://texas.public.law/?search={search_term_string}',
|
34
|
+
query_input: 'required name=search_term_string'
|
35
|
+
)
|
23
36
|
)
|
24
37
|
|
38
|
+
|
25
39
|
puts site_info
|
26
|
-
puts public_law
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schema_dot_org
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robb Shecter
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: validated_object
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- lib/schema_dot_org/place.rb
|
91
91
|
- lib/schema_dot_org/search_action.rb
|
92
92
|
- lib/schema_dot_org/web_site.rb
|
93
|
+
- run-script
|
93
94
|
- schema_dot_org.gemspec
|
94
95
|
- test-script.rb
|
95
96
|
homepage: https://github.com/dogweather/schema-dot-org
|