poms 1.1.0 → 1.2.0
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/CHANGELOG.md +9 -1
- data/Gemfile.lock +2 -2
- data/lib/poms.rb +17 -18
- data/lib/poms/fields.rb +59 -3
- data/lib/poms/version.rb +1 -1
- data/lib/poms/views.rb +17 -22
- data/spec/fixtures/vcr_cassettes/poms_fetch_broadcasts_for_serie/returns_nil_when_a_broadcast_does_not_exist.yml +42 -0
- data/spec/fixtures/vcr_cassettes/poms_fetch_descendant_mids/returns_a_list_of_mids.yml +42 -0
- data/spec/fixtures/vcr_cassettes/poms_fetch_descendants_for_serie/builds_a_list_of_broadcasts.yml +102755 -0
- data/spec/integration/poms_spec.rb +14 -1
- data/spec/lib/poms/fields_spec.rb +46 -0
- data/spec/lib/poms/views_spec.rb +19 -0
- metadata +10 -2
@@ -70,5 +70,18 @@ describe Poms do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
describe '#upcoming_broadcasts'
|
73
|
-
|
73
|
+
|
74
|
+
describe '#fetch_descendant_mids' do
|
75
|
+
let(:result) { Poms.fetch_descendant_mids('POMS_S_KRO_059861') }
|
76
|
+
it 'returns a list of mids' do
|
77
|
+
expect(result.first).to eq('KN_1655665')
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe '#fetch_descendants_for_serie' do
|
82
|
+
let(:result) { Poms.fetch_descendants_for_serie('POMS_S_KRO_059861') }
|
83
|
+
it 'builds a list of broadcasts' do
|
84
|
+
expect(result.first.mid).to eq('KN_1655665')
|
85
|
+
end
|
86
|
+
end
|
74
87
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Poms::Fields do
|
4
|
+
let(:poms_data) { JSON.parse File.read('spec/fixtures/poms_broadcast.json') }
|
5
|
+
|
6
|
+
describe '#title' do
|
7
|
+
it 'returns the first MAIN title' do
|
8
|
+
expect(described_class.title(poms_data)).to eq('VRijland')
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#description' do
|
13
|
+
it 'returns the first MAIN description' do
|
14
|
+
expect(described_class.description(poms_data)).to eq("Li biedt Barry \
|
15
|
+
een baantje aan bij de uitdragerij en vraagt zich meteen af of dat wel zo slim \
|
16
|
+
was. Timon en Joep zien de criminele organisatie de Rijland Angels. Timon wil \
|
17
|
+
naar hun loods, maar is dat wel een goed idee?")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#first_image_id' do
|
22
|
+
it 'returns the id of the first image' do
|
23
|
+
expect(described_class.first_image_id(poms_data)).to eq('184169')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#rev' do
|
28
|
+
it 'returns the current Poms revision' do
|
29
|
+
expect(described_class.rev(poms_data)).to eq(60)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#odi_streams' do
|
34
|
+
it 'returns an array of stream types' do
|
35
|
+
expect(described_class.odi_streams(poms_data)).to match_array(
|
36
|
+
%w(adaptive h264_sb h264_bb h264_std wvc1_std wmv_sb wmv_bb))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#available_until' do
|
41
|
+
it 'returns the enddate of the INTERNETVOD prediction' do
|
42
|
+
expect(described_class.available_until(poms_data))
|
43
|
+
.to eq('Sat, 27 Jun 2015 07:12:48 +0200')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/spec/lib/poms/views_spec.rb
CHANGED
@@ -16,4 +16,23 @@ describe Poms::Views do
|
|
16
16
|
expect(subject.by_group('POMS_S_NPO_823012')).to eq('http://docs.poms.omroep.nl/media/_design/media/_view/by-group?include_docs=true&key=%22POMS_S_NPO_823012%22&reduce=false')
|
17
17
|
end
|
18
18
|
end
|
19
|
+
|
20
|
+
describe '#descendants_by_type' do
|
21
|
+
it 'builds a url' do
|
22
|
+
expect(subject.descendants_by_type('POMS_S_NPO_823012'))
|
23
|
+
.to eq(
|
24
|
+
'http://docs.poms.omroep.nl/media/_design/media/_view/by-ancestor-and-type?include_docs=true&key=%5B%22POMS_S_NPO_823012%22%2C+%22BROADCAST%22%5D&reduce=false'
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'can switch to not include docs' do
|
29
|
+
expect(
|
30
|
+
subject.descendants_by_type('POMS_S_NPO_823012',
|
31
|
+
'BROADCAST',
|
32
|
+
include_docs: false))
|
33
|
+
.to eq(
|
34
|
+
'http://docs.poms.omroep.nl/media/_design/media/_view/by-ancestor-and-type?include_docs=false&key=%5B%22POMS_S_NPO_823012%22%2C+%22BROADCAST%22%5D&reduce=false'
|
35
|
+
)
|
36
|
+
end
|
37
|
+
end
|
19
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Kruijsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -219,11 +219,14 @@ files:
|
|
219
219
|
- spec/fixtures/vcr_cassettes/poms_fetch/a_broadcast_has_scheduled_events_with_last_with_starts_at.yml
|
220
220
|
- spec/fixtures/vcr_cassettes/poms_fetch/a_clip_has_a_title.yml
|
221
221
|
- spec/fixtures/vcr_cassettes/poms_fetch/an_aankeiler_has_images.yml
|
222
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_broadcasts_for_serie/returns_nil_when_a_broadcast_does_not_exist.yml
|
222
223
|
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast/has_a_mid.yml
|
223
224
|
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast/has_a_title.yml
|
224
225
|
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast/has_scheduled_events_with_last_with_starts_at.yml
|
225
226
|
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast_and_key/has_a_broadcast_with_a_mid.yml
|
226
227
|
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast_and_key/has_a_key.yml
|
228
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_descendant_mids/returns_a_list_of_mids.yml
|
229
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_descendants_for_serie/builds_a_list_of_broadcasts.yml
|
227
230
|
- spec/fixtures/vcr_cassettes/poms_fetch_group/has_a_child_with_a_media_type.yml
|
228
231
|
- spec/fixtures/vcr_cassettes/poms_fetch_group/has_a_child_with_a_title.yml
|
229
232
|
- spec/fixtures/vcr_cassettes/poms_fetch_playlist_clips/creates_an_array_of_clips.yml
|
@@ -234,6 +237,7 @@ files:
|
|
234
237
|
- spec/lib/poms/builder_spec.rb
|
235
238
|
- spec/lib/poms/builderless/broadcast_spec.rb
|
236
239
|
- spec/lib/poms/builderless/clip_spec.rb
|
240
|
+
- spec/lib/poms/fields_spec.rb
|
237
241
|
- spec/lib/poms/merged_series_spec.rb
|
238
242
|
- spec/lib/poms/schedule_event_spec.rb
|
239
243
|
- spec/lib/poms/timestamp_spec.rb
|
@@ -285,11 +289,14 @@ test_files:
|
|
285
289
|
- spec/fixtures/vcr_cassettes/poms_fetch/a_broadcast_has_scheduled_events_with_last_with_starts_at.yml
|
286
290
|
- spec/fixtures/vcr_cassettes/poms_fetch/a_clip_has_a_title.yml
|
287
291
|
- spec/fixtures/vcr_cassettes/poms_fetch/an_aankeiler_has_images.yml
|
292
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_broadcasts_for_serie/returns_nil_when_a_broadcast_does_not_exist.yml
|
288
293
|
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast/has_a_mid.yml
|
289
294
|
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast/has_a_title.yml
|
290
295
|
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast/has_scheduled_events_with_last_with_starts_at.yml
|
291
296
|
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast_and_key/has_a_broadcast_with_a_mid.yml
|
292
297
|
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast_and_key/has_a_key.yml
|
298
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_descendant_mids/returns_a_list_of_mids.yml
|
299
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_descendants_for_serie/builds_a_list_of_broadcasts.yml
|
293
300
|
- spec/fixtures/vcr_cassettes/poms_fetch_group/has_a_child_with_a_media_type.yml
|
294
301
|
- spec/fixtures/vcr_cassettes/poms_fetch_group/has_a_child_with_a_title.yml
|
295
302
|
- spec/fixtures/vcr_cassettes/poms_fetch_playlist_clips/creates_an_array_of_clips.yml
|
@@ -300,6 +307,7 @@ test_files:
|
|
300
307
|
- spec/lib/poms/builder_spec.rb
|
301
308
|
- spec/lib/poms/builderless/broadcast_spec.rb
|
302
309
|
- spec/lib/poms/builderless/clip_spec.rb
|
310
|
+
- spec/lib/poms/fields_spec.rb
|
303
311
|
- spec/lib/poms/merged_series_spec.rb
|
304
312
|
- spec/lib/poms/schedule_event_spec.rb
|
305
313
|
- spec/lib/poms/timestamp_spec.rb
|