odeon_uk 3.0.2 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/odeon_uk/api/screenings.rb +15 -1
- data/lib/odeon_uk/version.rb +2 -2
- data/test/lib/odeon_uk/api/screenings_test.rb +15 -0
- 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: 15aeed4e417889439034e9a710d6c423eb3a4208
|
4
|
+
data.tar.gz: c1911caefb33bec1cdc3b60607f431ae542d642a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a07cc4010b73b47d0381d067876d6814d5cd49ea78b4cf2af3521d3cb2bdab3178f83b29f18d347b0645895951300b8f0e7681f42b59492d688bb69361418168
|
7
|
+
data.tar.gz: 30860fbccc5fb2b0f3558c2bcbd77802da7b3c46f070ca779aa68b0775bcac8c36fc981aa460df335cbeb37598673d5a2b98faf36ba8ba7146f489c5a2e9e146
|
data/CHANGELOG.md
CHANGED
@@ -23,7 +23,7 @@ module OdeonUk
|
|
23
23
|
dimension: screening['attribute'].include?('3D') ? '3d' : '2d',
|
24
24
|
film_name: films_map(cinema_id)[film_id],
|
25
25
|
time: TimeParser.new(date, p[0]['performanceTime']).to_utc,
|
26
|
-
variant: ''
|
26
|
+
variant: VariantParser.new(screening['attribute']).to_a
|
27
27
|
}
|
28
28
|
end
|
29
29
|
end
|
@@ -85,5 +85,19 @@ module OdeonUk
|
|
85
85
|
@tz ||= TZInfo::Timezone.get('Europe/London')
|
86
86
|
end
|
87
87
|
end
|
88
|
+
|
89
|
+
VariantParser = Struct.new(:text) do
|
90
|
+
TRANSLATOR = {
|
91
|
+
'Culture' => 'arts',
|
92
|
+
'Kids' => 'kids',
|
93
|
+
'IMAX' => 'imax',
|
94
|
+
'Newbies' => 'baby',
|
95
|
+
'Silver Cinema' => 'senior'
|
96
|
+
}
|
97
|
+
|
98
|
+
def to_a
|
99
|
+
TRANSLATOR.select { |k, _| text.include?(k) }.values.uniq
|
100
|
+
end
|
101
|
+
end
|
88
102
|
end
|
89
103
|
end
|
data/lib/odeon_uk/version.rb
CHANGED
@@ -30,12 +30,27 @@ describe OdeonUk::Api::Screenings do
|
|
30
30
|
screening[:time].must_be_instance_of(Time)
|
31
31
|
|
32
32
|
screening.keys.must_include(:variant)
|
33
|
+
screening[:variant].must_be_instance_of(Array)
|
33
34
|
|
34
35
|
screening.keys.must_include(:dimension)
|
35
36
|
screening[:dimension].must_match(/[23]d/)
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
40
|
+
it 'returns at least some non-empty variants' do
|
41
|
+
variants = subject.map { |screening| screening[:variant] }
|
42
|
+
variants.select { |v| !v.empty? }.count.must_be :>, 0
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'returns valid variant types' do
|
46
|
+
variants = subject.map { |screening| screening[:variant] }
|
47
|
+
variants.each do |v|
|
48
|
+
if v.length > 0
|
49
|
+
v.each { |e| %w(arts kids imax baby senior).must_include(e) }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
39
54
|
it 'returns correct number of screenings' do
|
40
55
|
subject.count.must_equal 159
|
41
56
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: odeon_uk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Croll
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04
|
11
|
+
date: 2015-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|