schema_dot_org 1.3.0 → 1.6.1
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/.ruby-version +1 -1
- data/.travis.yml +2 -1
- data/Gemfile.lock +29 -27
- data/README.md +70 -16
- data/lib/schema_dot_org.rb +17 -8
- data/lib/schema_dot_org/organization.rb +18 -5
- data/lib/schema_dot_org/person.rb +4 -3
- data/lib/schema_dot_org/place.rb +4 -2
- data/lib/schema_dot_org/search_action.rb +20 -0
- data/lib/schema_dot_org/web_site.rb +11 -9
- data/run-script +2 -0
- data/schema_dot_org.gemspec +15 -17
- data/test-script.rb +16 -3
- metadata +17 -17
- data/lib/schema_dot_org/version.rb +0 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 94b2d07e8efd22d98a9ad76181915fcd2bb91d6b3cf56028c125ff12854d3056
|
|
4
|
+
data.tar.gz: b7625ad03b3dc4911b1f5b75db53e2187df6bfd8e74f184537dd9a1b3b631097
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 62860dcaa9d40e17ba4b495cb7e63e64cc46765166c1c5ba9a6d2777fcf93a76492ee3a1279cc95b1fe7e720422992e78f978b05a2b8a60f4258cd9d79396a16
|
|
7
|
+
data.tar.gz: 4c0c209701314df1e8a07bf359da709d0285b76eb8e909dfa87c404a0c2efaeee27929c7ef766fc8af99e6ff993f86725d17a13bf09e753518485f113150fb8d
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.7.1
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,52 +1,54 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
schema_dot_org (1.
|
|
5
|
-
validated_object (~> 2.0.
|
|
4
|
+
schema_dot_org (1.6.1)
|
|
5
|
+
validated_object (~> 2.0.2)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
activemodel (
|
|
11
|
-
activesupport (=
|
|
12
|
-
activesupport (
|
|
10
|
+
activemodel (6.0.3.2)
|
|
11
|
+
activesupport (= 6.0.3.2)
|
|
12
|
+
activesupport (6.0.3.2)
|
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
14
|
-
i18n (
|
|
14
|
+
i18n (>= 0.7, < 2)
|
|
15
15
|
minitest (~> 5.1)
|
|
16
16
|
tzinfo (~> 1.1)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
|
18
|
+
concurrent-ruby (1.1.7)
|
|
19
|
+
diff-lcs (1.4.4)
|
|
20
|
+
i18n (1.8.5)
|
|
20
21
|
concurrent-ruby (~> 1.0)
|
|
21
|
-
minitest (5.
|
|
22
|
-
rake (
|
|
23
|
-
rspec (3.
|
|
24
|
-
rspec-core (~> 3.
|
|
25
|
-
rspec-expectations (~> 3.
|
|
26
|
-
rspec-mocks (~> 3.
|
|
27
|
-
rspec-core (3.
|
|
28
|
-
rspec-support (~> 3.
|
|
29
|
-
rspec-expectations (3.
|
|
22
|
+
minitest (5.14.1)
|
|
23
|
+
rake (13.0.1)
|
|
24
|
+
rspec (3.9.0)
|
|
25
|
+
rspec-core (~> 3.9.0)
|
|
26
|
+
rspec-expectations (~> 3.9.0)
|
|
27
|
+
rspec-mocks (~> 3.9.0)
|
|
28
|
+
rspec-core (3.9.2)
|
|
29
|
+
rspec-support (~> 3.9.3)
|
|
30
|
+
rspec-expectations (3.9.2)
|
|
30
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
31
|
-
rspec-support (~> 3.
|
|
32
|
-
rspec-mocks (3.
|
|
32
|
+
rspec-support (~> 3.9.0)
|
|
33
|
+
rspec-mocks (3.9.1)
|
|
33
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
34
|
-
rspec-support (~> 3.
|
|
35
|
-
rspec-support (3.
|
|
35
|
+
rspec-support (~> 3.9.0)
|
|
36
|
+
rspec-support (3.9.3)
|
|
36
37
|
thread_safe (0.3.6)
|
|
37
|
-
tzinfo (1.2.
|
|
38
|
+
tzinfo (1.2.7)
|
|
38
39
|
thread_safe (~> 0.1)
|
|
39
|
-
validated_object (2.0.
|
|
40
|
+
validated_object (2.0.3)
|
|
40
41
|
activemodel (>= 3.2.21)
|
|
42
|
+
zeitwerk (2.4.0)
|
|
41
43
|
|
|
42
44
|
PLATFORMS
|
|
43
45
|
ruby
|
|
44
46
|
|
|
45
47
|
DEPENDENCIES
|
|
46
|
-
bundler (~>
|
|
47
|
-
rake (
|
|
48
|
+
bundler (~> 2)
|
|
49
|
+
rake (>= 12.3.3)
|
|
48
50
|
rspec (~> 3.0)
|
|
49
51
|
schema_dot_org!
|
|
50
52
|
|
|
51
53
|
BUNDLED WITH
|
|
52
|
-
1.
|
|
54
|
+
2.1.4
|
data/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
[](https://badge.fury.io/rb/schema_dot_org) [](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)
|
|
6
|
-
every single time.
|
|
5
|
+
Let's create [Structured Data](https://developers.google.com/search/docs/guides/intro-structured-data) with correct **syntax** and **semantics**,
|
|
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 . . .
|
|
9
9
|
|
|
@@ -19,7 +19,11 @@ Let's say you have a Rails app. If you put this in a controller:
|
|
|
19
19
|
founding_location: Place.new(address: 'Portland, OR'),
|
|
20
20
|
email: 'say_hi@public.law',
|
|
21
21
|
url: 'https://www.public.law',
|
|
22
|
-
logo: 'https://www.public.law/favicon-196x196.png'
|
|
22
|
+
logo: 'https://www.public.law/favicon-196x196.png',
|
|
23
|
+
same_as: [
|
|
24
|
+
'https://twitter.com/law_is_code',
|
|
25
|
+
'https://www.facebook.com/PublicDotLaw'
|
|
26
|
+
]
|
|
23
27
|
)
|
|
24
28
|
```
|
|
25
29
|
|
|
@@ -29,7 +33,7 @@ Let's say you have a Rails app. If you put this in a controller:
|
|
|
29
33
|
<%= @public_law %>
|
|
30
34
|
```
|
|
31
35
|
|
|
32
|
-
...you'll get this HTML:
|
|
36
|
+
...you'll get this in the HTML:
|
|
33
37
|
|
|
34
38
|
```html
|
|
35
39
|
<script type="application/ld+json">
|
|
@@ -48,18 +52,24 @@ Let's say you have a Rails app. If you put this in a controller:
|
|
|
48
52
|
"foundingLocation": {
|
|
49
53
|
"@type": "Place",
|
|
50
54
|
"address": "Portland, OR"
|
|
51
|
-
}
|
|
55
|
+
},
|
|
56
|
+
"sameAs": [
|
|
57
|
+
"https://twitter.com/law_is_code",
|
|
58
|
+
"https://www.facebook.com/PublicDotLaw"
|
|
59
|
+
]
|
|
60
|
+
}
|
|
52
61
|
</script>
|
|
53
62
|
```
|
|
54
63
|
|
|
55
|
-
Strong typing is at work here. SchemaDotOrg will validate your code, and if correct, will generate Schema.org JSON-LD markup.
|
|
64
|
+
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.
|
|
65
|
+
|
|
56
66
|
Notice how the `foundingDate` is in the required ISO-8601 format. [The founding date must be a Ruby
|
|
57
67
|
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`
|
|
58
68
|
which adds the proper `@type` attribute.
|
|
59
69
|
|
|
60
|
-
### You
|
|
70
|
+
### You are prevented from creating invalid markup
|
|
61
71
|
|
|
62
|
-
|
|
72
|
+
If you use the wrong type or try to set an unknown attribute, SchemaDotOrg will
|
|
63
73
|
refuse to create the incorrect JSON-LD. Instead, you'll get a message explaining
|
|
64
74
|
the problem:
|
|
65
75
|
|
|
@@ -71,16 +81,60 @@ Place.new(
|
|
|
71
81
|
address: '12345 Happy Street',
|
|
72
82
|
author: 'Hemmingway'
|
|
73
83
|
)
|
|
74
|
-
# => NoMethodError: undefined method `author
|
|
84
|
+
# => NoMethodError: undefined method `author'
|
|
75
85
|
```
|
|
76
86
|
|
|
77
87
|
This type safety comes from the [ValidatedObject gem](https://github.com/dogweather/validated_object).
|
|
78
88
|
|
|
79
|
-
##
|
|
89
|
+
## Supported Schema.org Types
|
|
90
|
+
|
|
91
|
+
### WebSite
|
|
92
|
+
|
|
93
|
+
Example with only the required attributes:
|
|
94
|
+
|
|
95
|
+
```ruby
|
|
96
|
+
WebSite.new(
|
|
97
|
+
name: 'Texas Public Law',
|
|
98
|
+
url: 'https://texas.public.law',
|
|
99
|
+
)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
With the optional `SearchAction` to enable a [Sitelinks Searchbox](https://developers.google.com/search/docs/data-types/sitelinks-searchbox):
|
|
103
|
+
|
|
104
|
+
```ruby
|
|
105
|
+
WebSite.new(
|
|
106
|
+
name: 'Texas Public Law',
|
|
107
|
+
url: 'https://texas.public.law',
|
|
108
|
+
potential_action: SearchAction.new(
|
|
109
|
+
target: 'https://texas.public.law/?search={search_term_string}',
|
|
110
|
+
query_input: 'required name=search_term_string'
|
|
111
|
+
)
|
|
112
|
+
)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Organization
|
|
116
|
+
|
|
117
|
+
Example:
|
|
118
|
+
|
|
119
|
+
```ruby
|
|
120
|
+
Organization.new(
|
|
121
|
+
name: 'Public.Law',
|
|
122
|
+
founder: Person.new(name: 'Robb Shecter'),
|
|
123
|
+
founding_date: Date.new(2009, 3, 6),
|
|
124
|
+
founding_location: Place.new(address: 'Portland, OR'),
|
|
125
|
+
email: 'say_hi@public.law',
|
|
126
|
+
url: 'https://www.public.law',
|
|
127
|
+
logo: 'https://www.public.law/favicon-196x196.png',
|
|
128
|
+
same_as: [
|
|
129
|
+
'https://twitter.com/law_is_code',
|
|
130
|
+
'https://www.facebook.com/PublicDotLaw'
|
|
131
|
+
]
|
|
132
|
+
)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Person, Place, and SearchAction
|
|
80
136
|
|
|
81
|
-
|
|
82
|
-
See `test-script.rb` for the supported types. Currently, all the attributes are required.
|
|
83
|
-
Propose new types and attributes by opening an Issue.
|
|
137
|
+
These three aren't too useful on their own in web apps. They're used when creating a `WebSite` and `Organization`, as shown above.
|
|
84
138
|
|
|
85
139
|
## Installation
|
|
86
140
|
|
|
@@ -106,8 +160,8 @@ To install this gem onto your local machine, run `bundle exec rake install`.
|
|
|
106
160
|
|
|
107
161
|
## Contributing
|
|
108
162
|
|
|
109
|
-
Bug reports and pull requests are welcome on GitHub
|
|
163
|
+
Bug reports and pull requests are welcome on GitHub.
|
|
110
164
|
|
|
111
165
|
## License
|
|
112
166
|
|
|
113
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
167
|
+
[The](The) gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/schema_dot_org.rb
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'json'
|
|
2
4
|
require 'validated_object'
|
|
3
|
-
require 'schema_dot_org/version'
|
|
4
5
|
|
|
5
6
|
module SchemaDotOrg
|
|
6
7
|
#
|
|
7
8
|
# Base class for schema types. Refactors out common code.
|
|
8
9
|
#
|
|
9
10
|
class SchemaType < ValidatedObject::Base
|
|
10
|
-
ROOT_ATTR = {"@context" => "http://schema.org"}
|
|
11
|
+
ROOT_ATTR = { "@context" => "http://schema.org" }.freeze
|
|
12
|
+
UNQUALIFIED_CLASS_NAME_REGEX = /([^:]+)$/
|
|
13
|
+
|
|
11
14
|
|
|
12
|
-
|
|
13
15
|
def to_s
|
|
14
|
-
json_string = to_json_ld(pretty:
|
|
16
|
+
json_string = to_json_ld(pretty: (!rails_production? && !ENV['SCHEMA_DOT_ORG_MINIFIED_JSON']))
|
|
15
17
|
|
|
16
18
|
# Mark as safe if we're in Rails
|
|
17
19
|
if json_string.respond_to?(:html_safe)
|
|
@@ -26,7 +28,7 @@ module SchemaDotOrg
|
|
|
26
28
|
"<script type=\"application/ld+json\">\n" + to_json(pretty: pretty, as_root: true) + "\n</script>"
|
|
27
29
|
end
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
|
|
30
32
|
def to_json(pretty: false, as_root: false)
|
|
31
33
|
structure = as_root ? ROOT_ATTR.merge(to_json_struct) : to_json_struct
|
|
32
34
|
|
|
@@ -41,7 +43,7 @@ module SchemaDotOrg
|
|
|
41
43
|
# Use the class name to create the "@type" attribute.
|
|
42
44
|
# @return a hash structure representing json.
|
|
43
45
|
def to_json_struct
|
|
44
|
-
{ "@type" => un_namespaced_classname }.merge(
|
|
46
|
+
{ "@type" => un_namespaced_classname }.merge(_to_json_struct.compact)
|
|
45
47
|
end
|
|
46
48
|
|
|
47
49
|
|
|
@@ -52,8 +54,15 @@ module SchemaDotOrg
|
|
|
52
54
|
|
|
53
55
|
# @return the classname without the module namespace.
|
|
54
56
|
def un_namespaced_classname
|
|
55
|
-
self.class.name =~
|
|
56
|
-
|
|
57
|
+
self.class.name =~ UNQUALIFIED_CLASS_NAME_REGEX
|
|
58
|
+
Regexp.last_match(1)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
private
|
|
63
|
+
|
|
64
|
+
def rails_production?
|
|
65
|
+
defined?(Rails) && Rails.env.production?
|
|
57
66
|
end
|
|
58
67
|
end
|
|
59
68
|
end
|
|
@@ -1,18 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'date'
|
|
2
4
|
require 'schema_dot_org'
|
|
5
|
+
require 'schema_dot_org/person'
|
|
6
|
+
require 'schema_dot_org/place'
|
|
3
7
|
|
|
4
8
|
|
|
5
9
|
module SchemaDotOrg
|
|
6
10
|
class Organization < SchemaType
|
|
7
|
-
attr_accessor :email,
|
|
11
|
+
attr_accessor :email,
|
|
12
|
+
:founder,
|
|
13
|
+
:founding_date,
|
|
14
|
+
:founding_location,
|
|
15
|
+
:logo,
|
|
16
|
+
:name,
|
|
17
|
+
:url,
|
|
18
|
+
:same_as
|
|
8
19
|
|
|
9
20
|
validates :email, type: String
|
|
10
|
-
validates :founder, type: Person
|
|
21
|
+
validates :founder, type: SchemaDotOrg::Person
|
|
11
22
|
validates :founding_date, type: Date
|
|
12
|
-
validates :founding_location, type: Place
|
|
23
|
+
validates :founding_location, type: SchemaDotOrg::Place
|
|
13
24
|
validates :logo, type: String
|
|
14
25
|
validates :name, type: String
|
|
15
26
|
validates :url, type: String
|
|
27
|
+
validates :same_as, type: Array, allow_nil: true
|
|
16
28
|
|
|
17
29
|
def _to_json_struct
|
|
18
30
|
{
|
|
@@ -22,8 +34,9 @@ module SchemaDotOrg
|
|
|
22
34
|
"logo" => logo,
|
|
23
35
|
"founder" => founder.to_json_struct,
|
|
24
36
|
"foundingDate" => founding_date.to_s,
|
|
25
|
-
"foundingLocation" => founding_location.to_json_struct
|
|
37
|
+
"foundingLocation" => founding_location.to_json_struct,
|
|
38
|
+
"sameAs" => same_as
|
|
26
39
|
}
|
|
27
40
|
end
|
|
28
41
|
end
|
|
29
|
-
end
|
|
42
|
+
end
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'schema_dot_org'
|
|
2
4
|
|
|
3
5
|
|
|
4
6
|
module SchemaDotOrg
|
|
5
7
|
# Model the Schema.org `Person`. See http://schema.org/Person
|
|
6
8
|
class Person < SchemaType
|
|
7
|
-
|
|
8
9
|
attr_accessor :name
|
|
9
10
|
validates :name, type: String, presence: true
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
def _to_json_struct
|
|
13
14
|
{
|
|
14
|
-
name
|
|
15
|
+
'name' => self.name
|
|
15
16
|
}
|
|
16
17
|
end
|
|
17
18
|
end
|
|
18
|
-
end
|
|
19
|
+
end
|
data/lib/schema_dot_org/place.rb
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'schema_dot_org'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
module SchemaDotOrg
|
|
7
|
+
# Model the Schema.org `Thing > SearchAction`. See http://schema.org/SearchAction
|
|
8
|
+
class SearchAction < SchemaType
|
|
9
|
+
attr_accessor :target, :query_input
|
|
10
|
+
validates :target, type: String, presence: true
|
|
11
|
+
validates :query_input, type: String, presence: true
|
|
12
|
+
|
|
13
|
+
def _to_json_struct
|
|
14
|
+
{
|
|
15
|
+
'target' => self.target,
|
|
16
|
+
'query_input' => self.query_input
|
|
17
|
+
}
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'schema_dot_org'
|
|
4
|
+
require 'schema_dot_org/search_action'
|
|
2
5
|
|
|
3
6
|
|
|
4
7
|
module SchemaDotOrg
|
|
5
|
-
# Model the Schema.org `Thing > CreativeWork > WebSite`.
|
|
8
|
+
# Model the Schema.org `Thing > CreativeWork > WebSite`.
|
|
6
9
|
# @See http://schema.org/WebSite
|
|
7
10
|
class WebSite < SchemaType
|
|
8
|
-
attr_accessor :name
|
|
9
|
-
validates :name,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
validates :url, type: String, presence: true
|
|
11
|
+
attr_accessor :name, :url, :potential_action
|
|
12
|
+
validates :name, type: String, presence: true
|
|
13
|
+
validates :url, type: String, presence: true
|
|
14
|
+
validates :potential_action, type: SchemaDotOrg::SearchAction, allow_nil: true
|
|
13
15
|
|
|
14
16
|
def _to_json_struct
|
|
15
17
|
{
|
|
16
|
-
name
|
|
17
|
-
url
|
|
18
|
+
'name' => self.name,
|
|
19
|
+
'url' => self.url,
|
|
20
|
+
'potentialAction' => self.potential_action&.to_json_struct
|
|
18
21
|
}
|
|
19
22
|
end
|
|
20
23
|
end
|
|
21
24
|
end
|
|
22
|
-
|
data/run-script
ADDED
data/schema_dot_org.gemspec
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require "schema_dot_org/version"
|
|
5
3
|
|
|
6
4
|
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name =
|
|
8
|
-
spec.version =
|
|
9
|
-
spec.authors = [
|
|
10
|
-
spec.email = [
|
|
5
|
+
spec.name = 'schema_dot_org'
|
|
6
|
+
spec.version = '1.6.1'
|
|
7
|
+
spec.authors = ['Robb Shecter']
|
|
8
|
+
spec.email = ['robb@public.law']
|
|
11
9
|
|
|
12
|
-
spec.summary =
|
|
13
|
-
spec.description =
|
|
14
|
-
spec.homepage =
|
|
15
|
-
spec.license =
|
|
10
|
+
spec.summary = 'JSON-LD generator for Schema.org vocabulary'
|
|
11
|
+
spec.description = 'Creates well-formed website metadata with strongly typed Ruby.'
|
|
12
|
+
spec.homepage = 'https://github.com/public-law/schema-dot-org'
|
|
13
|
+
spec.license = 'MIT'
|
|
16
14
|
|
|
17
15
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
18
16
|
f.match(%r{^(test|spec|features)/})
|
|
19
17
|
end
|
|
20
|
-
spec.bindir =
|
|
18
|
+
spec.bindir = 'exe'
|
|
21
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
22
|
-
spec.require_paths = [
|
|
20
|
+
spec.require_paths = ['lib']
|
|
23
21
|
|
|
24
|
-
spec.add_dependency
|
|
22
|
+
spec.add_dependency 'validated_object', '~> 2.0.2'
|
|
25
23
|
|
|
26
|
-
spec.add_development_dependency
|
|
27
|
-
spec.add_development_dependency
|
|
28
|
-
spec.add_development_dependency
|
|
24
|
+
spec.add_development_dependency 'bundler', '~> 2'
|
|
25
|
+
spec.add_development_dependency 'rake', '>= 12.3.3'
|
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
29
27
|
end
|
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.
|
|
4
|
+
version: 1.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robb Shecter
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-08-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: validated_object
|
|
@@ -16,42 +16,42 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 2.0.
|
|
19
|
+
version: 2.0.2
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 2.0.
|
|
26
|
+
version: 2.0.2
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: bundler
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '2'
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
40
|
+
version: '2'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rake
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- - "
|
|
45
|
+
- - ">="
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version:
|
|
47
|
+
version: 12.3.3
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
|
-
- - "
|
|
52
|
+
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version:
|
|
54
|
+
version: 12.3.3
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: rspec
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -88,15 +88,16 @@ files:
|
|
|
88
88
|
- lib/schema_dot_org/organization.rb
|
|
89
89
|
- lib/schema_dot_org/person.rb
|
|
90
90
|
- lib/schema_dot_org/place.rb
|
|
91
|
-
- lib/schema_dot_org/
|
|
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
|
-
homepage: https://github.com/
|
|
96
|
+
homepage: https://github.com/public-law/schema-dot-org
|
|
96
97
|
licenses:
|
|
97
98
|
- MIT
|
|
98
99
|
metadata: {}
|
|
99
|
-
post_install_message:
|
|
100
|
+
post_install_message:
|
|
100
101
|
rdoc_options: []
|
|
101
102
|
require_paths:
|
|
102
103
|
- lib
|
|
@@ -111,9 +112,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
111
112
|
- !ruby/object:Gem::Version
|
|
112
113
|
version: '0'
|
|
113
114
|
requirements: []
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
signing_key:
|
|
115
|
+
rubygems_version: 3.1.4
|
|
116
|
+
signing_key:
|
|
117
117
|
specification_version: 4
|
|
118
118
|
summary: JSON-LD generator for Schema.org vocabulary
|
|
119
119
|
test_files: []
|