contentful-scheduler-custom 1.6.7.5312 → 1.6.7.5313
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/contentful/scheduler/tasks/publish.rb +20 -44
- data/lib/contentful/scheduler/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7b24efd03b619d9ef4938b784d369c085313b394b56b21ab5333bb2b38d3ee4
|
4
|
+
data.tar.gz: 35d227ab65cb463884429435d3613523edfac648fe479b1bc3aeff9b64cf0da0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6cce7b5ae7138817f1da6bdb3f08caf99229446f992b088e0e4101ffd674e561cc19fff9c1641a2604f67f11fe0ee648779fd92b3c0f9598bd18b71077bc35c
|
7
|
+
data.tar.gz: 3fcb799772c86b184b7ea9e94db0e1d84dc6dceedcc2e61ad16bb5dc887ea05cdb2816e0dd5e8ee9dd3845968a16cc5b0c261e253d5cf18fcbb5f97ba7d0f675
|
@@ -11,29 +11,6 @@ module Contentful
|
|
11
11
|
|
12
12
|
def self.perform(space_id, entry_id, token)
|
13
13
|
|
14
|
-
def extract_element_ids(input_array)
|
15
|
-
ids = []
|
16
|
-
input_array.each {|item| (ids << (get_each_field item)).flatten!}
|
17
|
-
ids.uniq
|
18
|
-
end
|
19
|
-
|
20
|
-
def get_each_field(item)
|
21
|
-
ids = []
|
22
|
-
keys = item["fields"].keys
|
23
|
-
keys.each {|key| (ids << (get_each_element key, item["fields"])).flatten!}
|
24
|
-
return ids
|
25
|
-
end
|
26
|
-
|
27
|
-
def get_each_element(key, item)
|
28
|
-
ids = []
|
29
|
-
if item[key].kind_of?(Array)
|
30
|
-
item[key].each {|i| (!(i["sys"]["linkType"].nil?) && i["sys"]["linkType"] == "Entry") ? ids.push(i["sys"]["id"]) : nil}
|
31
|
-
elsif item[key].kind_of?(Hash)
|
32
|
-
(!( item[key]["sys"]["linkType"].nil? ) && item[key]["sys"]["linkType"] == "Entry") ? ids.push(item[key]["sys"]["id"]) : nil
|
33
|
-
end
|
34
|
-
return ids
|
35
|
-
end
|
36
|
-
|
37
14
|
logger = Logger.new(STDOUT)
|
38
15
|
client1 = Contentful::Client.new(
|
39
16
|
space: space_id,
|
@@ -60,31 +37,30 @@ module Contentful
|
|
60
37
|
end
|
61
38
|
|
62
39
|
|
40
|
+
client.entries.find(space_id, entry_id).publish
|
41
|
+
end
|
63
42
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
43
|
+
def self.extract_element_ids(input_array)
|
44
|
+
ids = []
|
45
|
+
input_array.each {|item| (ids << (get_each_field item)).flatten!}
|
46
|
+
return ids.uniq
|
47
|
+
end
|
68
48
|
|
49
|
+
def self.get_each_field(item)
|
50
|
+
ids = []
|
51
|
+
keys = item["fields"].keys
|
52
|
+
keys.each {|key| (ids << (get_each_element key, item["fields"])).flatten!}
|
53
|
+
return ids
|
54
|
+
end
|
69
55
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
if !field.nil? && field.class.to_s == "Array"
|
77
|
-
logger.info " items field ids are #{field}"
|
78
|
-
field.each do |entry1|
|
79
|
-
logger.info"under 1 level #{entry1.fields}"
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
56
|
+
def self.get_each_element(key, item)
|
57
|
+
ids = []
|
58
|
+
if item[key].kind_of?(Array)
|
59
|
+
item[key].each {|i| (!(i["sys"]["linkType"].nil?) && i["sys"]["linkType"] == "Entry") ? ids.push(i["sys"]["id"]) : nil}
|
60
|
+
elsif item[key].kind_of?(Hash)
|
61
|
+
(!( item[key]["sys"]["linkType"].nil? ) && item[key]["sys"]["linkType"] == "Entry") ? ids.push(item[key]["sys"]["id"]) : nil
|
84
62
|
end
|
85
|
-
|
86
|
-
|
87
|
-
client.entries.find(space_id, entry_id).publish
|
63
|
+
return ids
|
88
64
|
end
|
89
65
|
end
|
90
66
|
end
|