schema_dot_org 2.2.3 → 2.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e190c183425efbb7808c9e18f253cd377b91a4ce927d8f401f02158d6d704cf
4
- data.tar.gz: 5e01217b962ed0ec450bda73923e2fbdff9ec4baeee2433c96cdc27c53e08bbf
3
+ metadata.gz: 2a529f1af595e1f98f68b87b85bca0f8bd9aea55b0a05799cdad60b2a23afb0c
4
+ data.tar.gz: 1fafd9ec704f895bb8e3e8e4bb2fb3935081cab7587d15d441a2b31eba6ca090
5
5
  SHA512:
6
- metadata.gz: 36a893438da0d2731fba7a14a5d2a04b4a406688b5be906c6080ad30b2bb42865553943451fcb25e22a737e2e5478ac95a72f8fadf6447f28791c8e0ff89d2d9
7
- data.tar.gz: 2b1feab097655a4efd511838774f1f4c5224c0767cf78aa970f7feb7b57bd6e7a74bf7327aee2eecd2578d38aee68eb494c5ea5b6ff6131651c82c429f27cb70
6
+ metadata.gz: 43bc701abbb0e01a88792dee858c48586fa58cd5e8016e4989a939dd31dd1287edb93c3b4d937791f25b9011cc1eac6e2794ef03d26c181f99aa3af9b0ce3fe6
7
+ data.tar.gz: 5c044fc3ca56cf5cea5d8cab39a6afc125ffc1a0ffe12e6224ffa9b81365bd4a8af7bd963653c3e61a019d7e2b0adf78e93ccdbd6e963304402f8eab8fa405a6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- schema_dot_org (2.2.3)
4
+ schema_dot_org (2.3.1)
5
5
  validated_object (~> 2.3)
6
6
 
7
7
  GEM
@@ -53,7 +53,7 @@ GEM
53
53
  sorbet-runtime (>= 0.5.5890)
54
54
 
55
55
  PLATFORMS
56
- arm64-darwin-22
56
+ arm64-darwin-24
57
57
 
58
58
  DEPENDENCIES
59
59
  bundler (~> 2.4)
