contentful-scheduler-custom 1.6.7.5309 → 1.6.7.5310
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 +25 -23
- 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: 4e03fdf49ebcee1a552e4a5fd461b9e6be417a0740d507ea79f48b6a021d7dc5
|
4
|
+
data.tar.gz: c5b4fc0de9afad1c40e2d509fc61552287b54b7ea69bdd4cb812f24998e5f910
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c45228f9dc1dcf135b638e6089491b40acc128c7a611ceb3d5af691c4d8a09d51e75c69b7545b90c2c13522025f9c115cc289dffcca5443bf229a36d6b23d60
|
7
|
+
data.tar.gz: e680e0610031b83e82b11fc6d65f3603a2c0aa0d98931f2d861a14c62ef0a5ecaa8dfc2bcdc72459dc8bb3c38b5a0d19bc44fcf9ac697400bdc21be9f9f7dedf
|
@@ -9,29 +9,6 @@ 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
|
-
|
35
12
|
def self.perform(space_id, entry_id, token)
|
36
13
|
logger = Logger.new(STDOUT)
|
37
14
|
client1 = Contentful::Client.new(
|
@@ -86,6 +63,31 @@ module Contentful
|
|
86
63
|
client.entries.find(space_id, entry_id).publish
|
87
64
|
end
|
88
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
|
+
|
89
91
|
|
90
92
|
|
91
93
|
end
|