izi_json_ld 1.0.8 → 1.0.9

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
  SHA1:
3
- metadata.gz: af3eb774e6cbbbcb3dde25b2130be3ebb932d5a6
4
- data.tar.gz: 781e8d7a21a940240fec7e688106a6d5af9c8555
3
+ metadata.gz: 747a203ca8b1d17c682bc1f49efeb9782e47ac1f
4
+ data.tar.gz: da61b08b5f1317c8efb18317853e479b12643bfc
5
5
  SHA512:
6
- metadata.gz: 9ca307384436d55783b5684795095a7dd8733e431fe33af719a11d843664affc12e822db7892fd2fc740be3e0bec15d5a2bfafbf62c9eb4fa6f787109f25960c
7
- data.tar.gz: 9f08c84ec66253c9a6134cdeccaa07c6550457d2e9341bc63c2222d08624abbedd851fb682748f2d32a0e8850472b1eaa9d00e2d2e45c882655965203e3985fd
6
+ metadata.gz: 8f66a9419f1ff8db70f9bcfdb85919db60f83d4de518dc265e5feb97c75c7bd8393abc417ec0b473b8b47d210f12eb0957f5bc63da1163f8d3b07223ac5489dd
7
+ data.tar.gz: 395652ef61e587fc8df01433ff5ba004b5037bf005646ce4db965aff314b3b6364a67961e5dfac0ee12d9f94ed2ab3a0199c2b69699b4e0372407c955417ef76
@@ -13,4 +13,8 @@ class PersonEntity < ApplicationEntity
13
13
  def dump_attributes
14
14
  attributes.except(:person_name).merge(name: person_name)
15
15
  end
16
+
17
+ def name
18
+ person_name
19
+ end
16
20
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IziJsonLd
4
- VERSION = '1.0.8'
4
+ VERSION = '1.0.9'
5
5
  end