wcc-contentful 1.4.0.rc3 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63f3ef5be57de2373cfb7af9def7e9227fe0be9d7acc22977f650f4638f8835d
|
4
|
+
data.tar.gz: 80021d370e0b6e4238515658f491cd6fee5bafe39c813822dcf3e44d86d7a6fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a26f8d7e360cac5511bf68fd083c980f0ab8d9f5c81657b363f157c2c811fa0316bcd6987fff4ae0225a74db8450a196d2a21cafee9d6cb42213d9c55556a4f
|
7
|
+
data.tar.gz: 26299e68f65c992b226c8c17064913454d582795ac2bd2345784f0b4550f73f77047bf8f3a67d2110652843508d885f20f45d6202bb36ede4b3d7b3244b0d6b7
|
@@ -22,20 +22,21 @@ module WCC::Contentful::EntryLocaleTransformer
|
|
22
22
|
return entry
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
new_entry = entry.dup
|
26
|
+
|
27
|
+
new_entry['sys'] = entry['sys'].except('locale').merge({
|
26
28
|
'WCC::Contentful::EntryLocaleTransformer:locales_included' => [entry_locale]
|
27
29
|
})
|
28
|
-
fields
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
if entry.key?('fields')
|
31
|
+
new_entry['fields'] =
|
32
|
+
entry['fields'].transform_values do |value|
|
33
|
+
h = {}
|
34
|
+
h[entry_locale] = value
|
35
|
+
h
|
36
|
+
end
|
37
|
+
end
|
34
38
|
|
35
|
-
|
36
|
-
'sys' => sys,
|
37
|
-
'fields' => fields
|
38
|
-
}
|
39
|
+
new_entry
|
39
40
|
end
|
40
41
|
|
41
42
|
##
|
@@ -54,29 +55,29 @@ module WCC::Contentful::EntryLocaleTransformer
|
|
54
55
|
# Transform the store's "locale=*" entry into a localized one
|
55
56
|
locale ||= default_locale
|
56
57
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
v =
|
68
|
-
|
69
|
-
|
70
|
-
|
58
|
+
new_entry = entry.dup
|
59
|
+
new_entry['sys'] = entry['sys'].deep_dup
|
60
|
+
new_entry['sys']['locale'] = locale
|
61
|
+
if entry.key?('fields')
|
62
|
+
new_entry['fields'] =
|
63
|
+
entry['fields']&.transform_values do |value|
|
64
|
+
next if value.nil?
|
65
|
+
|
66
|
+
# replace the all-locales value with the localized value
|
67
|
+
l = locale
|
68
|
+
v = nil
|
69
|
+
while l
|
70
|
+
v = value[l]
|
71
|
+
break if v
|
72
|
+
|
73
|
+
l = configuration.locale_fallbacks[l]
|
74
|
+
end
|
75
|
+
|
76
|
+
v
|
71
77
|
end
|
78
|
+
end
|
72
79
|
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
{
|
77
|
-
'sys' => sys,
|
78
|
-
'fields' => fields
|
79
|
-
}
|
80
|
+
new_entry
|
80
81
|
end
|
81
82
|
|
82
83
|
##
|
@@ -22,9 +22,11 @@ module WCC::Contentful::Middleware::Store
|
|
22
22
|
found =
|
23
23
|
@cache.fetch(key, expires_in: expires_in) do
|
24
24
|
event = 'miss'
|
25
|
-
# if it's
|
25
|
+
# if it's from the sync engine don't hit the API.
|
26
|
+
next if key =~ /^sync:/
|
27
|
+
|
26
28
|
# Store a nil object if we can't find the object on the CDN.
|
27
|
-
(store.find(key, **options) || nil_obj(key))
|
29
|
+
(store.find(key, **options) || nil_obj(key))
|
28
30
|
end
|
29
31
|
|
30
32
|
return unless found
|
@@ -138,7 +138,8 @@ module WCC::Contentful
|
|
138
138
|
# This job uses the Contentful Sync API to update the configured store with
|
139
139
|
# the latest data from Contentful.
|
140
140
|
class Job < ActiveJob::Base
|
141
|
-
|
141
|
+
# This should always be "async", because the configured store could be an in-memory store.
|
142
|
+
self.queue_adapter = :async
|
142
143
|
queue_as :default
|
143
144
|
|
144
145
|
def configuration
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wcc-contentful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.0
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Watermark Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -508,9 +508,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
508
508
|
version: '2.7'
|
509
509
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
510
510
|
requirements:
|
511
|
-
- - "
|
511
|
+
- - ">="
|
512
512
|
- !ruby/object:Gem::Version
|
513
|
-
version:
|
513
|
+
version: '0'
|
514
514
|
requirements: []
|
515
515
|
rubygems_version: 3.3.7
|
516
516
|
signing_key:
|