contentful-scheduler-custom 1.6.7.5309 → 1.6.7.5310

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10d9cd5b89a0c102f912c2c48d5d6b70b8e88a5241c228d91c63540dbcb4361b
4
- data.tar.gz: 2c1280178d8c0dfbe71bf3182f131fda6da00bffe9d078378822ab1d56b05c62
3
+ metadata.gz: 4e03fdf49ebcee1a552e4a5fd461b9e6be417a0740d507ea79f48b6a021d7dc5
4
+ data.tar.gz: c5b4fc0de9afad1c40e2d509fc61552287b54b7ea69bdd4cb812f24998e5f910
5
5
  SHA512:
6
- metadata.gz: 4963f0c66de120018e76aec55e6bc5de9f92343f67daa37a26d685a841cc158f7ef86e7ec6dc9b6bf7e1b8ded83a74de888fba055e7cbd676e9c8c4923a50103
7
- data.tar.gz: e47b075ce5714587ec2ee6d38ae3c9138c09b79cbfb0308e2b4288408059fbb5eec676fc3cbd7e5461b5e698d70a23a64316983a87fa2229594490fcfa33a474
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
@@ -1,5 +1,5 @@
1
1
  module Contentful
2
2
  module Scheduler
3
- VERSION = "1.6.7.5309"
3
+ VERSION = "1.6.7.5310"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful-scheduler-custom
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.7.5309
4
+ version: 1.6.7.5310
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentful GmbH (David Litvak Bruno0