contentful-scheduler-custom 1.6.7.5375 → 1.6.111

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: ba570593804fd2e84e1bb388e911a22acf31d15d523da71ee3ce64923a0e76b7
4
- data.tar.gz: 99d6a21eb10df02c4afeecfa7422740ab33aa2beea9bbc5150a3beb7a897b02f
3
+ metadata.gz: e31b174381d677473cd07b1f9f370ea57804db5249bcf2c063f8c8615c65909f
4
+ data.tar.gz: 11ae67a10a789b63ac5372eb7d763d27a1987707940c7edc6889bc6497c043f9
5
5
  SHA512:
6
- metadata.gz: dc9cf88565d3bffec001d3dc74056dd41ebd63af0a647b94924cda4ac321d6ee31f278aa1947bf2e423b47ba29ae95092c8cd33480a49a4502a21fa0d2b1197a
7
- data.tar.gz: 26b103485648b79ce683b242714b71db49f1df92bc48b8bb88e40006e304f6b419f8c8cdcc74265e06dd0909e161668d2fdc913f4dbc6f77bfc7425a5a9fef70
6
+ metadata.gz: c4c9a24329110a963e57b18fffc2e3b93d2bfbc3e959174af358eeb7b8f247298b310bdc6b8d2cf0b0711318a36ba3a0c16be04b752a1af69af44d70371d827f
7
+ data.tar.gz: 90c013733e74672abca20d9c787dfb4c2c143b15bed9564a453e19365122f552cac1397aff5cc6303d4d0abd5284d57a7f2ca7582927c2c2d1c4bcc54eca9937
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_runtime_dependency "contentful", "~> 2.11.1"
23
22
  spec.add_runtime_dependency "contentful-webhook-listener", "~> 0.2"
23
+ spec.add_runtime_dependency "contentful", "~> 2.9.4"
24
24
  spec.add_runtime_dependency "contentful-management", "~> 1.8"
25
25
  spec.add_runtime_dependency "resque", "~> 1.27.4"
26
26
  spec.add_runtime_dependency "resque-scheduler", "~> 4.3.1"
@@ -1,4 +1,5 @@
1
- require_relative 'tasks'
1
+ require_relative "tasks"
2
+ require_relative "tasks"
2
3
  require 'chronic'
3
4
  require 'contentful/webhook/listener'
4
5
 
@@ -1,7 +1,5 @@
1
1
  require 'contentful/management'
2
2
  require 'contentful'
3
- require 'logger'
4
- require_relative '../taskshelper'
5
3
 
6
4
  module Contentful
7
5
  module Scheduler
@@ -10,33 +8,22 @@ module Contentful
10
8
  @queue = :publish
11
9
 
12
10
  def self.perform(space_id, entry_id, token)
13
-
14
- logger = Logger.new(STDOUT)
15
- client = Contentful::Client.new(
16
- space: space_id,
17
- access_token: ::Contentful::Scheduler.config[:spaces][space_id][:delivery_token]
18
- )
19
-
20
- clientManagement = ::Contentful::Management::Client.new(
21
- token,
22
- raise_errors: true,
23
- application_name: 'contentful.scheduler',
24
- application_version: Contentful::Scheduler::VERSION
11
+ contentfulClient = Contentful::Client.new(
12
+ space: space_id,
13
+ access_token: token
25
14
  )
26
15
 
27
- linked_entries = client.entries(links_to_entry: entry_id)
16
+ linkedEntries = contentfulClient.entries(links_to_entry: entry_id)
28
17
 
29
- if !linked_entries.raw["includes"].nil? && !linked_entries.raw["includes"]["Entry"].nil?
30
- linked_entries_ids = Taskshelper.extract_element_ids(linked_entries.raw["includes"]["Entry"])
31
- logger.info("Linked enteries for entry_id ==>> #{entry_id} are ==>> #{linked_entries_ids}")
32
- linked_entries_ids.each do |id|
33
- logger.info"Publishing linked entry with id #{id}"
34
- clientManagement.entries.find(space_id, id).publish
35
- end
36
- end
37
- clientManagement.entries.find(space_id, entry_id).publish
18
+ client = ::Contentful::Management::Client.new(
19
+ token,
20
+ raise_errors: true,
21
+ application_name: 'contentful.scheduler',
22
+ application_version: Contentful::Scheduler::VERSION
23
+ )
24
+ linkedEntries.find(space_id, entry_id).publish
25
+ client.entries.find(space_id, entry_id).publish
38
26
  end
39
-
40
27
  end
41
28
  end
42
29
  end
@@ -1,5 +1,5 @@
1
1
  module Contentful
2
2
  module Scheduler
3
- VERSION = "1.6.7.5375"
3
+ VERSION = "1.6.111"
4
4
  end
5
- end
5
+ end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful-scheduler-custom
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.7.5375
4
+ version: 1.6.111
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentful GmbH (David Litvak Bruno0
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-01 00:00:00.000000000 Z
11
+ date: 2018-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: contentful
14
+ name: contentful-webhook-listener
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.11.1
19
+ version: '0.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.11.1
26
+ version: '0.2'
27
27
  - !ruby/object:Gem::Dependency
28
- name: contentful-webhook-listener
28
+ name: contentful
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.2'
33
+ version: 2.9.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.2'
40
+ version: 2.9.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: contentful-management
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -222,7 +222,6 @@ files:
222
222
  - lib/contentful/scheduler/tasks.rb
223
223
  - lib/contentful/scheduler/tasks/publish.rb
224
224
  - lib/contentful/scheduler/tasks/unpublish.rb
225
- - lib/contentful/scheduler/taskshelper.rb
226
225
  - lib/contentful/scheduler/version.rb
227
226
  - spec/contentful/scheduler/auth_spec.rb
228
227
  - spec/contentful/scheduler/controller_spec.rb
@@ -1,31 +0,0 @@
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
-