izi_json_ld 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/entities/person_entity.rb +4 -0
- data/app/entities/review_entity.rb +15 -1
- data/lib/izi_json_ld/version.rb +1 -1
- data/spec/dummy/log/test.log +1015 -23097
- data/spec/entities/person_entity_spec.rb +6 -0
- data/spec/entities/review_entity_spec.rb +43 -13
- metadata +2 -4
- data/spec/dummy/log/development.log +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 747a203ca8b1d17c682bc1f49efeb9782e47ac1f
|
4
|
+
data.tar.gz: da61b08b5f1317c8efb18317853e479b12643bfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f66a9419f1ff8db70f9bcfdb85919db60f83d4de518dc265e5feb97c75c7bd8393abc417ec0b473b8b47d210f12eb0957f5bc63da1163f8d3b07223ac5489dd
|
7
|
+
data.tar.gz: 395652ef61e587fc8df01433ff5ba004b5037bf005646ce4db965aff314b3b6364a67961e5dfac0ee12d9f94ed2ab3a0199c2b69699b4e0372407c955417ef76
|
@@ -3,9 +3,23 @@
|
|
3
3
|
class ReviewEntity < ApplicationEntity
|
4
4
|
type 'Review'
|
5
5
|
|
6
|
-
attribute? :author, ::IziJsonLd::Types::String.optional
|
6
|
+
# attribute? :author, ::IziJsonLd::Types::String.optional
|
7
|
+
attribute? :author, (::IziJsonLd::Types::Strict::String | ::PersonEntity | ::OrganizationEntity).optional
|
7
8
|
attribute? :reviewRating, RatingEntity.optional
|
8
9
|
attribute? :reviewBody, ::IziJsonLd::Types::String.optional
|
9
10
|
|
10
11
|
attribute? :datePublished, ::IziJsonLd::Types::DateTime.optional
|
12
|
+
|
13
|
+
def dump_attributes
|
14
|
+
attributes.except(:author).merge(author: safe_author)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def safe_author
|
20
|
+
return if author.blank?
|
21
|
+
return author unless author.is_a? String
|
22
|
+
|
23
|
+
PersonEntity.new(person_name: author)
|
24
|
+
end
|
11
25
|
end
|
data/lib/izi_json_ld/version.rb
CHANGED