schema_dot_org 2.3.0 → 2.3.2

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: 6b0120204cb5305a8efc64697f917b6e3ada14584f172f61cf16537f71a7a7d9
4
- data.tar.gz: 496bde815fba8a32a86f9c1c6bf6ff810bd49b8c6f6d05a73682d2fb49ce68c8
3
+ metadata.gz: e2dfc9bdff909553c6fe2167179c1271676e9cee1d1422dd65eb26e0816d6dbd
4
+ data.tar.gz: 34a1e0e972e11ec617d7f4fc5c8317b15f63af7168b750ff75949ab0c1326aad
5
5
  SHA512:
6
- metadata.gz: 914246c1e12f48142d896d357f22607e383402e3ee5dc3bcf4087ecdbe9db93b8dbd37ce95d0b3622719de8990934aec37b4b05dd35deb916d6089b12dda28c4
7
- data.tar.gz: 4d9a8f13cbbe2a9519f47e2bb2dd09ffb69874dc403512a3f0cf3269efff6c9904fe05a19b571d039fbb6cdbdd12425c3c56c1ed8b1a4a76e430416ffa903e5b
6
+ metadata.gz: 52c0da39657a4ffba96c64eee10c489f6d0102196fd6b1e7e097a410f449c0fa5c16b0be535a804493bdf5e2671e45ae82c5cc6e1bb795e373844ed114bf594a
7
+ data.tar.gz: 3db26074e88294c49d4e50705d7a8b059668c741a7b3a0942d35779f107006034df4556c17fae605835ade306028e5a6b508267bd5053f64718f78fe1c3d29fe
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- schema_dot_org (2.3.0)
4
+ schema_dot_org (2.3.2)
5
5
  validated_object (~> 2.3)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,4 +1,4 @@
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
 
@@ -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
 
@@ -7,6 +7,7 @@ require 'validated_object'
7
7
  #
8
8
  module SchemaDotOrg
9
9
  class SchemaType < ValidatedObject::Base
10
+ EXCLUDED_INSTANCE_VARIABLES = %i[@context_for_validation @validation_context @errors].freeze
10
11
  ROOT_ATTR = { "@context" => "https://schema.org" }.freeze
11
12
  UNQUALIFIED_CLASS_NAME_REGEX = /([^:]+)$/
12
13
 
@@ -85,7 +86,7 @@ module SchemaDotOrg
85
86
 
86
87
  elsif is_schema_type?(value)
87
88
  value.to_json_struct
88
-
89
+
89
90
  else
90
91
  value
91
92
  end
@@ -98,7 +99,7 @@ module SchemaDotOrg
98
99
 
99
100
 
100
101
  def attrs
101
- instance_variables.reject{ |v| [:@validation_context, :@errors].include?(v) }
102
+ instance_variables.reject{ |v| EXCLUDED_INSTANCE_VARIABLES.include?(v) }
102
103
  end
103
104
 
104
105
 
@@ -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 = '>= 3.0'
9
9
  spec.name = 'schema_dot_org'
10
- spec.version = '2.3.0'
10
+ spec.version = '2.3.2'
11
11
  spec.authors = ['Robb Shecter']
12
12
  spec.email = ['robb@public.law']
13
13
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_dot_org
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robb Shecter