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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce2b289fea268f2a78df900f63d7d36736bcd0b08446eb7c18a21997cfb6ec8c
4
- data.tar.gz: e0a512dcf0d386376a5d227312e8fea47f95a014ed34b2b4ac9be8777f5ef1fe
3
+ metadata.gz: 9039661fa215dd59b1b15d4bb22bee6ae739ac5c030f5fe9a27942e1dd635ee2
4
+ data.tar.gz: dda30e0482e5b6433ac6f44a526a0f0d0e6105864542b415c44ecbc0a9bca22b
5
5
  SHA512:
6
- metadata.gz: 05ca9ceb7a3c95478f86c31d11df20f6661f6caee962170615ac35c178e4e2747f031a2675e97ea31881c50931775304caf9e684335633e8fcb5fdb527935243
7
- data.tar.gz: 31b3407922f8757746424c39d9571050dc063d24610a98762ee67d424af498314b97dbaf13a5c2f57ea9a23411c8f2509587bbf596fb6d956abce5c31e28b942
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.0)
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.1.6)
11
- activesupport (= 5.1.6)
12
- activesupport (5.1.6)
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.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
- [![Build Status](https://travis-ci.org/dogweather/schema-dot-org.svg?branch=master)](https://travis-ci.org/dogweather/schema-dot-org) [![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) [![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) that's correct,
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 cannot create invalid markup
69
+ ### You are prevented from creating invalid markup
69
70
 
70
- E.g., If you use the wrong type or try to set an unknown attribute, SchemaDotOrg will
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
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "schema_dot_org"
7
- spec.version = '1.5.0'
7
+ spec.version = '1.5.1'
8
8
  spec.authors = ["Robb Shecter"]
9
9
  spec.email = ["robb@public.law"]
10
10
 
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.0
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-04-05 00:00:00.000000000 Z
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