poms 0.0.8 → 0.0.9

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: 1d9fe0f2a709bbbc66715c38852cc26bde86cea4
4
- data.tar.gz: c90e2966ad0002dfe064100157eacb46e3d570cb
3
+ metadata.gz: fa3133cb42150a77d4b5ba7dafe188cee908d1f8
4
+ data.tar.gz: 7fe2a8a6e7533ef3b7c5867ced37c96202e768d4
5
5
  SHA512:
6
- metadata.gz: 6744cf5df57c2e98c6b3c9e48173288704db13486fd1cd1369bdb1c156841c42c806156dee01ff6b5fe16c3574424ed3577160ea6242fb635bbcb5bc94d99b60
7
- data.tar.gz: bc57b88e7595c39a89bf7ea70805c78d214f21ae666b0e9d3197be6929d421b9bc0c32f9c00a1084e731c2e324b3a786c211568097b4d307bb9cff23bc275be0
6
+ metadata.gz: 6e95b7a7dd490080822ebd11a78d002ac9b03c1d6b5497a4777baca53f80fae3e4de2d2861fda84740c3b8c4138c4aafd800b99b34fa45682e56dfc3a1f9f765
7
+ data.tar.gz: 940d70a5e91e3eb6d78cc928213b913a44c9f6a1e1f6a111ae5d293b0ab7a654d6a17e8cfe044a51077292f45a19f6cf2f4c65ba2a8b5cf7d8eaaa05cb3e2081
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- poms (0.0.7)
4
+ poms (0.0.8)
5
5
  activesupport
6
6
 
7
7
  GEM
@@ -33,11 +33,19 @@ module Poms
33
33
  end
34
34
 
35
35
  def available_until
36
- return nil if locations.nil? or locations.empty?
37
- timestamp = locations.map(&:publish_stop).compact.first
36
+ return if predictions.blank?
37
+ timestamp = offline_timestamp(predictions)
38
38
  return Time.at(timestamp / 1000).to_datetime if timestamp
39
39
  end
40
40
 
41
+ private
42
+
43
+ def offline_timestamp(predictions, platform = 'INTERNETVOD')
44
+ timestamps = predictions.map do |p|
45
+ p.publish_stop if p.platform == platform
46
+ end.compact
47
+ timestamps.first unless timestamps.empty?
48
+ end
41
49
  end
42
50
 
43
51
  class Strand < Broadcast
@@ -1,3 +1,3 @@
1
1
  module Poms
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -249,7 +249,18 @@
249
249
  "poProgID": "KRO_1614405",
250
250
  "poSeriesID": "KRO_1521173",
251
251
  "predictions": [
252
- "INTERNETVOD"
252
+ {
253
+ "state": "REALIZED",
254
+ "publishStart": 1434172368000,
255
+ "publishStop": 1435381968000,
256
+ "platform": "INTERNETVOD"
257
+ },
258
+ {
259
+ "state": "REALIZED",
260
+ "publishStart": 1434172368000,
261
+ "publishStop": 1435381968000,
262
+ "platform": "TVVOD"
263
+ }
253
264
  ],
254
265
  "scheduleEvents": [
255
266
  {
@@ -26,7 +26,7 @@ describe Poms::Broadcast do
26
26
  end
27
27
 
28
28
  it 'correctly sets available until' do
29
- expect(poms_broadcast.available_until).to eq(Time.at(1369758599).to_datetime)
29
+ expect(poms_broadcast.available_until).to eq(Time.at(1435381968).to_datetime)
30
30
  end
31
31
 
32
32
  it 'sets the serie correctly when a broadcast only has a season, no series' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Kruijsen
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-04-30 00:00:00.000000000 Z
13
+ date: 2015-06-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler