contentful-scheduler-custom-build-john 1.19 → 1.20
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 +4 -4
- data/lib/contentful/scheduler/queue.rb +41 -8
- data/lib/contentful/scheduler/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4cea8eacabcba29ef219c4d136191622a650d7f
|
4
|
+
data.tar.gz: 9216bce248b65bfcfcf573ae29155cb6af4844ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dca4de0888852f6626bf4cb84fb493686c6e09402f1b106e6763a82f13c6152a062207ac75a989b7a21d1de1d737539d9a5a19b58cfc3f6471820cb8a0b5cb5c
|
7
|
+
data.tar.gz: 11ff2fc5b6a6f5398e74cd841628809d6432b4387756d0b8a3ca46eeb61a28c0d7e3a2877dfd2c4bde6953c61d4615dbee36bba3100372aaf1dd88ce1c3ca077
|
@@ -26,6 +26,8 @@ module Contentful
|
|
26
26
|
::Contentful::Scheduler.config[:spaces][webhook.space_id][:management_token]
|
27
27
|
)
|
28
28
|
|
29
|
+
updateContentBlocks(webhook)
|
30
|
+
|
29
31
|
if success
|
30
32
|
logger.info "Webhook {id: #{webhook.id}, space_id: #{webhook.space_id}} successfully added to queue"
|
31
33
|
else
|
@@ -44,6 +46,8 @@ module Contentful
|
|
44
46
|
::Contentful::Scheduler.config[:management_token]
|
45
47
|
)
|
46
48
|
|
49
|
+
removeContentBlocks(webhook)
|
50
|
+
|
47
51
|
if success
|
48
52
|
logger.info "Webhook {id: #{webhook.id}, space_id: #{webhook.space_id}} successfully removed from queue"
|
49
53
|
else
|
@@ -51,6 +55,43 @@ module Contentful
|
|
51
55
|
end
|
52
56
|
end
|
53
57
|
|
58
|
+
def updateContentBlocks(webhook)
|
59
|
+
if isContentBlockAvailable(webhook)
|
60
|
+
webhook.fields['contentBlocks']['fi-FI'].each do |sys|
|
61
|
+
success = Resque.enqueue_at(
|
62
|
+
publish_date(webhook),
|
63
|
+
::Contentful::Scheduler::Tasks::Publish,
|
64
|
+
webhook.space_id,
|
65
|
+
sys.id,
|
66
|
+
::Contentful::Scheduler.config[:spaces][webhook.space_id][:management_token]
|
67
|
+
)
|
68
|
+
if success
|
69
|
+
logger.info "Webhook Content block {id: #{sys.id}, space_id: #{webhook.space_id}} successfully added to queue"
|
70
|
+
else
|
71
|
+
logger.warn "Webhook Content block {id: #{sys.id}, space_id: #{webhook.space_id}} couldn't be added to queue"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def removeContentBlocks(webhook)
|
78
|
+
if isContentBlockAvailable(webhook)
|
79
|
+
webhook.fields['contentBlocks']['fi-FI'].each do |sys|
|
80
|
+
success = Resque.remove_delayed(
|
81
|
+
::Contentful::Scheduler::Tasks::Publish,
|
82
|
+
webhook.space_id,
|
83
|
+
sys.id,
|
84
|
+
::Contentful::Scheduler.config[:management_token]
|
85
|
+
)
|
86
|
+
if success
|
87
|
+
logger.info "Webhook Content Block {id: #{sys.id}, space_id: #{webhook.space_id}} successfully removed from queue"
|
88
|
+
else
|
89
|
+
logger.warn "Webhook Content Block {id: #{sys.id}, space_id: #{webhook.space_id}} couldn't be removed from queue"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
54
95
|
def publishable?(webhook)
|
55
96
|
return false unless spaces.key?(webhook.space_id)
|
56
97
|
|
@@ -91,14 +132,6 @@ module Contentful
|
|
91
132
|
webhook.fields[spaces[webhook.space_id][:publish_field]]
|
92
133
|
end
|
93
134
|
|
94
|
-
def webhook_is_publish_in_future(webhook)
|
95
|
-
if webhook.fields.key?(spaces.fetch(webhook.space_id, {})[:is_publish_in_future])
|
96
|
-
return webhook.fields[spaces[webhook.space_id][:is_publish_in_future]]
|
97
|
-
else
|
98
|
-
return true
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
135
|
private
|
103
136
|
|
104
137
|
def initialize(logger)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contentful-scheduler-custom-build-john
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.20'
|
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: 2018-01-
|
11
|
+
date: 2018-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: contentful-webhook-listener
|