poms 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +19 -2
- data/lib/poms.rb +22 -2
- data/lib/poms/builderless/broadcast.rb +36 -0
- data/lib/poms/builderless/clip.rb +36 -0
- data/lib/poms/connect.rb +13 -0
- data/lib/poms/fields.rb +22 -0
- data/lib/poms/version.rb +1 -1
- data/lib/poms/views.rb +24 -0
- data/poms.gemspec +2 -0
- data/spec/fixtures/vcr_cassettes/poms/builderless/clip/has_a_position.yml +43 -0
- data/spec/fixtures/vcr_cassettes/poms/builderless/clip/has_a_title.yml +43 -0
- data/spec/fixtures/vcr_cassettes/poms/builderless/clip/has_a_video_url.yml +43 -0
- data/spec/fixtures/vcr_cassettes/poms/builderless/clip/has_an_image_id.yml +43 -0
- data/spec/fixtures/vcr_cassettes/poms/fetch_broadcasts_fetch_current_broadcast_fetches_the_current_broadcast.yml +60 -0
- data/spec/fixtures/vcr_cassettes/poms_fetch/a_broadcast_has_scheduled_events_with_last_with_starts_at.yml +43 -0
- data/spec/fixtures/vcr_cassettes/poms_fetch/a_clip_has_a_title.yml +43 -0
- data/spec/fixtures/vcr_cassettes/poms_fetch/an_aankeiler_has_images.yml +43 -0
- data/spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast/has_a_mid.yml +51 -0
- data/spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast/has_a_title.yml +51 -0
- data/spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast/has_scheduled_events_with_last_with_starts_at.yml +51 -0
- data/spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast_and_key/has_a_broadcast_with_a_mid.yml +51 -0
- data/spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast_and_key/has_a_key.yml +51 -0
- data/spec/fixtures/vcr_cassettes/poms_fetch_group/has_a_child_with_a_media_type.yml +422 -0
- data/spec/fixtures/vcr_cassettes/poms_fetch_group/has_a_child_with_a_title.yml +422 -0
- data/spec/fixtures/vcr_cassettes/poms_fetch_playlist_clips/creates_an_array_of_clips.yml +970 -0
- data/spec/integration/poms_spec.rb +75 -0
- data/spec/lib/poms/{buider_spec.rb → builder_spec.rb} +0 -0
- data/spec/lib/poms/builderless/clip_spec.rb +20 -0
- data/spec/lib/poms/views_spec.rb +14 -2
- data/spec/lib/poms_spec.rb +7 -1
- data/spec/spec_helper.rb +23 -0
- metadata +72 -4
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Poms do
|
4
|
+
|
5
|
+
describe '#fetch_current_broadcast' do
|
6
|
+
let(:current_broadcast) { Poms.fetch_current_broadcast('NED3') }
|
7
|
+
|
8
|
+
it 'has a title' do
|
9
|
+
expect(current_broadcast.title).to be_present
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'has a mid' do
|
13
|
+
expect(current_broadcast.mid).to be_present
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'has scheduled events with last with starts_at' do
|
17
|
+
expect(current_broadcast.schedule_events.last.starts_at).to be_present
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#fetch_current_broadcast_and_key' do
|
22
|
+
let(:current_broadcast) { Poms.fetch_current_broadcast_and_key('NED3') }
|
23
|
+
|
24
|
+
it 'has a key' do
|
25
|
+
expect(current_broadcast[:key]).to be_present
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'has a broadcast with a mid' do
|
29
|
+
expect(current_broadcast[:broadcast].mid).to be_present
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#fetch an aankeiler' do
|
34
|
+
let(:result) { Poms.fetch('WO_NPO_698651') }
|
35
|
+
|
36
|
+
it 'has images' do
|
37
|
+
expect(result.images.first.image_uri).to be_present
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#fetch a broadcast' do
|
42
|
+
let(:result) { Poms.fetch('POW_00182680') }
|
43
|
+
|
44
|
+
it 'has scheduled events with last with starts_at' do
|
45
|
+
expect(result.schedule_events.last.starts_at).to be_present
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '#fetch a clip' do
|
50
|
+
let(:clip) { Poms.fetch('POMS_EO_622912') }
|
51
|
+
|
52
|
+
it 'has a title' do
|
53
|
+
expect(clip['titles']).to be_present
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe '#fetch_group' do
|
58
|
+
let(:clip) { Poms.fetch_group('POMS_S_NPO_823012')['rows'].first['doc'] }
|
59
|
+
|
60
|
+
it 'has a child with a title' do
|
61
|
+
expect(clip['titles']).to be_present
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'has a child with a media type' do
|
65
|
+
expect(clip['avType']).to be_present
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'has a child with a media type' do
|
69
|
+
expect(clip['mid']).to be_present
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe '#upcoming_broadcasts'
|
74
|
+
describe '#fetch_descendant_mids'
|
75
|
+
end
|
File without changes
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Poms::Builderless::Clip do
|
4
|
+
let(:clip) { Poms.fetch_clip('WO_NPO_1950962') }
|
5
|
+
|
6
|
+
it 'has a title' do
|
7
|
+
expect(clip.title).to eq 'Liedje: de wielen van de bus'
|
8
|
+
end
|
9
|
+
it 'has a video url' do
|
10
|
+
expect(clip.video_url).to eq 'http://download.omroep.nl/npo/zappelin/DWVZ_AFL_86_De_wielen_van_de_bus.mp4'
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'has an image id' do
|
14
|
+
expect(clip.image_id).to eq '653515'
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'has a position' do
|
18
|
+
expect(clip.position).to eq 1
|
19
|
+
end
|
20
|
+
end
|
data/spec/lib/poms/views_spec.rb
CHANGED
@@ -1,7 +1,19 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Poms::Views do
|
4
|
-
|
5
|
-
|
4
|
+
describe "#get" do
|
5
|
+
let(:response) { File.read 'spec/fixtures/poms_broadcast.json' }
|
6
|
+
|
7
|
+
it 'returns a metadata object' do
|
8
|
+
FakeWeb.register_uri(:get, "http://docs.poms.omroep.nl/media/KRO_1614405", :body => response)
|
9
|
+
expect(subject.get('KRO_1614405')).to eq(JSON.parse response)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#by_group" do
|
14
|
+
|
15
|
+
it 'returns the correct group url' do
|
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
|
+
end
|
6
18
|
end
|
7
19
|
end
|
data/spec/lib/poms_spec.rb
CHANGED
@@ -33,6 +33,12 @@ describe Poms do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
describe '#fetch_playlist_clips' do
|
37
|
+
it 'creates an array of clips' do
|
38
|
+
expect(Poms.fetch_playlist_clips('POMS_S_NPO_818759').size).to eq(21)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
36
42
|
describe '#fetch_broadcasts_for_serie' do
|
37
43
|
it 'returns nil when a broadcast does not exist' do
|
38
44
|
FakeWeb.register_uri(:get, "http://docs.poms.omroep.nl/media/_design/media/_view/by-ancestor-and-type?reduce=false&key=[%22BLA%22,%22BROADCAST%22]&include_docs=true", :status => [404, "Not Found"])
|
@@ -75,7 +81,7 @@ describe Poms do
|
|
75
81
|
end
|
76
82
|
|
77
83
|
it "fetches the current broadcast" do
|
78
|
-
expect(Poms::Builder).to receive(:process_hash).exactly(
|
84
|
+
expect(Poms::Builder).to receive(:process_hash).exactly(0).times
|
79
85
|
Poms.fetch_current_broadcast('NED3')
|
80
86
|
end
|
81
87
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,6 +2,29 @@ require 'rubygems'
|
|
2
2
|
require 'bundler/setup'
|
3
3
|
require 'fakeweb'
|
4
4
|
require 'fabrication'
|
5
|
+
require 'vcr'
|
6
|
+
require 'timecop'
|
5
7
|
require 'poms' # and any other gems you need
|
6
8
|
|
7
9
|
FakeWeb.allow_net_connect = false
|
10
|
+
|
11
|
+
VCR.configure do |config|
|
12
|
+
config.cassette_library_dir = "spec/fixtures/vcr_cassettes"
|
13
|
+
config.hook_into :fakeweb
|
14
|
+
end
|
15
|
+
|
16
|
+
RSpec.configure do |config|
|
17
|
+
config.around(:each) do |example|
|
18
|
+
options = example.metadata[:vcr] || {}
|
19
|
+
if options[:record] == :skip
|
20
|
+
VCR.turned_off(&example)
|
21
|
+
else
|
22
|
+
name = example.metadata[:full_description].split(/\s+/, 2).join('/').underscore.gsub(/[^\w\/]+/, '_')
|
23
|
+
VCR.use_cassette(name, options, &example)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
config.before(:suite) do
|
28
|
+
Timecop.freeze Time.utc(2015, 10, 6, 12)
|
29
|
+
end
|
30
|
+
end
|
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.
|
4
|
+
version: 0.0.10
|
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-
|
13
|
+
date: 2015-10-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -110,6 +110,20 @@ dependencies:
|
|
110
110
|
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '0'
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: rubocop
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
type: :development
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
113
127
|
- !ruby/object:Gem::Dependency
|
114
128
|
name: timecop
|
115
129
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,6 +138,20 @@ dependencies:
|
|
124
138
|
- - ">="
|
125
139
|
- !ruby/object:Gem::Version
|
126
140
|
version: '0'
|
141
|
+
- !ruby/object:Gem::Dependency
|
142
|
+
name: vcr
|
143
|
+
requirement: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
type: :development
|
149
|
+
prerelease: false
|
150
|
+
version_requirements: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
127
155
|
- !ruby/object:Gem::Dependency
|
128
156
|
name: activesupport
|
129
157
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,6 +185,10 @@ files:
|
|
157
185
|
- lib/poms/base.rb
|
158
186
|
- lib/poms/broadcast.rb
|
159
187
|
- lib/poms/builder.rb
|
188
|
+
- lib/poms/builderless/broadcast.rb
|
189
|
+
- lib/poms/builderless/clip.rb
|
190
|
+
- lib/poms/connect.rb
|
191
|
+
- lib/poms/fields.rb
|
160
192
|
- lib/poms/has_ancestors.rb
|
161
193
|
- lib/poms/has_base_attributes.rb
|
162
194
|
- lib/poms/schedule_event.rb
|
@@ -173,8 +205,26 @@ files:
|
|
173
205
|
- spec/fixtures/poms_series.json
|
174
206
|
- spec/fixtures/poms_single_broadcast_by_channel.json
|
175
207
|
- spec/fixtures/poms_zapp.json
|
208
|
+
- spec/fixtures/vcr_cassettes/poms/builderless/clip/has_a_position.yml
|
209
|
+
- spec/fixtures/vcr_cassettes/poms/builderless/clip/has_a_title.yml
|
210
|
+
- spec/fixtures/vcr_cassettes/poms/builderless/clip/has_a_video_url.yml
|
211
|
+
- spec/fixtures/vcr_cassettes/poms/builderless/clip/has_an_image_id.yml
|
212
|
+
- spec/fixtures/vcr_cassettes/poms/fetch_broadcasts_fetch_current_broadcast_fetches_the_current_broadcast.yml
|
213
|
+
- spec/fixtures/vcr_cassettes/poms_fetch/a_broadcast_has_scheduled_events_with_last_with_starts_at.yml
|
214
|
+
- spec/fixtures/vcr_cassettes/poms_fetch/a_clip_has_a_title.yml
|
215
|
+
- spec/fixtures/vcr_cassettes/poms_fetch/an_aankeiler_has_images.yml
|
216
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast/has_a_mid.yml
|
217
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast/has_a_title.yml
|
218
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast/has_scheduled_events_with_last_with_starts_at.yml
|
219
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast_and_key/has_a_broadcast_with_a_mid.yml
|
220
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast_and_key/has_a_key.yml
|
221
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_group/has_a_child_with_a_media_type.yml
|
222
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_group/has_a_child_with_a_title.yml
|
223
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_playlist_clips/creates_an_array_of_clips.yml
|
224
|
+
- spec/integration/poms_spec.rb
|
176
225
|
- spec/lib/poms/broadcast_spec.rb
|
177
|
-
- spec/lib/poms/
|
226
|
+
- spec/lib/poms/builder_spec.rb
|
227
|
+
- spec/lib/poms/builderless/clip_spec.rb
|
178
228
|
- spec/lib/poms/schedule_event_spec.rb
|
179
229
|
- spec/lib/poms/views_spec.rb
|
180
230
|
- spec/lib/poms_spec.rb
|
@@ -212,8 +262,26 @@ test_files:
|
|
212
262
|
- spec/fixtures/poms_series.json
|
213
263
|
- spec/fixtures/poms_single_broadcast_by_channel.json
|
214
264
|
- spec/fixtures/poms_zapp.json
|
265
|
+
- spec/fixtures/vcr_cassettes/poms/builderless/clip/has_a_position.yml
|
266
|
+
- spec/fixtures/vcr_cassettes/poms/builderless/clip/has_a_title.yml
|
267
|
+
- spec/fixtures/vcr_cassettes/poms/builderless/clip/has_a_video_url.yml
|
268
|
+
- spec/fixtures/vcr_cassettes/poms/builderless/clip/has_an_image_id.yml
|
269
|
+
- spec/fixtures/vcr_cassettes/poms/fetch_broadcasts_fetch_current_broadcast_fetches_the_current_broadcast.yml
|
270
|
+
- spec/fixtures/vcr_cassettes/poms_fetch/a_broadcast_has_scheduled_events_with_last_with_starts_at.yml
|
271
|
+
- spec/fixtures/vcr_cassettes/poms_fetch/a_clip_has_a_title.yml
|
272
|
+
- spec/fixtures/vcr_cassettes/poms_fetch/an_aankeiler_has_images.yml
|
273
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast/has_a_mid.yml
|
274
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast/has_a_title.yml
|
275
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast/has_scheduled_events_with_last_with_starts_at.yml
|
276
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast_and_key/has_a_broadcast_with_a_mid.yml
|
277
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_current_broadcast_and_key/has_a_key.yml
|
278
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_group/has_a_child_with_a_media_type.yml
|
279
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_group/has_a_child_with_a_title.yml
|
280
|
+
- spec/fixtures/vcr_cassettes/poms_fetch_playlist_clips/creates_an_array_of_clips.yml
|
281
|
+
- spec/integration/poms_spec.rb
|
215
282
|
- spec/lib/poms/broadcast_spec.rb
|
216
|
-
- spec/lib/poms/
|
283
|
+
- spec/lib/poms/builder_spec.rb
|
284
|
+
- spec/lib/poms/builderless/clip_spec.rb
|
217
285
|
- spec/lib/poms/schedule_event_spec.rb
|
218
286
|
- spec/lib/poms/views_spec.rb
|
219
287
|
- spec/lib/poms_spec.rb
|