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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 882c43d8e2365c13832880f3eacd7a8612aa5725
4
- data.tar.gz: 696fe3982d490f5442953610886fa327eafb8b8d
3
+ metadata.gz: 15aeed4e417889439034e9a710d6c423eb3a4208
4
+ data.tar.gz: c1911caefb33bec1cdc3b60607f431ae542d642a
5
5
  SHA512:
6
- metadata.gz: bb4a5b203215327437a06b71317e351207355690dc38b81f83a605433aa38968c6712bb2635a79bfa6d28efee64fa715a6826915ee6c7bcf511c3b9785100e26
7
- data.tar.gz: 14bcd4f2be3179c8859d7af8ffe5f6776a810321ec2db5a9d94c1aecf2a29cfbdc4acb9dfffbc3478328ad02cb95c8166bf830ef0807f4808eda43e4611e35ea
6
+ metadata.gz: a07cc4010b73b47d0381d067876d6814d5cd49ea78b4cf2af3521d3cb2bdab3178f83b29f18d347b0645895951300b8f0e7681f42b59492d688bb69361418168
7
+ data.tar.gz: 30860fbccc5fb2b0f3558c2bcbd77802da7b3c46f070ca779aa68b0775bcac8c36fc981aa460df335cbeb37598673d5a2b98faf36ba8ba7146f489c5a2e9e146
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 3.0.3 - 2015-04-09
2
+
3
+ ### Added
4
+ - Variants if using the API
5
+
1
6
  ## 3.0.2 - 2015-04-09
2
7
 
3
8
  - fix HTML ampersands in film titles
@@ -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
@@ -1,6 +1,6 @@
1
1
  # Ruby interface for http://www.odeon.co.uk
2
- # @version 3.0.2
2
+ # @version 3.0.3
3
3
  module OdeonUk
4
4
  # Gem version
5
- VERSION = '3.0.2'
5
+ VERSION = '3.0.3'
6
6
  end
@@ -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.2
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-09 00:00:00.000000000 Z
11
+ date: 2015-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake