contentful-scheduler-custom-build-john 1.19 → 1.20

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
  SHA1:
3
- metadata.gz: 881f639b9bd9c5778e7b7ce829e7ee9f6e31515d
4
- data.tar.gz: a56adb18cecb018021eaa89ef0e115c4a4cfe919
3
+ metadata.gz: c4cea8eacabcba29ef219c4d136191622a650d7f
4
+ data.tar.gz: 9216bce248b65bfcfcf573ae29155cb6af4844ec
5
5
  SHA512:
6
- metadata.gz: 98e2b7d348fca952091a15e4fcea38538d0ea1e0d8a69f1a76dfb9359ce09b6d710d688fbfd95f700ee2c38c5f4268cd6c90defb6ebd783fb1b452a961244f8a
7
- data.tar.gz: 718584ab1949837810153ea7e903026f63c78bf9529ba04a8ca6787e2f370d4c4d940844a2d7b0b2c41854fca1aab19c2f9d235f5ca5dbc763ebcd10c0c2f5f0
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)
@@ -1,5 +1,5 @@
1
1
  module Contentful
2
2
  module Scheduler
3
- VERSION = "1.19"
3
+ VERSION = "1.20"
4
4
  end
5
5
  end
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.19'
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-15 00:00:00.000000000 Z
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