contentful-scheduler-custom-build-john 1.18 → 1.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/contentful/scheduler/queue.rb +0 -15
- data/lib/contentful/scheduler/version.rb +1 -1
- data/spec/contentful/scheduler/queue_spec.rb +4 -46
- 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: 881f639b9bd9c5778e7b7ce829e7ee9f6e31515d
|
4
|
+
data.tar.gz: a56adb18cecb018021eaa89ef0e115c4a4cfe919
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98e2b7d348fca952091a15e4fcea38538d0ea1e0d8a69f1a76dfb9359ce09b6d710d688fbfd95f700ee2c38c5f4268cd6c90defb6ebd783fb1b452a961244f8a
|
7
|
+
data.tar.gz: 718584ab1949837810153ea7e903026f63c78bf9529ba04a8ca6787e2f370d4c4d940844a2d7b0b2c41854fca1aab19c2f9d235f5ca5dbc763ebcd10c0c2f5f0
|
@@ -16,8 +16,6 @@ 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)
|
20
|
-
puts "already_published"
|
21
19
|
return if already_published?(webhook)
|
22
20
|
|
23
21
|
success = Resque.enqueue_at(
|
@@ -65,19 +63,6 @@ module Contentful
|
|
65
63
|
|
66
64
|
def already_published?(webhook)
|
67
65
|
return true if publish_date(webhook) < Time.now.utc
|
68
|
-
puts !webhook_is_publish_in_future(webhook).nil?
|
69
|
-
if !webhook_is_publish_in_future(webhook).nil?
|
70
|
-
puts "Inside this 1st"
|
71
|
-
return false unless webhook.sys.key?('publishedAt')
|
72
|
-
if !webhook.sys['publishedAt'].nil?
|
73
|
-
puts "Inside this 2nd"
|
74
|
-
return Chronic.parse(webhook.sys['publishedAt']).utc < Time.now.utc
|
75
|
-
end
|
76
|
-
else
|
77
|
-
puts "Inside this else2nd"
|
78
|
-
return false
|
79
|
-
end
|
80
|
-
puts "Inside this else main"
|
81
66
|
|
82
67
|
false
|
83
68
|
end
|
@@ -104,67 +104,25 @@ describe Contentful::Scheduler::Queue do
|
|
104
104
|
describe '#already_published?' do
|
105
105
|
it 'true if webhook publish_date is in past' do
|
106
106
|
expect(subject.already_published?(
|
107
|
-
WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2011-04-04T22:00:00+00:00'
|
107
|
+
WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2011-04-04T22:00:00+00:00'})
|
108
108
|
)).to be_truthy
|
109
109
|
end
|
110
110
|
|
111
111
|
it 'true if sys.publishedAt is in past' do
|
112
112
|
expect(subject.already_published?(
|
113
|
-
WebhookDouble.new('bar', 'foo', {'publishedAt' => '2011-04-04T22:00:00+00:00'}, {'my_field' => '2099-04-04T22:00:00+00:00'
|
113
|
+
WebhookDouble.new('bar', 'foo', {'publishedAt' => '2011-04-04T22:00:00+00:00'}, {'my_field' => '2099-04-04T22:00:00+00:00'})
|
114
114
|
)).to be_truthy
|
115
115
|
end
|
116
116
|
|
117
117
|
it 'false if sys.publishedAt is not present' do
|
118
118
|
expect(subject.already_published?(
|
119
|
-
WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2099-04-04T22:00:00+00:00'
|
119
|
+
WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2099-04-04T22:00:00+00:00'})
|
120
120
|
)).to be_falsey
|
121
121
|
end
|
122
122
|
|
123
123
|
it 'false if sys.publishedAt is present but nil' do
|
124
124
|
expect(subject.already_published?(
|
125
|
-
WebhookDouble.new('bar', 'foo', {'publishedAt' => nil}, {'my_field' => '2099-04-04T22:00:00+00:00'
|
126
|
-
)).to be_falsey
|
127
|
-
end
|
128
|
-
|
129
|
-
it 'false if sys.publishedAt is present but nil and is_publish_in_future is true' do
|
130
|
-
expect(subject.already_published?(
|
131
|
-
WebhookDouble.new('bar', 'foo', {'publishedAt' => nil}, {'my_field' => '2099-04-04T22:00:00+00:00', 'is_publish_in_future' => true})
|
132
|
-
)).to be_falsey
|
133
|
-
end
|
134
|
-
|
135
|
-
it 'false if sys.publishedAt is in past and is_publish_in_future is true' do
|
136
|
-
expect(subject.already_published?(
|
137
|
-
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})
|
138
|
-
)).to be_falsey
|
139
|
-
end
|
140
|
-
|
141
|
-
it 'false if sys.publishedAt is not present and is_publish_in_future is false' do
|
142
|
-
expect(subject.already_published?(
|
143
|
-
WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2099-04-04T22:00:00+00:00', 'is_publish_in_future' => false})
|
144
|
-
)).to be_falsey
|
145
|
-
end
|
146
|
-
|
147
|
-
it 'true if webhook publish_date is in past and is_publish_in_future is true' do
|
148
|
-
expect(subject.already_published?(
|
149
|
-
WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2011-04-04T22:00:00+00:00', 'is_publish_in_future' => true})
|
150
|
-
)).to be_truthy
|
151
|
-
end
|
152
|
-
|
153
|
-
it 'false if webhook publish_date is in future and is_publish_in_future is false' do
|
154
|
-
expect(subject.already_published?(
|
155
|
-
WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2099-04-04T22:00:00+00:00', 'is_publish_in_future' => false})
|
156
|
-
)).to be_falsey
|
157
|
-
end
|
158
|
-
|
159
|
-
it 'true if webhook publish_date is in future and is_publish_in_future is false' do
|
160
|
-
expect(subject.already_published?(
|
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
|
-
)).to be_truthy
|
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})
|
125
|
+
WebhookDouble.new('bar', 'foo', {'publishedAt' => nil}, {'my_field' => '2099-04-04T22:00:00+00:00'})
|
168
126
|
)).to be_falsey
|
169
127
|
end
|
170
128
|
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.
|
4
|
+
version: '1.19'
|
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-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: contentful-webhook-listener
|