contentful-scheduler-custom 1.6.7.5369 → 1.6.7.5370

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a19173b047ce8386b9b45d4b3f41a27ab30bfb89c462079fcdb2699d68c5dac2
4
- data.tar.gz: aec8bb2c48cb1946cf674a566673eb363f544d820df9c519c7c3876d4f326fe6
3
+ metadata.gz: f5295332c2cc7b3015b652cf20aa858a630bcf02bf1cbf9b9f6488e03d6b8a08
4
+ data.tar.gz: d091097675300c40be1532f7cfa5559283889abc78f56c78c9ede2a2d27a8ca8
5
5
  SHA512:
6
- metadata.gz: 46e7fc51c821259a96904d164b7336315e3d334090f64935827fa7e8f0cd5fad6dbd67e08844ae0040a9c536cccff076db41fd0faad3ef745c9195843a949e75
7
- data.tar.gz: 15bd00189422128ca1fc6fe5a7a4a66f76d8cdcf5505f3e013808adf794c31d602db7cbaa04c9b6a586067e54ab1a4d66aefecfa3396162f978e4a72e41f7316
6
+ metadata.gz: d784f4bd4aad263396edfe7c9b488dbfac0133dfc140b057e7454fb6d7b1e0f5e9dd1ac282bc55bac06aad0ff493d3a0d59a49a5743e72514d96aadfc368a453
7
+ data.tar.gz: 32d1eb47097eeb280e21a1c271a818636fe387d3793d523c32c66e8d7512ec8174a67ec7e24aab2b0f26f041c5973c54ee9a16ab0be8e58378d9c6a8b16b333d
@@ -1,7 +1,7 @@
1
1
  require 'contentful/management'
2
2
  require 'contentful'
3
3
  require 'logger'
4
- require_relative 'taskshelper'
4
+ require_relative '../taskshelper'
5
5
 
6
6
  module Contentful
7
7
  module Scheduler
@@ -0,0 +1,31 @@
1
+ module Contentful
2
+ module Scheduler
3
+ module Taskshelper
4
+ def Taskshelper.extract_element_ids input_array
5
+ ids = []
6
+ input_array.each {|item| (ids << (Taskshelper.get_each_field item)).flatten!}
7
+ return ids.uniq
8
+ end
9
+
10
+ def Taskshelper.get_each_field item
11
+ ids = []
12
+ keys = item["fields"].keys
13
+ keys.each {|key| (ids << (Taskshelper.get_each_element key, item["fields"])).flatten!}
14
+ return ids
15
+ end
16
+
17
+ def Taskshelper.get_each_element key, item
18
+ ids = []
19
+ if item[key].is_a?(::Array)
20
+ item[key].each do |i|
21
+ (!(i["sys"]["linkType"].nil?) && i["sys"]["linkType"] == "Entry") ? ids.push(i["sys"]["id"]) : nil
22
+ end
23
+ elsif item[key].is_a?(::Hash)
24
+ (!(item[key]["sys"]["linkType"].nil?) && item[key]["sys"]["linkType"] == "Entry") ? ids.push(item[key]["sys"]["id"]) : nil
25
+ end
26
+ return ids
27
+ end
28
+ end
29
+ end
30
+ end
31
+
@@ -1,5 +1,5 @@
1
1
  module Contentful
2
2
  module Scheduler
3
- VERSION = "1.6.7.5369"
3
+ VERSION = "1.6.7.5370"
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.5369
4
+ version: 1.6.7.5370
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentful GmbH (David Litvak Bruno0
@@ -221,8 +221,8 @@ files:
221
221
  - lib/contentful/scheduler/queue.rb
222
222
  - lib/contentful/scheduler/tasks.rb
223
223
  - lib/contentful/scheduler/tasks/publish.rb
224
- - lib/contentful/scheduler/tasks/taskshelper.rb
225
224
  - lib/contentful/scheduler/tasks/unpublish.rb
225
+ - lib/contentful/scheduler/taskshelper.rb
226
226
  - lib/contentful/scheduler/version.rb
227
227
  - spec/contentful/scheduler/auth_spec.rb
228
228
  - spec/contentful/scheduler/controller_spec.rb
@@ -1,33 +0,0 @@
1
- module Contentful
2
- module Scheduler
3
- module Tasks
4
- module Taskshelper
5
- def Taskshelper.extract_element_ids input_array
6
- ids = []
7
- input_array.each {|item| (ids << (Taskshelper.get_each_field item)).flatten!}
8
- return ids.uniq
9
- end
10
-
11
- def Taskshelper.get_each_field item
12
- ids = []
13
- keys = item["fields"].keys
14
- keys.each {|key| (ids << (Taskshelper.get_each_element key, item["fields"])).flatten!}
15
- return ids
16
- end
17
-
18
- def Taskshelper.get_each_element key, item
19
- ids = []
20
- if item[key].is_a?(::Array)
21
- item[key].each do |i|
22
- (!(i["sys"]["linkType"].nil?) && i["sys"]["linkType"] == "Entry") ? ids.push(i["sys"]["id"]) : nil
23
- end
24
- elsif item[key].is_a?(::Hash)
25
- (!(item[key]["sys"]["linkType"].nil?) && item[key]["sys"]["linkType"] == "Entry") ? ids.push(item[key]["sys"]["id"]) : nil
26
- end
27
- return ids
28
- end
29
- end
30
- end
31
- end
32
- end
33
-