data/README.md CHANGED
@@ -1,11 +1,11 @@
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)
1
+ [![Gem Version](https://badge.fury.io/rb/schema_dot_org.svg)](https://badge.fury.io/rb/schema_dot_org)
2
2
 
3
3
  # SchemaDotOrg
4
4
 
5
5
  Easily create [Structured Data](https://developers.google.com/search/docs/guides/intro-structured-data) with **correct syntax and semantics**.
6
6
  Good structured data [helps enhance a website's search result appearance](https://developers.google.com/search/docs/guides/enhance-site):
7
7
 
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 . . .
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
 
10
10
  ## Usage
11
11
 
@@ -81,7 +81,7 @@ Etc., etc.
81
81
 
82
82
  ### You are prevented from creating invalid markup
83
83
 
84
- If your page loads, you know your markup is good.
84
+ I make mistakes. So I wanted to know that if my page loads, the markup is good.
85
85
 
86
86
  If you use the wrong type or try to set an unknown attribute, SchemaDotOrg will
87
87
  refuse to create the incorrect JSON-LD. Instead, you'll get a message explaining
@@ -101,13 +101,34 @@ Place.new(
101
101
  In my experience, I never get errors from the lib. I code it once, it works, and then
102
102
  I move on to other things.
103
103
 
104
+ > [!NOTE]
104
105
  > This automatic validation comes from my [ValidatedObject gem](https://github.com/dogweather/validated_object), which in turn,
105
106
  > is a thin wrapper around ActiveRecord::Validations. So there's nothing magical going on here.
106
107
 
107
108
  ## Supported Schema.org Types
108
109
 
109
- AggregateOffer, ContactPoint, ItemList, ListItem, Offer, Organization, Person, Place,
110
- Product, SearchAction, and WebSite.
110
+ See each type's RSpec for an example of how to use it.
111
+
112
+ | NAME | Schema.org Page | RSpec Spec | Source Code |
113
+ | ---------------------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
114
+ | AggregateOffer | [Schema.org](https://schema.org/AggregateOffer) | | [Source](https://github.com/dogweather/schema-dot-org/blob/master/lib/schema_dot_org/aggregate_offer.rb) |
115
+ | CollegeOrUniversity | [Schema.org](https://schema.org/CollegeOrUniversity) | [RSpec](https://github.com/dogweather/schema-dot-org/blob/master/spec/schema_dot_org/college_or_university_spec.rb) | [Source](https://github.com/dogweather/schema-dot-org/blob/master/lib/schema_dot_org/college_or_university.rb) |
116
+ | Comment | [Schema.org](https://schema.org/Comment) | [RSpec](https://github.com/dogweather/schema-dot-org/blob/master/spec/schema_dot_org/comment_spec.rb) | [Source](https://github.com/dogweather/schema-dot-org/blob/master/lib/schema_dot_org/comment.rb) |
117
+ | ContactPoint | [Schema.org](https://schema.org/ContactPoint) | | [Source](https://github.com/dogweather/schema-dot-org/blob/master/lib/schema_dot_org/contact_point.rb) |
118
+ | DiscussionForumPosting | [Schema.org](https://schema.org/DiscussionForumPosting) | [RSpec](https://github.com/dogweather/schema-dot-org/blob/master/spec/schema_dot_org/discussion_forum_posting_spec.rb) | [Source](https://github.com/dogweather/schema-dot-org/blob/master/lib/schema_dot_org/discussion_forum_posting.rb) |
119
+ | InteractionCounter | [Schema.org](https://schema.org/InteractionCounter) | [RSpec](https://github.com/dogweather/schema-dot-org/blob/master/spec/schema_dot_org/interaction_counter_spec.rb) | [Source](https://github.com/dogweather/schema-dot-org/blob/master/lib/schema_dot_org/interaction_counter.rb) |
120
+ | ItemList | [Schema.org](https://schema.org/ItemList) | [RSpec](https://github.com/dogweather/schema-dot-org/blob/master/spec/schema_dot_org/item_list_spec.rb) | [Source](https://github.com/dogweather/schema-dot-org/blob/master/lib/schema_dot_org/item_list.rb) |
121
+ | Language | [Schema.org](https://schema.org/Language) | [RSpec](https://github.com/dogweather/schema-dot-org/blob/master/spec/schema_dot_org/language_spec.rb) | [Source](https://github.com/dogweather/schema-dot-org/blob/master/lib/schema_dot_org/language.rb) |
122
+ | ListItem | [Schema.org](https://schema.org/ListItem) | | [Source](https://github.com/dogweather/schema-dot-org/blob/master/lib/schema_dot_org/list_item.rb) |
123
+ | Offer | [Schema.org](https://schema.org/Offer) | | [Source](https://github.com/dogweather/schema-dot-org/blob/master/lib/schema_dot_org/offer.rb) |
124
+ | Organization | [Schema.org](https://schema.org/Organization) | [RSpec](https://github.com/dogweather/schema-dot-org/blob/master/spec/schema_dot_org/organization_spec.rb) | [Source](https://github.com/dogweather/schema-dot-org/blob/master/lib/schema_dot_org/organization.rb) |
125
+ | Person | [Schema.org](https://schema.org/Person) | [RSpec](https://github.com/dogweather/schema-dot-org/blob/master/spec/schema_dot_org/person_spec.rb) | [Source](https://github.com/dogweather/schema-dot-org/blob/master/lib/schema_dot_org/person.rb) |
126
+ | Place | [Schema.org](https://schema.org/Place) | [RSpec](https://github.com/dogweather/schema-dot-org/blob/master/spec/schema_dot_org/place_spec.rb) | [Source](https://github.com/dogweather/schema-dot-org/blob/master/lib/schema_dot_org/place.rb) |
127
+ | Product | [Schema.org](https://schema.org/Product) | [RSpec](https://github.com/dogweather/schema-dot-org/blob/master/spec/schema_dot_org/product_spec.rb) | [Source](https://github.com/dogweather/schema-dot-org/blob/master/lib/schema_dot_org/product.rb) |
128
+ | SearchAction | [Schema.org](https://schema.org/SearchAction) | [RSpec](https://github.com/dogweather/schema-dot-org/blob/master/spec/schema_dot_org/search_action_spec.rb) | [Source](https://github.com/dogweather/schema-dot-org/blob/master/lib/schema_dot_org/search_action.rb) |
129
+ | WebSite | [Schema.org](https://schema.org/WebSite) | [RSpec](https://github.com/dogweather/schema-dot-org/blob/master/spec/schema_dot_org/web_site_spec.rb) | [Source](https://github.com/dogweather/schema-dot-org/blob/master/lib/schema_dot_org/web_site.rb) |
130
+
131
+ ## Examples
111
132
 
112
133
  Here are a few examples. [The source code for these is extremely easy to read.](https://github.com/dogweather/schema-dot-org/tree/master/lib/schema_dot_org) Check them out to see all the available attributes.
113
134
 
@@ -0,0 +1,24 @@
1
+
2
+ # frozen_string_literal: true
3
+
4
+ require 'date'
5
+ require_relative 'person'
6
+
7
+ #
8
+ # Model the Schema.org `Thing > CreativeWork > Comment`.
9
+ # See https://schema.org/Comment
10
+ #
11
+ module SchemaDotOrg
12
+ class Comment < SchemaType
13
+ validated_attr :author, type: Person, presence: true
14
+ validated_attr :datePublished, type: Date, presence: true
15
+
16
+ validated_attr :comment, type: Array, allow_nil: true
17
+ validated_attr :creativeWorkStatus, type: String, allow_nil: true
18
+ validated_attr :image, type: Array, allow_nil: true
19
+ validated_attr :inLanguage, type: Array, allow_nil: true
20
+ validated_attr :interactionStatistic, type: Array, allow_nil: true
21
+ validated_attr :text, type: String, allow_nil: true
22
+ validated_attr :url, type: String, allow_nil: true
23
+ end
24
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'date'
4
+ require_relative 'person'
5
+
6
+ #
7
+ # Model the Schema.org `Thing > CreativeWork > Article > SocialMediaPosting > DiscussionForumPosting`.
8
+ # See https://schema.org/DiscussionForumPosting
9
+ #
10
+ module SchemaDotOrg
11
+ class DiscussionForumPosting < SchemaType
12
+ # TODO: Allow for type Person or Organization
13
+ validated_attr :author, type: Person, presence: true
14
+ # TODO: Allow for type Date or DateTime
15
+ validated_attr :datePublished, type: Date, presence: true
16
+
17
+ validated_attr :comment, type: Array, allow_nil: true
18
+ validated_attr :commentCount, type: Integer, allow_nil: true
19
+ validated_attr :headline, type: String, allow_nil: true
20
+ validated_attr :image, type: Array, allow_nil: true
21
+ validated_attr :inLanguage, type: Array, allow_nil: true
22
+ validated_attr :interactionStatistic, type: Array, allow_nil: true
23
+ validated_attr :mainEntityOfPage, type: String, allow_nil: true
24
+ validated_attr :text, type: String, allow_nil: true
25
+ validated_attr :url, type: String, allow_nil: true
26
+ end
27
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Model the Schema.org `Thing > Intangible > StructuredValue > InteractionCounter`.
5
+ # See https://schema.org/InteractionCounter
6
+ #
7
+ module SchemaDotOrg
8
+ class InteractionCounter < SchemaType
9
+ validated_attr :userInteractionCount, type: Integer, presence: true
10
+ validated_attr :interactionType, type: String, presence: true
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Model the Schema.org `Thing > Intangible > Language`.
5
+ # See https://schema.org/Language
6
+ #
7
+ module SchemaDotOrg
8
+ class Language < SchemaType
9
+ validated_attr :alternateName, type: String, allow_nil: true
10
+ validated_attr :name, type: String, presence: true
11
+ end
12
+ end
@@ -116,8 +116,12 @@ end
116
116
 
117
117
  require 'schema_dot_org/aggregate_offer'
118
118
  require 'schema_dot_org/college_or_university'
119
+ require 'schema_dot_org/comment'
119
120
  require 'schema_dot_org/contact_point'
121
+ require 'schema_dot_org/discussion_forum_posting'
122
+ require 'schema_dot_org/interaction_counter'
120
123
  require 'schema_dot_org/item_list'
124
+ require 'schema_dot_org/language'
121
125
  require 'schema_dot_org/list_item'
122
126
  require 'schema_dot_org/organization'
123
127
  require 'schema_dot_org/person'
@@ -5,9 +5,9 @@ lib = File.expand_path('lib', __dir__)
5
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
6
 
7
7
  Gem::Specification.new do |spec|
8
- spec.required_ruby_version = '>= 2.6'
8
+ spec.required_ruby_version = '>= 3.0'
9
9
  spec.name = 'schema_dot_org'
10
- spec.version = '2.2.3'
10
+ spec.version = '2.3.1'
11
11
  spec.authors = ['Robb Shecter']
12
12
  spec.email = ['robb@public.law']
13
13
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_dot_org
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robb Shecter
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2023-10-15 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: validated_object
@@ -75,7 +74,6 @@ extra_rdoc_files: []
75
74
  files:
76
75
  - ".gitignore"
77
76
  - ".rspec"
78
- - ".ruby-version"
79
77
  - ".travis.yml"
80
78
  - Gemfile
81
79
  - Gemfile.lock
@@ -88,8 +86,12 @@ files:
88
86
  - lib/schema_dot_org.rb
89
87
  - lib/schema_dot_org/aggregate_offer.rb
90
88
  - lib/schema_dot_org/college_or_university.rb
89
+ - lib/schema_dot_org/comment.rb
91
90
  - lib/schema_dot_org/contact_point.rb
91
+ - lib/schema_dot_org/discussion_forum_posting.rb
92
+ - lib/schema_dot_org/interaction_counter.rb
92
93
  - lib/schema_dot_org/item_list.rb
94
+ - lib/schema_dot_org/language.rb
93
95
  - lib/schema_dot_org/list_item.rb
94
96
  - lib/schema_dot_org/offer.rb
95
97
  - lib/schema_dot_org/organization.rb
@@ -104,7 +106,6 @@ homepage: https://github.com/public-law/schema-dot-org
104
106
  licenses:
105
107
  - MIT
106
108
  metadata: {}
107
- post_install_message:
108
109
  rdoc_options: []
109
110
  require_paths:
110
111
  - lib
@@ -112,15 +113,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
113
  requirements:
113
114
  - - ">="
114
115
  - !ruby/object:Gem::Version
115
- version: '2.6'
116
+ version: '3.0'
116
117
  required_rubygems_version: !ruby/object:Gem::Requirement
117
118
  requirements:
118
119
  - - ">="
119
120
  - !ruby/object:Gem::Version
120
121
  version: '0'
121
122
  requirements: []
122
- rubygems_version: 3.4.20
123
- signing_key:
123
+ rubygems_version: 3.6.9
124
124
  specification_version: 4
125
125
  summary: JSON-LD generator for Schema.org vocabulary
126
126
  test_files: []
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.6.6