izi_json_ld 1.0.10 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/entities/product_entity.rb +19 -1
- data/lib/izi_json_ld/version.rb +1 -1
- data/spec/dummy/log/test.log +1514 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcc874ab5405c6e7f56fc9bde4bec4e288b44831
|
4
|
+
data.tar.gz: a2f871bd7e3a815180c17a2395a1e4744e0a54bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6cc1e6e99a9e7a40d82ee84d0499bd3e39f2743e268e1d403feab724351847e4e3f84fa9b2e7f04a0b00a058604ed811a13042e62674c17bdfbc6a2fa7080f9
|
7
|
+
data.tar.gz: 582a5dc61fb74a9db7dd4c61058bf7c0e0e3f5b83ea91de48312c3e27c9c4fa04c76b0c90d2a9d800ba85926922fd123675c4980ef0d7e8b91f7188667d6c757
|
@@ -4,11 +4,29 @@ class ProductEntity < ApplicationEntity
|
|
4
4
|
type 'Product'
|
5
5
|
|
6
6
|
attribute :name, ::IziJsonLd::Types::String
|
7
|
-
attribute? :brand, ::IziJsonLd::Types::String.optional
|
7
|
+
attribute? :brand, (::IziJsonLd::Types::Strict::String | ::OrganizationEntity).optional
|
8
8
|
attribute? :image, ::IziJsonLd::Types::String.optional
|
9
9
|
attribute? :description, ::IziJsonLd::Types::String.optional
|
10
|
+
attribute? :sku, ::IziJsonLd::Types::String.optional
|
11
|
+
attribute? :gtin, ::IziJsonLd::Types::String.optional
|
12
|
+
attribute? :mpn, ::IziJsonLd::Types::String.optional
|
10
13
|
|
11
14
|
attribute? :offers, OfferEntity.optional
|
12
15
|
attribute? :aggregateRating, AggregateRatingEntity.optional
|
13
16
|
attribute? :review, ::IziJsonLd::Types::OneOrMore[::ReviewEntity].optional
|
17
|
+
|
18
|
+
def dump_attributes
|
19
|
+
attributes.except(:brand).merge(
|
20
|
+
brand: safe_brand
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def safe_brand
|
27
|
+
return if brand.blank?
|
28
|
+
return brand unless brand.is_a?(String)
|
29
|
+
|
30
|
+
::OrganizationEntity.new(name: brand)
|
31
|
+
end
|
14
32
|
end
|
data/lib/izi_json_ld/version.rb
CHANGED