contentful-scheduler-custom 1.6.7.5311 → 1.6.7.5312
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 +24 -28
- 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: ff5ce7a955ebccff139639b5805c24105f257bfe50f4d6d4d36c757678006361
|
4
|
+
data.tar.gz: 5a97eef6bfe850eff01def5174207e92250f1dcb65c7f451e471c6b2e25625f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 963aa2753d548b4bf657aed48862763bddb137ba641051b1d6573528b1f9c36a733ea574fb781bb9cb8daf6880f321d0f09bfaa2132727df9e334fd52c5f0089
|
7
|
+
data.tar.gz: 9c14a7a6e4a4b4ee9a49cb9d9282a97d15f76f6e8d916b769a9eb536a42945d7063b66c2bcefdba6e07acedb2f08b2750171bcc4c7052092171cc93ad29a3595
|
@@ -10,6 +10,30 @@ module Contentful
|
|
10
10
|
@queue = :publish
|
11
11
|
|
12
12
|
def self.perform(space_id, entry_id, token)
|
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
|
+
|
13
37
|
logger = Logger.new(STDOUT)
|
14
38
|
client1 = Contentful::Client.new(
|
15
39
|
space: space_id,
|
@@ -62,34 +86,6 @@ module Contentful
|
|
62
86
|
|
63
87
|
client.entries.find(space_id, entry_id).publish
|
64
88
|
end
|
65
|
-
|
66
|
-
private
|
67
|
-
|
68
|
-
def extract_element_ids(input_array)
|
69
|
-
ids = []
|
70
|
-
input_array.each {|item| (ids << (get_each_field item)).flatten!}
|
71
|
-
ids.uniq
|
72
|
-
end
|
73
|
-
|
74
|
-
def get_each_field(item)
|
75
|
-
ids = []
|
76
|
-
keys = item["fields"].keys
|
77
|
-
keys.each {|key| (ids << (get_each_element key, item["fields"])).flatten!}
|
78
|
-
return ids
|
79
|
-
end
|
80
|
-
|
81
|
-
def get_each_element(key, item)
|
82
|
-
ids = []
|
83
|
-
if item[key].kind_of?(Array)
|
84
|
-
item[key].each {|i| (!(i["sys"]["linkType"].nil?) && i["sys"]["linkType"] == "Entry") ? ids.push(i["sys"]["id"]) : nil}
|
85
|
-
elsif item[key].kind_of?(Hash)
|
86
|
-
(!( item[key]["sys"]["linkType"].nil? ) && item[key]["sys"]["linkType"] == "Entry") ? ids.push(item[key]["sys"]["id"]) : nil
|
87
|
-
end
|
88
|
-
return ids
|
89
|
-
end
|
90
|
-
|
91
|
-
|
92
|
-
|
93
89
|
end
|
94
90
|
end
|
95
91
|
end
|