izi_json_ld 1.0.1 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/entities/aggregate_rating_entity.rb +3 -1
- data/app/entities/answer_entity.rb +7 -0
- data/app/entities/application_entity.rb +54 -7
- data/app/entities/article_entity.rb +16 -0
- data/app/entities/breadcrumb_list_entity.rb +7 -0
- data/app/entities/faq_page_entity.rb +8 -0
- data/app/entities/image_object_entity.rb +6 -0
- data/app/entities/list_item_entity.rb +9 -0
- data/app/entities/offer_entity.rb +2 -1
- data/app/entities/organization_entity.rb +10 -0
- data/app/entities/person_entity.rb +14 -0
- data/app/entities/product_entity.rb +2 -2
- data/app/entities/question_entity.rb +19 -0
- data/app/entities/rating_entity.rb +1 -1
- data/app/entities/review_entity.rb +3 -3
- data/app/entities/web_page_entity.rb +11 -0
- data/lib/izi_json_ld/types.rb +3 -0
- data/lib/izi_json_ld/types/date_time.rb +11 -0
- data/lib/izi_json_ld/types/one_or_more.rb +13 -0
- data/lib/izi_json_ld/version.rb +1 -1
- data/spec/dummy/config/application.rb +5 -1
- data/spec/dummy/config/environments/test.rb +9 -7
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +16 -0
- data/spec/dummy/log/test.log +17813 -0
- data/spec/entities/aggregate_rating_entity_spec.rb +2 -1
- data/spec/entities/article_entity_spec.rb +113 -0
- data/spec/entities/breadcrumb_list_entity_spec.rb +55 -0
- data/spec/entities/faq_page_entity_spec.rb +75 -0
- data/spec/entities/product_entity_spec.rb +52 -0
- data/spec/rails_helper.rb +1 -17
- metadata +24 -24
- data/app/entities/service_entity.rb +0 -10
- data/spec/dummy/Gemfile +0 -14
- data/spec/dummy/Gemfile.lock +0 -229
- data/spec/dummy/app/models/application_record.rb +0 -3
- data/spec/dummy/bin/_guard-core +0 -29
- data/spec/dummy/bin/guard +0 -29
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/bin/rspec +0 -29
- data/spec/dummy/bin/setup +0 -33
- data/spec/entities/service_entity_spec.rb +0 -62
@@ -1,10 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class ServiceEntity < ApplicationEntity
|
4
|
-
extra '@context', 'http://www.schema.org'
|
5
|
-
extra '@type', 'Service'
|
6
|
-
|
7
|
-
attribute :name, ::IziJsonLd::Types::String
|
8
|
-
attribute? :review, ::ReviewEntity.optional
|
9
|
-
attribute? :reviews, ::IziJsonLd::Types::Array.of(::ReviewEntity).optional
|
10
|
-
end
|
data/spec/dummy/Gemfile
DELETED
data/spec/dummy/Gemfile.lock
DELETED
@@ -1,229 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
actioncable (6.1.3)
|
5
|
-
actionpack (= 6.1.3)
|
6
|
-
activesupport (= 6.1.3)
|
7
|
-
nio4r (~> 2.0)
|
8
|
-
websocket-driver (>= 0.6.1)
|
9
|
-
actionmailbox (6.1.3)
|
10
|
-
actionpack (= 6.1.3)
|
11
|
-
activejob (= 6.1.3)
|
12
|
-
activerecord (= 6.1.3)
|
13
|
-
activestorage (= 6.1.3)
|
14
|
-
activesupport (= 6.1.3)
|
15
|
-
mail (>= 2.7.1)
|
16
|
-
actionmailer (6.1.3)
|
17
|
-
actionpack (= 6.1.3)
|
18
|
-
actionview (= 6.1.3)
|
19
|
-
activejob (= 6.1.3)
|
20
|
-
activesupport (= 6.1.3)
|
21
|
-
mail (~> 2.5, >= 2.5.4)
|
22
|
-
rails-dom-testing (~> 2.0)
|
23
|
-
actionpack (6.1.3)
|
24
|
-
actionview (= 6.1.3)
|
25
|
-
activesupport (= 6.1.3)
|
26
|
-
rack (~> 2.0, >= 2.0.9)
|
27
|
-
rack-test (>= 0.6.3)
|
28
|
-
rails-dom-testing (~> 2.0)
|
29
|
-
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
30
|
-
actiontext (6.1.3)
|
31
|
-
actionpack (= 6.1.3)
|
32
|
-
activerecord (= 6.1.3)
|
33
|
-
activestorage (= 6.1.3)
|
34
|
-
activesupport (= 6.1.3)
|
35
|
-
nokogiri (>= 1.8.5)
|
36
|
-
actionview (6.1.3)
|
37
|
-
activesupport (= 6.1.3)
|
38
|
-
builder (~> 3.1)
|
39
|
-
erubi (~> 1.4)
|
40
|
-
rails-dom-testing (~> 2.0)
|
41
|
-
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
42
|
-
activejob (6.1.3)
|
43
|
-
activesupport (= 6.1.3)
|
44
|
-
globalid (>= 0.3.6)
|
45
|
-
activemodel (6.1.3)
|
46
|
-
activesupport (= 6.1.3)
|
47
|
-
activerecord (6.1.3)
|
48
|
-
activemodel (= 6.1.3)
|
49
|
-
activesupport (= 6.1.3)
|
50
|
-
activestorage (6.1.3)
|
51
|
-
actionpack (= 6.1.3)
|
52
|
-
activejob (= 6.1.3)
|
53
|
-
activerecord (= 6.1.3)
|
54
|
-
activesupport (= 6.1.3)
|
55
|
-
marcel (~> 0.3.1)
|
56
|
-
mimemagic (~> 0.3.2)
|
57
|
-
activesupport (6.1.3)
|
58
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
59
|
-
i18n (>= 1.6, < 2)
|
60
|
-
minitest (>= 5.1)
|
61
|
-
tzinfo (~> 2.0)
|
62
|
-
zeitwerk (~> 2.3)
|
63
|
-
builder (3.2.4)
|
64
|
-
byebug (11.1.3)
|
65
|
-
coderay (1.1.3)
|
66
|
-
concurrent-ruby (1.1.8)
|
67
|
-
crass (1.0.6)
|
68
|
-
diff-lcs (1.4.4)
|
69
|
-
dry-configurable (0.12.1)
|
70
|
-
concurrent-ruby (~> 1.0)
|
71
|
-
dry-core (~> 0.5, >= 0.5.0)
|
72
|
-
dry-container (0.7.2)
|
73
|
-
concurrent-ruby (~> 1.0)
|
74
|
-
dry-configurable (~> 0.1, >= 0.1.3)
|
75
|
-
dry-core (0.5.0)
|
76
|
-
concurrent-ruby (~> 1.0)
|
77
|
-
dry-inflector (0.2.0)
|
78
|
-
dry-logic (1.1.0)
|
79
|
-
concurrent-ruby (~> 1.0)
|
80
|
-
dry-core (~> 0.5, >= 0.5)
|
81
|
-
dry-struct (1.4.0)
|
82
|
-
dry-core (~> 0.5, >= 0.5)
|
83
|
-
dry-types (~> 1.5)
|
84
|
-
ice_nine (~> 0.11)
|
85
|
-
dry-types (1.5.1)
|
86
|
-
concurrent-ruby (~> 1.0)
|
87
|
-
dry-container (~> 0.3)
|
88
|
-
dry-core (~> 0.5, >= 0.5)
|
89
|
-
dry-inflector (~> 0.1, >= 0.1.2)
|
90
|
-
dry-logic (~> 1.0, >= 1.0.2)
|
91
|
-
erubi (1.10.0)
|
92
|
-
faker (2.17.0)
|
93
|
-
i18n (>= 1.6, < 2)
|
94
|
-
ffi (1.15.0)
|
95
|
-
formatador (0.2.5)
|
96
|
-
globalid (0.4.2)
|
97
|
-
activesupport (>= 4.2.0)
|
98
|
-
guard (2.16.2)
|
99
|
-
formatador (>= 0.2.4)
|
100
|
-
listen (>= 2.7, < 4.0)
|
101
|
-
lumberjack (>= 1.0.12, < 2.0)
|
102
|
-
nenv (~> 0.1)
|
103
|
-
notiffany (~> 0.0)
|
104
|
-
pry (>= 0.9.12)
|
105
|
-
shellany (~> 0.0)
|
106
|
-
thor (>= 0.18.1)
|
107
|
-
guard-compat (1.2.1)
|
108
|
-
guard-rspec (4.7.3)
|
109
|
-
guard (~> 2.1)
|
110
|
-
guard-compat (~> 1.1)
|
111
|
-
rspec (>= 2.99.0, < 4.0)
|
112
|
-
i18n (1.8.9)
|
113
|
-
concurrent-ruby (~> 1.0)
|
114
|
-
ice_nine (0.11.2)
|
115
|
-
listen (3.4.1)
|
116
|
-
rb-fsevent (~> 0.10, >= 0.10.3)
|
117
|
-
rb-inotify (~> 0.9, >= 0.9.10)
|
118
|
-
loofah (2.9.0)
|
119
|
-
crass (~> 1.0.2)
|
120
|
-
nokogiri (>= 1.5.9)
|
121
|
-
lumberjack (1.2.8)
|
122
|
-
mail (2.7.1)
|
123
|
-
mini_mime (>= 0.1.1)
|
124
|
-
marcel (0.3.3)
|
125
|
-
mimemagic (~> 0.3.2)
|
126
|
-
method_source (1.0.0)
|
127
|
-
mimemagic (0.3.5)
|
128
|
-
mini_mime (1.0.2)
|
129
|
-
mini_portile2 (2.5.0)
|
130
|
-
minitest (5.14.4)
|
131
|
-
nenv (0.3.0)
|
132
|
-
nio4r (2.5.7)
|
133
|
-
nokogiri (1.11.2)
|
134
|
-
mini_portile2 (~> 2.5.0)
|
135
|
-
racc (~> 1.4)
|
136
|
-
notiffany (0.1.3)
|
137
|
-
nenv (~> 0.1)
|
138
|
-
shellany (~> 0.0)
|
139
|
-
pry (0.14.0)
|
140
|
-
coderay (~> 1.1)
|
141
|
-
method_source (~> 1.0)
|
142
|
-
racc (1.5.2)
|
143
|
-
rack (2.2.3)
|
144
|
-
rack-test (1.1.0)
|
145
|
-
rack (>= 1.0, < 3)
|
146
|
-
rails (6.1.3)
|
147
|
-
actioncable (= 6.1.3)
|
148
|
-
actionmailbox (= 6.1.3)
|
149
|
-
actionmailer (= 6.1.3)
|
150
|
-
actionpack (= 6.1.3)
|
151
|
-
actiontext (= 6.1.3)
|
152
|
-
actionview (= 6.1.3)
|
153
|
-
activejob (= 6.1.3)
|
154
|
-
activemodel (= 6.1.3)
|
155
|
-
activerecord (= 6.1.3)
|
156
|
-
activestorage (= 6.1.3)
|
157
|
-
activesupport (= 6.1.3)
|
158
|
-
bundler (>= 1.15.0)
|
159
|
-
railties (= 6.1.3)
|
160
|
-
sprockets-rails (>= 2.0.0)
|
161
|
-
rails-dom-testing (2.0.3)
|
162
|
-
activesupport (>= 4.2.0)
|
163
|
-
nokogiri (>= 1.6)
|
164
|
-
rails-html-sanitizer (1.3.0)
|
165
|
-
loofah (~> 2.3)
|
166
|
-
railties (6.1.3)
|
167
|
-
actionpack (= 6.1.3)
|
168
|
-
activesupport (= 6.1.3)
|
169
|
-
method_source
|
170
|
-
rake (>= 0.8.7)
|
171
|
-
thor (~> 1.0)
|
172
|
-
rake (13.0.3)
|
173
|
-
rb-fsevent (0.10.4)
|
174
|
-
rb-inotify (0.10.1)
|
175
|
-
ffi (~> 1.0)
|
176
|
-
rspec (3.10.0)
|
177
|
-
rspec-core (~> 3.10.0)
|
178
|
-
rspec-expectations (~> 3.10.0)
|
179
|
-
rspec-mocks (~> 3.10.0)
|
180
|
-
rspec-core (3.10.1)
|
181
|
-
rspec-support (~> 3.10.0)
|
182
|
-
rspec-expectations (3.10.1)
|
183
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
184
|
-
rspec-support (~> 3.10.0)
|
185
|
-
rspec-mocks (3.10.2)
|
186
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
187
|
-
rspec-support (~> 3.10.0)
|
188
|
-
rspec-rails (5.0.0)
|
189
|
-
actionpack (>= 5.2)
|
190
|
-
activesupport (>= 5.2)
|
191
|
-
railties (>= 5.2)
|
192
|
-
rspec-core (~> 3.10)
|
193
|
-
rspec-expectations (~> 3.10)
|
194
|
-
rspec-mocks (~> 3.10)
|
195
|
-
rspec-support (~> 3.10)
|
196
|
-
rspec-support (3.10.2)
|
197
|
-
shellany (0.0.1)
|
198
|
-
sprockets (4.0.2)
|
199
|
-
concurrent-ruby (~> 1.0)
|
200
|
-
rack (> 1, < 3)
|
201
|
-
sprockets-rails (3.2.2)
|
202
|
-
actionpack (>= 4.0)
|
203
|
-
activesupport (>= 4.0)
|
204
|
-
sprockets (>= 3.0.0)
|
205
|
-
sqlite3 (1.4.2)
|
206
|
-
thor (1.1.0)
|
207
|
-
tzinfo (2.0.4)
|
208
|
-
concurrent-ruby (~> 1.0)
|
209
|
-
websocket-driver (0.7.3)
|
210
|
-
websocket-extensions (>= 0.1.0)
|
211
|
-
websocket-extensions (0.1.5)
|
212
|
-
zeitwerk (2.4.2)
|
213
|
-
|
214
|
-
PLATFORMS
|
215
|
-
ruby
|
216
|
-
|
217
|
-
DEPENDENCIES
|
218
|
-
byebug
|
219
|
-
dry-struct
|
220
|
-
faker
|
221
|
-
guard
|
222
|
-
guard-rspec
|
223
|
-
rails
|
224
|
-
rspec
|
225
|
-
rspec-rails
|
226
|
-
sqlite3
|
227
|
-
|
228
|
-
BUNDLED WITH
|
229
|
-
2.1.4
|
data/spec/dummy/bin/_guard-core
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application '_guard-core' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
|
-
require "pathname"
|
12
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
-
Pathname.new(__FILE__).realpath)
|
14
|
-
|
15
|
-
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
-
|
17
|
-
if File.file?(bundle_binstub)
|
18
|
-
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
-
load(bundle_binstub)
|
20
|
-
else
|
21
|
-
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
-
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
require "rubygems"
|
27
|
-
require "bundler/setup"
|
28
|
-
|
29
|
-
load Gem.bin_path("guard", "_guard-core")
|
data/spec/dummy/bin/guard
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application 'guard' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
|
-
require "pathname"
|
12
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
-
Pathname.new(__FILE__).realpath)
|
14
|
-
|
15
|
-
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
-
|
17
|
-
if File.file?(bundle_binstub)
|
18
|
-
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
-
load(bundle_binstub)
|
20
|
-
else
|
21
|
-
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
-
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
require "rubygems"
|
27
|
-
require "bundler/setup"
|
28
|
-
|
29
|
-
load Gem.bin_path("guard", "guard")
|
data/spec/dummy/bin/rails
DELETED
data/spec/dummy/bin/rake
DELETED
data/spec/dummy/bin/rspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application 'rspec' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
|
-
require "pathname"
|
12
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
-
Pathname.new(__FILE__).realpath)
|
14
|
-
|
15
|
-
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
-
|
17
|
-
if File.file?(bundle_binstub)
|
18
|
-
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
-
load(bundle_binstub)
|
20
|
-
else
|
21
|
-
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
-
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
require "rubygems"
|
27
|
-
require "bundler/setup"
|
28
|
-
|
29
|
-
load Gem.bin_path("rspec-core", "rspec")
|
data/spec/dummy/bin/setup
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require "fileutils"
|
3
|
-
|
4
|
-
# path to your application root.
|
5
|
-
APP_ROOT = File.expand_path('..', __dir__)
|
6
|
-
|
7
|
-
def system!(*args)
|
8
|
-
system(*args) || abort("\n== Command #{args} failed ==")
|
9
|
-
end
|
10
|
-
|
11
|
-
FileUtils.chdir APP_ROOT do
|
12
|
-
# This script is a way to set up or update your development environment automatically.
|
13
|
-
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
14
|
-
# Add necessary setup steps to this file.
|
15
|
-
|
16
|
-
puts '== Installing dependencies =='
|
17
|
-
system! 'gem install bundler --conservative'
|
18
|
-
system('bundle check') || system!('bundle install')
|
19
|
-
|
20
|
-
# puts "\n== Copying sample files =="
|
21
|
-
# unless File.exist?('config/database.yml')
|
22
|
-
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
|
23
|
-
# end
|
24
|
-
|
25
|
-
puts "\n== Preparing database =="
|
26
|
-
system! 'bin/rails db:prepare'
|
27
|
-
|
28
|
-
puts "\n== Removing old logs and tempfiles =="
|
29
|
-
system! 'bin/rails log:clear tmp:clear'
|
30
|
-
|
31
|
-
puts "\n== Restarting application server =="
|
32
|
-
system! 'bin/rails restart'
|
33
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe ServiceEntity do
|
4
|
-
let(:item) { described_class.new(name: 'Test Name') }
|
5
|
-
|
6
|
-
it 'should be searializable as hash' do
|
7
|
-
expect(item.as_json).to be_present
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'should be searializable as string' do
|
11
|
-
expect(item.to_json).to be_present
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should return html_safe string' do
|
15
|
-
expect(item.to_json).to be_html_safe
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should have @type' do
|
19
|
-
expect(item.as_json).to have_key '@type'
|
20
|
-
expect(item.as_json['@type']).to be_present
|
21
|
-
expect(item.as_json['@type']).to eq 'Service'
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'should have @context' do
|
25
|
-
expect(item.as_json).to have_key '@context'
|
26
|
-
expect(item.as_json['@context']).to be_present
|
27
|
-
expect(item.as_json['@context']).to include 'schema.org'
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'with review' do
|
31
|
-
let(:item) { described_class.new(name: 'Test', review: { author: 'test', reviewRating: { ratingValue: 4 } }) }
|
32
|
-
|
33
|
-
it 'should have review' do
|
34
|
-
expect(item.as_json).to have_key 'review'
|
35
|
-
expect(item.as_json['review']).to be_present
|
36
|
-
expect(item.as_json.dig('review', 'author')).to eq 'test'
|
37
|
-
expect(item.as_json.dig('review', 'reviewRating', 'ratingValue')).to eq 4
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
context 'with reviews' do
|
42
|
-
let(:item) do
|
43
|
-
described_class.new(
|
44
|
-
name: 'Test',
|
45
|
-
reviews: [
|
46
|
-
{ author: 'test1', reviewRating: { ratingValue: 2 } },
|
47
|
-
{ author: 'test2', reviewRating: { ratingValue: 3 } },
|
48
|
-
{ author: 'test3', reviewRating: { ratingValue: 4 } }
|
49
|
-
]
|
50
|
-
)
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'should have review' do
|
54
|
-
expect(item.as_json).not_to have_key 'review'
|
55
|
-
expect(item.as_json).to have_key 'reviews'
|
56
|
-
expect(item.as_json['reviews']).to be_present
|
57
|
-
expect(item.as_json['reviews'].size).to eq 3
|
58
|
-
expect(item.as_json.dig('reviews', 0, 'author')).to eq 'test1'
|
59
|
-
expect(item.as_json.dig('reviews', 0, 'reviewRating', 'ratingValue')).to eq 2
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|