contentful-scheduler-custom 1.6.7.5308 → 1.6.7.5309
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 +23 -25
- 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: 10d9cd5b89a0c102f912c2c48d5d6b70b8e88a5241c228d91c63540dbcb4361b
|
4
|
+
data.tar.gz: 2c1280178d8c0dfbe71bf3182f131fda6da00bffe9d078378822ab1d56b05c62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4963f0c66de120018e76aec55e6bc5de9f92343f67daa37a26d685a841cc158f7ef86e7ec6dc9b6bf7e1b8ded83a74de888fba055e7cbd676e9c8c4923a50103
|
7
|
+
data.tar.gz: e47b075ce5714587ec2ee6d38ae3c9138c09b79cbfb0308e2b4288408059fbb5eec676fc3cbd7e5461b5e698d70a23a64316983a87fa2229594490fcfa33a474
|
@@ -9,6 +9,29 @@ module Contentful
|
|
9
9
|
class Publish
|
10
10
|
@queue = :publish
|
11
11
|
|
12
|
+
def extract_element_ids(input_array)
|
13
|
+
ids = []
|
14
|
+
input_array.each {|item| (ids << (get_each_field item)).flatten!}
|
15
|
+
ids.uniq
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_each_field(item)
|
19
|
+
ids = []
|
20
|
+
keys = item["fields"].keys
|
21
|
+
keys.each {|key| (ids << (get_each_element key, item["fields"])).flatten!}
|
22
|
+
return ids
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_each_element(key, item)
|
26
|
+
ids = []
|
27
|
+
if item[key].kind_of?(Array)
|
28
|
+
item[key].each {|i| (!(i["sys"]["linkType"].nil?) && i["sys"]["linkType"] == "Entry") ? ids.push(i["sys"]["id"]) : nil}
|
29
|
+
elsif item[key].kind_of?(Hash)
|
30
|
+
(!( item[key]["sys"]["linkType"].nil? ) && item[key]["sys"]["linkType"] == "Entry") ? ids.push(item[key]["sys"]["id"]) : nil
|
31
|
+
end
|
32
|
+
return ids
|
33
|
+
end
|
34
|
+
|
12
35
|
def self.perform(space_id, entry_id, token)
|
13
36
|
logger = Logger.new(STDOUT)
|
14
37
|
client1 = Contentful::Client.new(
|
@@ -36,31 +59,6 @@ module Contentful
|
|
36
59
|
end
|
37
60
|
|
38
61
|
|
39
|
-
def extract_element_ids(input_array)
|
40
|
-
ids = []
|
41
|
-
input_array.each {|item| (ids << (get_each_field item)).flatten!}
|
42
|
-
ids.uniq
|
43
|
-
end
|
44
|
-
|
45
|
-
def get_each_field(item)
|
46
|
-
ids = []
|
47
|
-
keys = item["fields"].keys
|
48
|
-
keys.each {|key| (ids << (get_each_element key, item["fields"])).flatten!}
|
49
|
-
return ids
|
50
|
-
end
|
51
|
-
|
52
|
-
def get_each_element(key, item)
|
53
|
-
ids = []
|
54
|
-
if item[key].kind_of?(Array)
|
55
|
-
item[key].each {|i| (!(i["sys"]["linkType"].nil?) && i["sys"]["linkType"] == "Entry") ? ids.push(i["sys"]["id"]) : nil}
|
56
|
-
elsif item[key].kind_of?(Hash)
|
57
|
-
(!( item[key]["sys"]["linkType"].nil? ) && item[key]["sys"]["linkType"] == "Entry") ? ids.push(item[key]["sys"]["id"]) : nil
|
58
|
-
end
|
59
|
-
return ids
|
60
|
-
end
|
61
|
-
|
62
|
-
|
63
|
-
|
64
62
|
|
65
63
|
=begin
|
66
64
|
linked_enteries.each do |entry|
|