contentful-scheduler-custom-build-john 1.13 → 1.14

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: cd7879dca084282d83eb0b2b68d51595ee2bb490
4
- data.tar.gz: 70b18738b7c0299117476a673db14b5111b0662c
3
+ metadata.gz: 7a3ad6b71a82b2e86208b3742260bfa99c417c8d
4
+ data.tar.gz: 2fc217e5c6864866986107dbba00ec406ceae2de
5
5
  SHA512:
6
- metadata.gz: de387823a3772352a2eeaa82291699ebba8163a7b96445abfed4f0389af8e84a38ce4b418bc1f06c02aa26984c3988e59c2dc34364b6587c229a358f934fbdfb
7
- data.tar.gz: 91bb034e50171ffadc658ed5c21dafc56a3932cfb8285e842402c9b32495de49b280ee01df799fdfbae0f12a146574e5ca6113a905ccf066971ee23e14f47989
6
+ metadata.gz: 76c3630273048ffbe92baac8622127c448d363bdf6b6039f9d0ac4cf6311e39f3bbddcd7c3cd93a0dbf9ad1fd34447f3b986b1f69f65caf58ead4dbf01a871b6
7
+ data.tar.gz: 0b227b979bc3c0522bad48b07778db4b1c1a3673e623bb84beb71fcfe5f9495c9ddcc3697c0d3826ce87a9c689ee21a4e47e98c46278b0f46b575056dfda3405
@@ -16,6 +16,7 @@ module Contentful
16
16
  def update_or_create(webhook)
17
17
  return unless publishable?(webhook)
18
18
  remove(webhook) if in_queue?(webhook)
19
+ puts already_published?(webhook)
19
20
  return if already_published?(webhook)
20
21
 
21
22
  success = Resque.enqueue_at(
@@ -63,8 +64,7 @@ module Contentful
63
64
 
64
65
  def already_published?(webhook)
65
66
  return true if publish_date(webhook) < Time.now.utc
66
- puts !webhook_is_publish_in_future(webhook)
67
- if !webhook_is_publish_in_future(webhook)
67
+ if !webhook.fields[spaces[webhook.space_id][:is_publish_in_future]]
68
68
  return false unless webhook.sys.key?('publishedAt')
69
69
  if !webhook.sys['publishedAt'].nil?
70
70
  return Chronic.parse(webhook.sys['publishedAt']).utc < Time.now.utc
@@ -98,14 +98,6 @@ module Contentful
98
98
  webhook.fields[spaces[webhook.space_id][:publish_field]]
99
99
  end
100
100
 
101
- def webhook_is_publish_in_future(webhook)
102
- if webhook.fields.key?(spaces.fetch(webhook.space_id, {})[:is_publish_in_future])
103
- return webhook.fields[spaces[webhook.space_id][:is_publish_in_future]]
104
- else
105
- return true
106
- end
107
- end
108
-
109
101
  private
110
102
 
111
103
  def initialize(logger)
@@ -1,5 +1,5 @@
1
1
  module Contentful
2
2
  module Scheduler
3
- VERSION = "1.13"
3
+ VERSION = "1.14"
4
4
  end
5
5
  end
@@ -161,6 +161,12 @@ describe Contentful::Scheduler::Queue do
161
161
  WebhookDouble.new('bar', 'foo', {'publishedAt' => '2011-04-04T22:00:00+00:00'}, {'my_field' => '2099-04-04T22:00:00+00:00', 'is_publish_in_future' => false})
162
162
  )).to be_truthy
163
163
  end
164
+
165
+ it 'false if webhook publish_date is in future and is_publish_in_future is true' do
166
+ expect(subject.already_published?(
167
+ WebhookDouble.new('bar', 'foo', {'publishedAt' => '2011-04-04T22:00:00+00:00'}, {'my_field' => '2099-04-04T22:00:00+00:00', 'is_publish_in_future' => true})
168
+ )).to be_falsey
169
+ end
164
170
  end
165
171
 
166
172
  describe '#publishable?' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful-scheduler-custom-build-john
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.13'
4
+ version: '1.14'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentful GmbH (David Litvak Bruno0