izi_json_ld 1.0.6 → 1.0.10
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 +7 -1
- data/app/entities/question_entity.rb +1 -1
- data/app/entities/review_entity.rb +25 -1
- data/lib/izi_json_ld/version.rb +1 -1
- data/spec/dummy/log/test.log +1108 -18174
- data/spec/entities/faq_page_entity_spec.rb +13 -0
- data/spec/entities/person_entity_spec.rb +42 -0
- data/spec/entities/review_entity_spec.rb +69 -13
- metadata +4 -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: 8460fc684cdf425df5ab3eb1c37cf3cec4fd94ce
|
4
|
+
data.tar.gz: ebe42ecc6dd75499a3d4c7d64011652ecd2a44be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ce55344a93dc3e3ddfa65dc5387d48e5fc8af0f65ab072378de5764e37f7b9c52d966c18931a103631e919a1d984c3bbe67065a223fbad0ed4f9b9cb224d6d7
|
7
|
+
data.tar.gz: 8175939a4405a80fe70cad66c8e7e25b4007483123cf76027656eb752389fb989691abb039d22956ce0d68694e4e739759c1263bdf0ff4cc8db120c1c1fc1638
|
@@ -5,10 +5,16 @@ class PersonEntity < ApplicationEntity
|
|
5
5
|
attribute :person_name, ::IziJsonLd::Types::String
|
6
6
|
attribute? :email, ::IziJsonLd::Types::String.optional
|
7
7
|
attribute? :image, ::IziJsonLd::Types::String.optional
|
8
|
-
attribute? :sameAs, ::IziJsonLd::Types::String.optional
|
8
|
+
attribute? :sameAs, ::IziJsonLd::Types::OneOrMore[::IziJsonLd::Types::String].optional
|
9
9
|
attribute? :worksFor, ::OrganizationEntity
|
10
|
+
attribute? :url, ::IziJsonLd::Types::String.optional
|
11
|
+
attribute? :jobTitle, ::IziJsonLd::Types::String.optional
|
10
12
|
|
11
13
|
def dump_attributes
|
12
14
|
attributes.except(:person_name).merge(name: person_name)
|
13
15
|
end
|
16
|
+
|
17
|
+
def name
|
18
|
+
person_name
|
19
|
+
end
|
14
20
|
end
|
@@ -8,7 +8,7 @@ class QuestionEntity < ApplicationEntity
|
|
8
8
|
attribute? :answer, ::IziJsonLd::Types::String
|
9
9
|
|
10
10
|
def dump_attributes
|
11
|
-
attributes.except(:answer).merge(acceptedAnswer: safe_answer.dump)
|
11
|
+
attributes.except(:answer).merge(acceptedAnswer: safe_answer.dump(self))
|
12
12
|
end
|
13
13
|
|
14
14
|
private
|
@@ -3,9 +3,33 @@
|
|
3
3
|
class ReviewEntity < ApplicationEntity
|
4
4
|
type 'Review'
|
5
5
|
|
6
|
-
attribute? :author, ::IziJsonLd::Types::String.optional
|
6
|
+
attribute? :author, (::IziJsonLd::Types::Strict::String | ::PersonEntity | ::OrganizationEntity).optional
|
7
|
+
attribute? :publisher, (::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, :publisher).merge(
|
15
|
+
author: safe_author,
|
16
|
+
publisher: safe_publisher
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def safe_author
|
23
|
+
return if author.blank?
|
24
|
+
return author unless author.is_a?(String)
|
25
|
+
|
26
|
+
::PersonEntity.new(person_name: author)
|
27
|
+
end
|
28
|
+
|
29
|
+
def safe_publisher
|
30
|
+
return if publisher.blank?
|
31
|
+
return publisher unless publisher.is_a?(String)
|
32
|
+
|
33
|
+
::OrganizationEntity.new(name: publisher)
|
34
|
+
end
|
11
35
|
end
|
data/lib/izi_json_ld/version.rb
CHANGED