picturehouse_uk 3.0.10 → 3.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/picturehouse_uk/internal/parser/screenings.rb +18 -13
- data/lib/picturehouse_uk/version.rb +2 -2
- data/test/fixture_updater.rb +7 -0
- data/test/fixtures/cinema/National_Media_Museum.html +8464 -0
- data/test/lib/picturehouse_uk/internal/parser/screenings_test.rb +29 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c55a396b0cc0237fce8db0de30fd4b37240e9d6
|
4
|
+
data.tar.gz: 81b7a2c9c87b2f8d1631dd66905a4681337f40ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99f9f4b2c2452830dbf3e7576bd9d7b53e2742d16e5fca9184bfcd572f8f0a656c1495d926077d28e3f5236468805fcaf836eab15c9c873912e96ef0ca5b1afc
|
7
|
+
data.tar.gz: 87976c1fdcf3fe9d31ed161b2264b7b231c2c1a0bd8d95a2f21d387cf9288bbb8bae21be24757f90f8bf4cd992216edf98d75917d751249ea0d9ccb557c512ec
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [3.0.11] - 2015-05-03
|
5
|
+
|
6
|
+
### Added
|
7
|
+
- Variants work. 'arts', 'baby', 'kids', 'imax', 'senior'
|
8
|
+
- Test for screening booking urls
|
9
|
+
- Test for screenings at National Museum IMAX picturehouse
|
10
|
+
|
4
11
|
## [3.0.10] - 2015-04-12
|
5
12
|
|
6
13
|
### Changed
|
@@ -81,9 +81,19 @@ module PicturehouseUk
|
|
81
81
|
|
82
82
|
# variants can have multiple screenings
|
83
83
|
Variant = Struct.new(:node, :date) do
|
84
|
-
SHOWTIMES
|
85
|
-
VARIANT
|
86
|
-
|
84
|
+
SHOWTIMES = '.btn'
|
85
|
+
VARIANT = '.film-type-desc'
|
86
|
+
TRANSLATOR = {
|
87
|
+
'Big Scream' => 'baby',
|
88
|
+
'IMAX' => 'imax',
|
89
|
+
"Kids' Club" => 'kids',
|
90
|
+
'NT Live' => 'arts',
|
91
|
+
'Screen Arts' => 'arts',
|
92
|
+
'Silver Screen' => 'senior'
|
93
|
+
}
|
94
|
+
|
95
|
+
# Variant arrays
|
96
|
+
# @return [Array<Hash>]
|
87
97
|
def to_a
|
88
98
|
node.css(SHOWTIMES).map do |node|
|
89
99
|
{ variant: variant }.merge(Showtime.new(node, date).to_hash)
|
@@ -93,21 +103,16 @@ module PicturehouseUk
|
|
93
103
|
private
|
94
104
|
|
95
105
|
def variant
|
96
|
-
@variant ||=
|
106
|
+
@variant ||= TRANSLATOR.select { |k, _| variant_text.include?(k) }.values
|
107
|
+
end
|
108
|
+
|
109
|
+
def variant_text
|
110
|
+
@variant_text ||= node.css(VARIANT).to_s
|
97
111
|
end
|
98
112
|
end
|
99
113
|
|
100
114
|
# parse an individual screening node
|
101
115
|
Showtime = Struct.new(:node, :date) do
|
102
|
-
# the attributes of a single screening
|
103
|
-
# @return [Hash]
|
104
|
-
# @example
|
105
|
-
# PicturehouseUk::Internal::ScreeningParser.new(html).to_hash
|
106
|
-
# => {
|
107
|
-
# booking_url: 'http://...',
|
108
|
-
# time: <Time>,
|
109
|
-
# variant: ['imax']
|
110
|
-
# }
|
111
116
|
def to_hash
|
112
117
|
{
|
113
118
|
booking_url: node['href'],
|
data/test/fixture_updater.rb
CHANGED
@@ -44,3 +44,10 @@ File.open(fixture('info/Phoenix_Picturehouse'), 'w') do |file|
|
|
44
44
|
puts '* Pheonix Oxford Information'
|
45
45
|
file.write PicturehouseUk::Internal::Website.new.info('Phoenix_Picturehouse')
|
46
46
|
end
|
47
|
+
|
48
|
+
# NATIONAL MEDIA MUSEUM (IMAX)
|
49
|
+
|
50
|
+
File.open(fixture('cinema/National_Media_Museum'), 'w') do |file|
|
51
|
+
puts '* National Media Museum'
|
52
|
+
file.write PicturehouseUk::Internal::Website.new.cinema('National_Media_Museum')
|
53
|
+
end
|