contentful-scheduler-custom 1.6.7.5311 → 1.6.7.5312

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: 6e8862291fe328192925380c9dbb7950172ac12b91428330d3eef326a7955458
4
- data.tar.gz: db0177dd0b69249baaf85e3c499625b3d02b13c303d4e506dcdea8652c8d1c8e
3
+ metadata.gz: ff5ce7a955ebccff139639b5805c24105f257bfe50f4d6d4d36c757678006361
4
+ data.tar.gz: 5a97eef6bfe850eff01def5174207e92250f1dcb65c7f451e471c6b2e25625f2
5
5
  SHA512:
6
- metadata.gz: 2578ad3a24df506e1726a992005b8bde33fd04e79ef7bd29306606b158d8c5701df5f269c82951b94f3339b522c5e2f854da7e2ab83e7fce02daa0727b137a8d
7
- data.tar.gz: 994fbf2cfec1f7f711d3497fcfd4ea6c62880fa1aead5038ddbe229a24af625b0c4592eb29a2ed7505978f48c10422687f56988894b443351df40639a395e1ab
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
@@ -1,5 +1,5 @@
1
1
  module Contentful
2
2
  module Scheduler
3
- VERSION = "1.6.7.5311"
3
+ VERSION = "1.6.7.5312"
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.5311
4
+ version: 1.6.7.5312
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentful GmbH (David Litvak Bruno0