schema_dot_org 1.8 → 2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +29 -17
- data/README.md +1 -1
- data/lib/schema_dot_org/aggregate_offer.rb +36 -0
- data/lib/schema_dot_org/contact_point.rb +31 -0
- data/lib/schema_dot_org/item_list.rb +37 -0
- data/lib/schema_dot_org/list_item.rb +30 -0
- data/lib/schema_dot_org/offer.rb +29 -0
- data/lib/schema_dot_org/organization.rb +25 -13
- data/lib/schema_dot_org/person.rb +10 -3
- data/lib/schema_dot_org/product.rb +37 -0
- data/lib/schema_dot_org/schema_type.rb +67 -0
- data/lib/schema_dot_org/web_site.rb +3 -3
- data/lib/schema_dot_org.rb +12 -57
- data/schema_dot_org.gemspec +5 -5
- data/test-script.rb +1 -4
- metadata +18 -12
- data/run-script +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 643f2d209ee7cac02447c46cc8f5c14682163dd171db5d3c1b5fdf84382a3eab
|
4
|
+
data.tar.gz: cab0857ac26be75638701893e328db0a93840a368b46df5e5e6a106ccb98f3be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69e7822b9097e10d3a4d51053f32982fddde76ffcccd3f611474d08c6ef890dc31a16cd3bcf14d6420b592ff80fff756b8737f733a0e57c1ffcc0be925772025
|
7
|
+
data.tar.gz: 65e88820be2cdedb39aee20ca85bc14e1866b64a2737323076bba3d18d39184cc37b192edfbc65ba5ba1b194de0f9339fece13fb1e7fdd7d72e755bf3442e800
|
data/Gemfile.lock
CHANGED
@@ -1,39 +1,51 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
schema_dot_org (
|
4
|
+
schema_dot_org (2.0)
|
5
5
|
validated_object (~> 2.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (7.
|
11
|
-
activesupport (= 7.
|
12
|
-
activesupport (7.
|
10
|
+
activemodel (7.1.1)
|
11
|
+
activesupport (= 7.1.1)
|
12
|
+
activesupport (7.1.1)
|
13
|
+
base64
|
14
|
+
bigdecimal
|
13
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
+
connection_pool (>= 2.2.5)
|
17
|
+
drb
|
14
18
|
i18n (>= 1.6, < 2)
|
15
19
|
minitest (>= 5.1)
|
20
|
+
mutex_m
|
16
21
|
tzinfo (~> 2.0)
|
17
|
-
|
22
|
+
base64 (0.1.1)
|
23
|
+
bigdecimal (3.1.4)
|
24
|
+
concurrent-ruby (1.2.2)
|
25
|
+
connection_pool (2.4.1)
|
18
26
|
diff-lcs (1.5.0)
|
19
|
-
|
27
|
+
drb (2.1.1)
|
28
|
+
ruby2_keywords
|
29
|
+
i18n (1.14.1)
|
20
30
|
concurrent-ruby (~> 1.0)
|
21
|
-
minitest (5.
|
31
|
+
minitest (5.20.0)
|
32
|
+
mutex_m (0.1.2)
|
22
33
|
rake (13.0.6)
|
23
34
|
rspec (3.12.0)
|
24
35
|
rspec-core (~> 3.12.0)
|
25
36
|
rspec-expectations (~> 3.12.0)
|
26
37
|
rspec-mocks (~> 3.12.0)
|
27
|
-
rspec-core (3.12.
|
38
|
+
rspec-core (3.12.2)
|
28
39
|
rspec-support (~> 3.12.0)
|
29
|
-
rspec-expectations (3.12.
|
40
|
+
rspec-expectations (3.12.3)
|
30
41
|
diff-lcs (>= 1.2.0, < 2.0)
|
31
42
|
rspec-support (~> 3.12.0)
|
32
|
-
rspec-mocks (3.12.
|
43
|
+
rspec-mocks (3.12.6)
|
33
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
34
45
|
rspec-support (~> 3.12.0)
|
35
|
-
rspec-support (3.12.
|
36
|
-
|
46
|
+
rspec-support (3.12.1)
|
47
|
+
ruby2_keywords (0.0.5)
|
48
|
+
sorbet-runtime (0.5.10993)
|
37
49
|
tzinfo (2.0.6)
|
38
50
|
concurrent-ruby (~> 1.0)
|
39
51
|
validated_object (2.2.0)
|
@@ -41,13 +53,13 @@ GEM
|
|
41
53
|
sorbet-runtime (>= 0.5.5890)
|
42
54
|
|
43
55
|
PLATFORMS
|
44
|
-
|
56
|
+
arm64-darwin-22
|
45
57
|
|
46
58
|
DEPENDENCIES
|
47
|
-
bundler (~> 2)
|
48
|
-
rake (
|
49
|
-
rspec (~> 3.
|
59
|
+
bundler (~> 2.4)
|
60
|
+
rake (~> 13.0)
|
61
|
+
rspec (~> 3.12)
|
50
62
|
schema_dot_org!
|
51
63
|
|
52
64
|
BUNDLED WITH
|
53
|
-
2.
|
65
|
+
2.4.20
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# SchemaDotOrg
|
4
4
|
|
5
|
-
|
5
|
+
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 . . .
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
require 'schema_dot_org'
|
5
|
+
require 'schema_dot_org/offer'
|
6
|
+
|
7
|
+
# Model the Schema.org `Thing > Place`. See https://schema.org/Offer
|
8
|
+
#
|
9
|
+
module SchemaDotOrg
|
10
|
+
class AggregateOffer < SchemaType
|
11
|
+
attr_accessor :priceCurrency,
|
12
|
+
:highPrice,
|
13
|
+
:lowPrice,
|
14
|
+
:offerCount,
|
15
|
+
:offers
|
16
|
+
|
17
|
+
validates :lowPrice, type: Numeric
|
18
|
+
validates :highPrice, type: Numeric, allow_nil: true
|
19
|
+
validates :offerCount, type: String, allow_nil: true
|
20
|
+
validates :offers, type: Array, allow_nil: true
|
21
|
+
|
22
|
+
def _to_json_struct
|
23
|
+
{
|
24
|
+
"priceCurrency" => priceCurrency,
|
25
|
+
"lowPrice" => lowPrice,
|
26
|
+
"highPrice" => highPrice,
|
27
|
+
"offerCount" => offerCount,
|
28
|
+
"offers" => offers.map(&:to_json_struct)
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def offers
|
33
|
+
@offers || []
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'schema_dot_org'
|
4
|
+
|
5
|
+
|
6
|
+
module SchemaDotOrg
|
7
|
+
# Model the Schema.org `ContactPoint`. See http://schema.org/ContactPoint
|
8
|
+
class ContactPoint < SchemaType
|
9
|
+
attr_accessor :telephone,
|
10
|
+
:contact_type,
|
11
|
+
:contact_option,
|
12
|
+
:area_served,
|
13
|
+
:available_language
|
14
|
+
|
15
|
+
validates :telephone, type: String, presence: true
|
16
|
+
validates :contact_type, type: String, presence: true
|
17
|
+
validates :contact_option, type: String, allow_nil: true
|
18
|
+
validates :area_served, type: Array, allow_nil: true
|
19
|
+
validates :available_language, type: Array, allow_nil: true
|
20
|
+
|
21
|
+
def _to_json_struct
|
22
|
+
{
|
23
|
+
'telephone' => telephone,
|
24
|
+
'contactType' => contact_type,
|
25
|
+
'contactOption' => contact_option,
|
26
|
+
'areaServed' => area_served,
|
27
|
+
'availableLanguage' => available_language
|
28
|
+
}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'schema_dot_org'
|
4
|
+
|
5
|
+
module SchemaDotOrg
|
6
|
+
# Model the Schema.org `ItemList`. See https://schema.org/ItemList
|
7
|
+
class ItemList < SchemaType
|
8
|
+
attr_accessor :itemListOrder,
|
9
|
+
:numberOfItems,
|
10
|
+
:url,
|
11
|
+
:image,
|
12
|
+
:itemListElement
|
13
|
+
|
14
|
+
|
15
|
+
validates :itemListElement, type: Array, presence: true
|
16
|
+
validates :itemListOrder, type: String, allow_nil: true
|
17
|
+
validates :numberOfItems, type: Integer, allow_nil: true
|
18
|
+
|
19
|
+
validates :url, type: String, allow_nil: true
|
20
|
+
validates :image, type: String, allow_nil: true
|
21
|
+
|
22
|
+
|
23
|
+
def _to_json_struct
|
24
|
+
{
|
25
|
+
'itemListOrder' => itemListOrder,
|
26
|
+
'numberOfItems' => numberOfItems,
|
27
|
+
'url' => url,
|
28
|
+
'image' => image,
|
29
|
+
'itemListElement' => itemListElement.map(&:to_json_struct)
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
def itemListElement
|
34
|
+
@itemListElement || []
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'schema_dot_org'
|
4
|
+
require 'schema_dot_org/product'
|
5
|
+
|
6
|
+
|
7
|
+
module SchemaDotOrg
|
8
|
+
# Model the Schema.org `ItemListElement`. See https://schema.org/ItemListElement
|
9
|
+
class ListItem < SchemaType
|
10
|
+
attr_accessor :position, :item,
|
11
|
+
:url, :name, :image
|
12
|
+
|
13
|
+
validates :position, type: Integer, presence: true
|
14
|
+
validates :url, type: String, allow_nil: true
|
15
|
+
validates :name, type: String, allow_nil: true
|
16
|
+
validates :image, type: String, allow_nil: true
|
17
|
+
|
18
|
+
validates :item, type: Product, allow_nil: true
|
19
|
+
|
20
|
+
def _to_json_struct
|
21
|
+
{
|
22
|
+
'position' => position,
|
23
|
+
'url' => url,
|
24
|
+
'name' => name,
|
25
|
+
'image' => image,
|
26
|
+
'item' => object_to_json_struct(item)
|
27
|
+
}
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
require 'schema_dot_org'
|
5
|
+
|
6
|
+
# Model the Schema.org `Thing > Place`. See https://schema.org/Offer
|
7
|
+
#
|
8
|
+
module SchemaDotOrg
|
9
|
+
class Offer < SchemaType
|
10
|
+
attr_accessor :priceCurrency,
|
11
|
+
:price,
|
12
|
+
:availability,
|
13
|
+
:url
|
14
|
+
|
15
|
+
validates :priceCurrency, type: String
|
16
|
+
validates :price, type: Numeric
|
17
|
+
validates :availability, type: String, allow_nil: true
|
18
|
+
validates :url, type: String, allow_nil: true
|
19
|
+
|
20
|
+
def _to_json_struct
|
21
|
+
{
|
22
|
+
"price" => price,
|
23
|
+
"priceCurrency" => priceCurrency,
|
24
|
+
"availability" => availability,
|
25
|
+
"url" => url
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,6 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'date'
|
4
|
+
require 'schema_dot_org'
|
5
|
+
require 'schema_dot_org/person'
|
6
|
+
require 'schema_dot_org/place'
|
7
|
+
require 'schema_dot_org/contact_point'
|
8
|
+
|
4
9
|
|
5
10
|
module SchemaDotOrg
|
6
11
|
class Organization < SchemaType
|
@@ -11,28 +16,35 @@ module SchemaDotOrg
|
|
11
16
|
:logo,
|
12
17
|
:name,
|
13
18
|
:url,
|
14
|
-
:same_as
|
19
|
+
:same_as,
|
20
|
+
:contact_points
|
15
21
|
|
16
|
-
validates :email, type: String
|
17
|
-
validates :founder, type: SchemaDotOrg::Person
|
18
|
-
validates :founding_date, type: Date
|
19
|
-
validates :founding_location, type: SchemaDotOrg::Place
|
22
|
+
validates :email, type: String, allow_nil: true
|
23
|
+
validates :founder, type: SchemaDotOrg::Person, allow_nil: true
|
24
|
+
validates :founding_date, type: Date, allow_nil: true
|
25
|
+
validates :founding_location, type: SchemaDotOrg::Place, allow_nil: true
|
20
26
|
validates :logo, type: String
|
21
27
|
validates :name, type: String
|
22
28
|
validates :url, type: String
|
23
29
|
validates :same_as, type: Array, allow_nil: true
|
30
|
+
validates :contact_points, type: Array, allow_nil: true
|
24
31
|
|
25
32
|
def _to_json_struct
|
26
33
|
{
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
"name" => name,
|
35
|
+
"email" => email,
|
36
|
+
"url" => url,
|
37
|
+
"logo" => logo,
|
38
|
+
"founder" => object_to_json_struct(founder),
|
39
|
+
"foundingDate" => founding_date.to_s,
|
40
|
+
"foundingLocation" => object_to_json_struct(founding_location),
|
41
|
+
"sameAs" => same_as,
|
42
|
+
"contactPoint" => contact_points.map(&:to_json_struct)
|
35
43
|
}
|
36
44
|
end
|
45
|
+
|
46
|
+
def contact_points
|
47
|
+
@contact_points || []
|
48
|
+
end
|
37
49
|
end
|
38
50
|
end
|
@@ -4,12 +4,19 @@
|
|
4
4
|
module SchemaDotOrg
|
5
5
|
# Model the Schema.org `Person`. See http://schema.org/Person
|
6
6
|
class Person < SchemaType
|
7
|
-
attr_accessor :name
|
8
|
-
|
7
|
+
attr_accessor :name,
|
8
|
+
:url,
|
9
|
+
:same_as
|
10
|
+
|
11
|
+
validates :name, type: String, presence: true
|
12
|
+
validates :url, type: String, allow_nil: true
|
13
|
+
validates :same_as, type: Array, allow_nil: true
|
9
14
|
|
10
15
|
def _to_json_struct
|
11
16
|
{
|
12
|
-
'name' => name
|
17
|
+
'name' => name,
|
18
|
+
'url' => url,
|
19
|
+
'same_as' => same_as
|
13
20
|
}
|
14
21
|
end
|
15
22
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
require 'schema_dot_org'
|
5
|
+
require 'schema_dot_org/aggregate_offer'
|
6
|
+
|
7
|
+
# Model the Schema.org `Thing > Place`. See https://schema.org/Product
|
8
|
+
#
|
9
|
+
module SchemaDotOrg
|
10
|
+
class Product < SchemaType
|
11
|
+
attr_accessor :name,
|
12
|
+
:url,
|
13
|
+
:description,
|
14
|
+
:image,
|
15
|
+
:offers
|
16
|
+
|
17
|
+
validates :name, type: String
|
18
|
+
validates :url, type: String
|
19
|
+
validates :description, type: String, allow_nil: true
|
20
|
+
validates :image, type: Array, allow_nil: true
|
21
|
+
validates :offers, type: SchemaDotOrg::AggregateOffer
|
22
|
+
|
23
|
+
def _to_json_struct
|
24
|
+
{
|
25
|
+
"name" => name,
|
26
|
+
"url" => url,
|
27
|
+
"description" => description,
|
28
|
+
"image" => image,
|
29
|
+
"offers" => offers.to_json_struct
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
def image
|
34
|
+
@image || []
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'validated_object'
|
3
|
+
|
4
|
+
module SchemaDotOrg
|
5
|
+
class SchemaType < ValidatedObject::Base
|
6
|
+
ROOT_ATTR = { "@context" => "http://schema.org" }.freeze
|
7
|
+
UNQUALIFIED_CLASS_NAME_REGEX = /([^:]+)$/
|
8
|
+
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
json_string = to_json_ld(pretty: (!rails_production? && !ENV['SCHEMA_DOT_ORG_MINIFIED_JSON']))
|
12
|
+
|
13
|
+
# Mark as safe if we're in Rails
|
14
|
+
if json_string.respond_to?(:html_safe)
|
15
|
+
json_string.html_safe
|
16
|
+
else
|
17
|
+
json_string
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def to_json_ld(pretty: false)
|
23
|
+
"<script type=\"application/ld+json\">\n" + to_json(pretty: pretty, as_root: true) + "\n</script>"
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
def to_json(pretty: false, as_root: false)
|
28
|
+
structure = as_root ? ROOT_ATTR.merge(to_json_struct) : to_json_struct
|
29
|
+
|
30
|
+
if pretty
|
31
|
+
JSON.pretty_generate(structure)
|
32
|
+
else
|
33
|
+
structure.to_json
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
# Use the class name to create the "@type" attribute.
|
39
|
+
# @return a hash structure representing json.
|
40
|
+
def to_json_struct
|
41
|
+
{ "@type" => un_namespaced_classname }.merge(_to_json_struct.reject { |_, v| v.blank? })
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
def _to_json_struct
|
46
|
+
raise "For subclasses to implement"
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
# @return the classname without the module namespace.
|
51
|
+
def un_namespaced_classname
|
52
|
+
self.class.name =~ UNQUALIFIED_CLASS_NAME_REGEX
|
53
|
+
Regexp.last_match(1)
|
54
|
+
end
|
55
|
+
|
56
|
+
def object_to_json_struct(object)
|
57
|
+
return nil unless object
|
58
|
+
object.to_json_struct
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def rails_production?
|
64
|
+
defined?(Rails) && Rails.env.production?
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -12,9 +12,9 @@ module SchemaDotOrg
|
|
12
12
|
|
13
13
|
def _to_json_struct
|
14
14
|
{
|
15
|
-
'name' => name,
|
16
|
-
'url' =>
|
17
|
-
'potentialAction' => potential_action
|
15
|
+
'name' => self.name,
|
16
|
+
'url' => self.url,
|
17
|
+
'potentialAction' => object_to_json_struct(potential_action)
|
18
18
|
}
|
19
19
|
end
|
20
20
|
end
|
data/lib/schema_dot_org.rb
CHANGED
@@ -1,63 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require '
|
4
|
-
require '
|
2
|
+
require 'schema_dot_org/schema_type'
|
3
|
+
require 'schema_dot_org/search_action'
|
4
|
+
require 'schema_dot_org/web_site'
|
5
|
+
require 'schema_dot_org/organization'
|
6
|
+
require 'schema_dot_org/product'
|
7
|
+
require 'schema_dot_org/item_list'
|
8
|
+
require 'schema_dot_org/list_item'
|
9
|
+
require 'schema_dot_org/person'
|
10
|
+
require 'schema_dot_org/place'
|
11
|
+
require 'schema_dot_org/aggregate_offer'
|
12
|
+
require 'schema_dot_org/offer'
|
13
|
+
require 'schema_dot_org/contact_point'
|
5
14
|
|
6
15
|
module SchemaDotOrg
|
7
|
-
#
|
8
|
-
# Base class for schema types. Refactors out common code.
|
9
|
-
#
|
10
|
-
class SchemaType < ValidatedObject::Base
|
11
|
-
ROOT_ATTR = { '@context' => 'http://schema.org' }.freeze
|
12
|
-
UNQUALIFIED_CLASS_NAME_REGEX = /([^:]+)$/.freeze
|
13
|
-
|
14
|
-
def to_s
|
15
|
-
json_string = to_json_ld(pretty: (!rails_production? && !ENV['SCHEMA_DOT_ORG_MINIFIED_JSON']))
|
16
|
-
|
17
|
-
# Mark as safe if we're in Rails
|
18
|
-
if json_string.respond_to?(:html_safe)
|
19
|
-
json_string.html_safe
|
20
|
-
else
|
21
|
-
json_string
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def to_json_ld(pretty: false)
|
26
|
-
"<script type=\"application/ld+json\">\n" + to_json(pretty: pretty, as_root: true) + "\n</script>"
|
27
|
-
end
|
28
|
-
|
29
|
-
def to_json(pretty: false, as_root: false)
|
30
|
-
structure = as_root ? ROOT_ATTR.merge(to_json_struct) : to_json_struct
|
31
|
-
|
32
|
-
if pretty
|
33
|
-
JSON.pretty_generate(structure)
|
34
|
-
else
|
35
|
-
structure.to_json
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# Use the class name to create the "@type" attribute.
|
40
|
-
# @return a hash structure representing json.
|
41
|
-
def to_json_struct
|
42
|
-
{ '@type' => un_namespaced_classname }.merge(_to_json_struct.compact)
|
43
|
-
end
|
44
|
-
|
45
|
-
def _to_json_struct
|
46
|
-
raise 'For subclasses to implement'
|
47
|
-
end
|
48
|
-
|
49
|
-
# @return the classname without the module namespace.
|
50
|
-
def un_namespaced_classname
|
51
|
-
self.class.name =~ UNQUALIFIED_CLASS_NAME_REGEX
|
52
|
-
Regexp.last_match(1)
|
53
|
-
end
|
54
|
-
|
55
|
-
private
|
56
|
-
|
57
|
-
def rails_production?
|
58
|
-
defined?(Rails) && Rails.env.production?
|
59
|
-
end
|
60
|
-
end
|
61
16
|
end
|
62
17
|
|
63
18
|
|
data/schema_dot_org.gemspec
CHANGED
@@ -7,7 +7,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.required_ruby_version = '>= 2.6'
|
9
9
|
spec.name = 'schema_dot_org'
|
10
|
-
spec.version = '
|
10
|
+
spec.version = '2.0'
|
11
11
|
spec.authors = ['Robb Shecter']
|
12
12
|
spec.email = ['robb@public.law']
|
13
13
|
|
@@ -20,14 +20,14 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
21
21
|
f.match(%r{^(test|spec|features)/})
|
22
22
|
end
|
23
|
+
|
23
24
|
spec.bindir = 'exe'
|
24
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
26
|
spec.require_paths = ['lib']
|
26
27
|
|
27
28
|
spec.add_dependency 'validated_object', '~> 2.2'
|
28
29
|
|
29
|
-
|
30
|
-
spec.add_development_dependency
|
31
|
-
spec.add_development_dependency
|
32
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
|
+
spec.add_development_dependency "bundler", "~> 2.4"
|
31
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.12"
|
33
33
|
end
|
data/test-script.rb
CHANGED
@@ -2,11 +2,8 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'date'
|
5
|
+
require 'schema_dot_org'
|
5
6
|
|
6
|
-
require 'schema_dot_org/person'
|
7
|
-
require 'schema_dot_org/place'
|
8
|
-
require 'schema_dot_org/organization'
|
9
|
-
require 'schema_dot_org/web_site'
|
10
7
|
include SchemaDotOrg
|
11
8
|
|
12
9
|
public_law = Organization.new(
|
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: '
|
4
|
+
version: '2.0'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robb Shecter
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: validated_object
|
@@ -30,42 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '2'
|
33
|
+
version: '2.4'
|
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: '2'
|
40
|
+
version: '2.4'
|
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: '13.0'
|
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: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
61
|
+
version: '3.12'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '3.
|
68
|
+
version: '3.12'
|
69
69
|
description: Creates well-formed website metadata with strongly typed Ruby.
|
70
70
|
email:
|
71
71
|
- robb@public.law
|
@@ -86,12 +86,18 @@ files:
|
|
86
86
|
- bin/setup
|
87
87
|
- bin/tapioca
|
88
88
|
- lib/schema_dot_org.rb
|
89
|
+
- lib/schema_dot_org/aggregate_offer.rb
|
90
|
+
- lib/schema_dot_org/contact_point.rb
|
91
|
+
- lib/schema_dot_org/item_list.rb
|
92
|
+
- lib/schema_dot_org/list_item.rb
|
93
|
+
- lib/schema_dot_org/offer.rb
|
89
94
|
- lib/schema_dot_org/organization.rb
|
90
95
|
- lib/schema_dot_org/person.rb
|
91
96
|
- lib/schema_dot_org/place.rb
|
97
|
+
- lib/schema_dot_org/product.rb
|
98
|
+
- lib/schema_dot_org/schema_type.rb
|
92
99
|
- lib/schema_dot_org/search_action.rb
|
93
100
|
- lib/schema_dot_org/web_site.rb
|
94
|
-
- run-script
|
95
101
|
- schema_dot_org.gemspec
|
96
102
|
- test-script.rb
|
97
103
|
homepage: https://github.com/public-law/schema-dot-org
|
@@ -113,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
119
|
- !ruby/object:Gem::Version
|
114
120
|
version: '0'
|
115
121
|
requirements: []
|
116
|
-
rubygems_version: 3.4.
|
122
|
+
rubygems_version: 3.4.20
|
117
123
|
signing_key:
|
118
124
|
specification_version: 4
|
119
125
|
summary: JSON-LD generator for Schema.org vocabulary
|
data/run-script
DELETED