picturehouse_uk 3.0.14 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -3
- data/CHANGELOG.md +19 -0
- data/{LICENSE.txt → COMM-LICENSE} +0 -0
- data/LICENSE +617 -0
- data/README.md +5 -4
- data/Rakefile +12 -0
- data/lib/picturehouse_uk.rb +2 -4
- data/lib/picturehouse_uk/cinema.rb +133 -124
- data/lib/picturehouse_uk/internal/parser/address.rb +20 -8
- data/lib/picturehouse_uk/internal/parser/screenings.rb +70 -28
- data/lib/picturehouse_uk/internal/title_sanitizer.rb +61 -65
- data/lib/picturehouse_uk/performance.rb +60 -0
- data/lib/picturehouse_uk/version.rb +2 -2
- data/picturehouse_uk.gemspec +5 -6
- data/rake/fixture_creator.rb +42 -0
- data/test/fixtures/Duke_Of_Yorks/cinema.html +3408 -0
- data/test/fixtures/{info/Duke_Of_Yorks.html → Duke_Of_Yorks/info.html} +192 -185
- data/test/fixtures/Duke_Of_Yorks/whats_on.html +3159 -0
- data/test/fixtures/Dukes_At_Komedia/cinema.html +4764 -0
- data/test/fixtures/{info/Dukes_At_Komedia.html → Dukes_At_Komedia/info.html} +161 -172
- data/test/fixtures/Dukes_At_Komedia/whats_on.html +4429 -0
- data/test/fixtures/National_Media_Museum/cinema.html +9200 -0
- data/test/fixtures/National_Media_Museum/info.html +606 -0
- data/test/fixtures/National_Media_Museum/whats_on.html +8850 -0
- data/test/fixtures/Phoenix_Picturehouse/cinema.html +8274 -0
- data/test/fixtures/{info/Phoenix_Picturehouse.html → Phoenix_Picturehouse/info.html} +165 -176
- data/test/fixtures/Phoenix_Picturehouse/whats_on.html +7986 -0
- data/test/fixtures/home.html +148 -157
- data/test/lib/picturehouse_uk/cinema_test.rb +107 -136
- data/test/lib/picturehouse_uk/internal/parser/{address_parser_test.rb → address_test.rb} +3 -3
- data/test/lib/picturehouse_uk/internal/parser/screenings_test.rb +8 -10
- data/test/lib/picturehouse_uk/internal/website_test.rb +6 -3
- data/test/lib/picturehouse_uk/{screening_test.rb → performance_test.rb} +20 -44
- data/test/live/integration_test.rb +8 -25
- data/test/support/fake_website.rb +24 -0
- data/test/test_helper.rb +12 -2
- metadata +50 -49
- data/.rdoc_options +0 -16
- data/lib/picturehouse_uk/film.rb +0 -59
- data/lib/picturehouse_uk/screening.rb +0 -70
- data/test/fixture_updater.rb +0 -73
- data/test/fixtures/cinema/Duke_Of_Yorks.html +0 -2984
- data/test/fixtures/cinema/Dukes_At_Komedia.html +0 -5518
- data/test/fixtures/cinema/National_Media_Museum.html +0 -10266
- data/test/fixtures/cinema/Phoenix_Picturehouse.html +0 -5202
- data/test/fixtures/whats_on/Duke_Of_Yorks.html +0 -2737
- data/test/fixtures/whats_on/Dukes_At_Komedia.html +0 -5132
- data/test/fixtures/whats_on/National_Media_Museum.html +0 -9690
- data/test/fixtures/whats_on/Phoenix_Picturehouse.html +0 -4916
- data/test/lib/picturehouse_uk/film_test.rb +0 -141
@@ -1,7 +1,9 @@
|
|
1
1
|
require 'minitest/autorun'
|
2
2
|
require 'minitest/reporters'
|
3
|
-
|
4
|
-
Minitest::Reporters.use! [
|
3
|
+
|
4
|
+
Minitest::Reporters.use! [
|
5
|
+
Minitest::Reporters::DefaultReporter.new(color: true)
|
6
|
+
]
|
5
7
|
|
6
8
|
require File.expand_path('../../../lib/picturehouse_uk.rb', __FILE__)
|
7
9
|
|
@@ -29,35 +31,16 @@ describe PicturehouseUk::Cinema do
|
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|
32
|
-
describe PicturehouseUk::
|
33
|
-
let(:described_class) { PicturehouseUk::
|
34
|
-
|
35
|
-
describe '.at(cinema_id)' do
|
36
|
-
subject { described_class.at('Duke_Of_Yorks') }
|
37
|
-
|
38
|
-
it 'returns an array of films' do
|
39
|
-
subject.must_be_instance_of(Array)
|
40
|
-
subject.each do |film|
|
41
|
-
film.must_be_instance_of(PicturehouseUk::Film)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'returns a decent number of films' do
|
46
|
-
subject.count.must_be :>, 5
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe PicturehouseUk::Screening do
|
52
|
-
let(:described_class) { PicturehouseUk::Screening }
|
34
|
+
describe PicturehouseUk::Performance do
|
35
|
+
let(:described_class) { PicturehouseUk::Performance }
|
53
36
|
|
54
37
|
describe '.at(cinema_id)' do
|
55
38
|
subject { described_class.at('Duke_Of_Yorks') }
|
56
39
|
|
57
40
|
it 'returns an array of screenings' do
|
58
41
|
subject.must_be_instance_of(Array)
|
59
|
-
subject.each do |
|
60
|
-
|
42
|
+
subject.each do |performance|
|
43
|
+
performance.must_be_instance_of(PicturehouseUk::Performance)
|
61
44
|
end
|
62
45
|
end
|
63
46
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Fake website for reading fixtures from disk
|
2
|
+
class FakeWebsite
|
3
|
+
def home
|
4
|
+
read_file('../../fixtures/home.html')
|
5
|
+
end
|
6
|
+
|
7
|
+
def cinema(cinema_id)
|
8
|
+
read_file("../../fixtures/#{cinema_id}/cinema.html")
|
9
|
+
end
|
10
|
+
|
11
|
+
def info(cinema_id)
|
12
|
+
read_file("../../fixtures/#{cinema_id}/info.html")
|
13
|
+
end
|
14
|
+
|
15
|
+
def whats_on(cinema_id)
|
16
|
+
read_file("../../fixtures/#{cinema_id}/whats_on.html")
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def read_file(filepath)
|
22
|
+
File.read(File.expand_path(filepath, __FILE__))
|
23
|
+
end
|
24
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -1,8 +1,18 @@
|
|
1
|
+
require 'codeclimate-test-reporter'
|
2
|
+
CodeClimate::TestReporter.start
|
3
|
+
|
1
4
|
require 'minitest/autorun'
|
2
5
|
require 'minitest/reporters'
|
3
|
-
|
4
|
-
Minitest::Reporters.use! [
|
6
|
+
|
7
|
+
Minitest::Reporters.use! [
|
8
|
+
Minitest::Reporters::DefaultReporter.new(color: true, slow_count: 5)
|
9
|
+
]
|
10
|
+
|
11
|
+
require 'webmock/minitest'
|
12
|
+
WebMock.allow_net_connect!
|
5
13
|
|
6
14
|
require 'webmock/minitest'
|
7
15
|
|
8
16
|
require File.expand_path('../../lib/picturehouse_uk.rb', __FILE__)
|
17
|
+
|
18
|
+
require_relative 'support/fake_website'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picturehouse_uk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Croll
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: codeclimate-test-reporter
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: minitest-reporters
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,13 +67,13 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: webmock
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
|
-
type: :
|
76
|
+
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
@@ -81,21 +81,21 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: cinebase
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
89
|
+
version: '3.0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
96
|
+
version: '3.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: nokogiri
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
description:
|
111
|
+
description: API pulling information from picturehouse.com
|
112
112
|
email:
|
113
113
|
- andy@goodscary.com
|
114
114
|
executables: []
|
@@ -116,49 +116,50 @@ extensions: []
|
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
118
|
- ".gitignore"
|
119
|
-
- ".rdoc_options"
|
120
119
|
- ".travis.yml"
|
121
120
|
- ".yardopts"
|
122
121
|
- CHANGELOG.md
|
122
|
+
- COMM-LICENSE
|
123
123
|
- Gemfile
|
124
|
-
- LICENSE
|
124
|
+
- LICENSE
|
125
125
|
- README.md
|
126
126
|
- Rakefile
|
127
127
|
- lib/picturehouse_uk.rb
|
128
128
|
- lib/picturehouse_uk/cinema.rb
|
129
|
-
- lib/picturehouse_uk/film.rb
|
130
129
|
- lib/picturehouse_uk/internal/parser/address.rb
|
131
130
|
- lib/picturehouse_uk/internal/parser/screenings.rb
|
132
131
|
- lib/picturehouse_uk/internal/title_sanitizer.rb
|
133
132
|
- lib/picturehouse_uk/internal/website.rb
|
134
|
-
- lib/picturehouse_uk/
|
133
|
+
- lib/picturehouse_uk/performance.rb
|
135
134
|
- lib/picturehouse_uk/version.rb
|
136
135
|
- picturehouse_uk.gemspec
|
137
|
-
-
|
138
|
-
- test/fixtures/cinema
|
139
|
-
- test/fixtures/
|
140
|
-
- test/fixtures/
|
141
|
-
- test/fixtures/cinema
|
136
|
+
- rake/fixture_creator.rb
|
137
|
+
- test/fixtures/Duke_Of_Yorks/cinema.html
|
138
|
+
- test/fixtures/Duke_Of_Yorks/info.html
|
139
|
+
- test/fixtures/Duke_Of_Yorks/whats_on.html
|
140
|
+
- test/fixtures/Dukes_At_Komedia/cinema.html
|
141
|
+
- test/fixtures/Dukes_At_Komedia/info.html
|
142
|
+
- test/fixtures/Dukes_At_Komedia/whats_on.html
|
143
|
+
- test/fixtures/National_Media_Museum/cinema.html
|
144
|
+
- test/fixtures/National_Media_Museum/info.html
|
145
|
+
- test/fixtures/National_Media_Museum/whats_on.html
|
146
|
+
- test/fixtures/Phoenix_Picturehouse/cinema.html
|
147
|
+
- test/fixtures/Phoenix_Picturehouse/info.html
|
148
|
+
- test/fixtures/Phoenix_Picturehouse/whats_on.html
|
142
149
|
- test/fixtures/home.html
|
143
|
-
- test/fixtures/info/Duke_Of_Yorks.html
|
144
|
-
- test/fixtures/info/Dukes_At_Komedia.html
|
145
|
-
- test/fixtures/info/Phoenix_Picturehouse.html
|
146
|
-
- test/fixtures/whats_on/Duke_Of_Yorks.html
|
147
|
-
- test/fixtures/whats_on/Dukes_At_Komedia.html
|
148
|
-
- test/fixtures/whats_on/National_Media_Museum.html
|
149
|
-
- test/fixtures/whats_on/Phoenix_Picturehouse.html
|
150
150
|
- test/lib/picturehouse_uk/cinema_test.rb
|
151
|
-
- test/lib/picturehouse_uk/
|
152
|
-
- test/lib/picturehouse_uk/internal/parser/address_parser_test.rb
|
151
|
+
- test/lib/picturehouse_uk/internal/parser/address_test.rb
|
153
152
|
- test/lib/picturehouse_uk/internal/parser/screenings_test.rb
|
154
153
|
- test/lib/picturehouse_uk/internal/title_sanitizer_test.rb
|
155
154
|
- test/lib/picturehouse_uk/internal/website_test.rb
|
156
|
-
- test/lib/picturehouse_uk/
|
155
|
+
- test/lib/picturehouse_uk/performance_test.rb
|
157
156
|
- test/lib/picturehouse_uk/version_test.rb
|
158
157
|
- test/live/integration_test.rb
|
158
|
+
- test/support/fake_website.rb
|
159
159
|
- test/test_helper.rb
|
160
160
|
homepage: ''
|
161
161
|
licenses:
|
162
|
+
- AGPL
|
162
163
|
- MIT
|
163
164
|
metadata: {}
|
164
165
|
post_install_message:
|
@@ -177,32 +178,32 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
178
|
version: '0'
|
178
179
|
requirements: []
|
179
180
|
rubyforge_project:
|
180
|
-
rubygems_version: 2.
|
181
|
+
rubygems_version: 2.4.5
|
181
182
|
signing_key:
|
182
183
|
specification_version: 4
|
183
184
|
summary: It's a scraper, but a nice one
|
184
185
|
test_files:
|
185
|
-
- test/
|
186
|
-
- test/fixtures/
|
187
|
-
- test/fixtures/
|
188
|
-
- test/fixtures/cinema
|
189
|
-
- test/fixtures/
|
186
|
+
- test/fixtures/Duke_Of_Yorks/cinema.html
|
187
|
+
- test/fixtures/Duke_Of_Yorks/info.html
|
188
|
+
- test/fixtures/Duke_Of_Yorks/whats_on.html
|
189
|
+
- test/fixtures/Dukes_At_Komedia/cinema.html
|
190
|
+
- test/fixtures/Dukes_At_Komedia/info.html
|
191
|
+
- test/fixtures/Dukes_At_Komedia/whats_on.html
|
192
|
+
- test/fixtures/National_Media_Museum/cinema.html
|
193
|
+
- test/fixtures/National_Media_Museum/info.html
|
194
|
+
- test/fixtures/National_Media_Museum/whats_on.html
|
195
|
+
- test/fixtures/Phoenix_Picturehouse/cinema.html
|
196
|
+
- test/fixtures/Phoenix_Picturehouse/info.html
|
197
|
+
- test/fixtures/Phoenix_Picturehouse/whats_on.html
|
190
198
|
- test/fixtures/home.html
|
191
|
-
- test/fixtures/info/Duke_Of_Yorks.html
|
192
|
-
- test/fixtures/info/Dukes_At_Komedia.html
|
193
|
-
- test/fixtures/info/Phoenix_Picturehouse.html
|
194
|
-
- test/fixtures/whats_on/Duke_Of_Yorks.html
|
195
|
-
- test/fixtures/whats_on/Dukes_At_Komedia.html
|
196
|
-
- test/fixtures/whats_on/National_Media_Museum.html
|
197
|
-
- test/fixtures/whats_on/Phoenix_Picturehouse.html
|
198
199
|
- test/lib/picturehouse_uk/cinema_test.rb
|
199
|
-
- test/lib/picturehouse_uk/
|
200
|
-
- test/lib/picturehouse_uk/internal/parser/address_parser_test.rb
|
200
|
+
- test/lib/picturehouse_uk/internal/parser/address_test.rb
|
201
201
|
- test/lib/picturehouse_uk/internal/parser/screenings_test.rb
|
202
202
|
- test/lib/picturehouse_uk/internal/title_sanitizer_test.rb
|
203
203
|
- test/lib/picturehouse_uk/internal/website_test.rb
|
204
|
-
- test/lib/picturehouse_uk/
|
204
|
+
- test/lib/picturehouse_uk/performance_test.rb
|
205
205
|
- test/lib/picturehouse_uk/version_test.rb
|
206
206
|
- test/live/integration_test.rb
|
207
|
+
- test/support/fake_website.rb
|
207
208
|
- test/test_helper.rb
|
208
209
|
has_rdoc:
|
data/.rdoc_options
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
--- !ruby/object:RDoc::Options
|
2
|
-
encoding: UTF-8
|
3
|
-
static_path: []
|
4
|
-
rdoc_include:
|
5
|
-
- .
|
6
|
-
charset: UTF-8
|
7
|
-
exclude:
|
8
|
-
hyperlink_all: false
|
9
|
-
line_numbers: false
|
10
|
-
main_page:
|
11
|
-
markup: tomdoc
|
12
|
-
show_hash: false
|
13
|
-
tab_width: 8
|
14
|
-
title:
|
15
|
-
visibility: :protected
|
16
|
-
webcvs:
|
data/lib/picturehouse_uk/film.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
module PicturehouseUk
|
2
|
-
# A film on the Picturehouse UK website
|
3
|
-
class Film
|
4
|
-
include Comparable
|
5
|
-
|
6
|
-
# @return [String] the name of the film
|
7
|
-
attr_reader :name
|
8
|
-
# @return [String] the normalized slug derived from the film name
|
9
|
-
attr_reader :slug
|
10
|
-
|
11
|
-
# @param [String] name the film name
|
12
|
-
# @return [PicturehouseUk::Film]
|
13
|
-
def initialize(name)
|
14
|
-
@name = name
|
15
|
-
@slug = name.downcase.gsub(/[^0-9a-z ]/, '').gsub(/\s+/, '-')
|
16
|
-
end
|
17
|
-
|
18
|
-
# Films at a single cinema
|
19
|
-
# @param [String] cinema_id the id of the cinema
|
20
|
-
# @return [Array<PicturehouseUk::Film>]
|
21
|
-
def self.at(cinema_id)
|
22
|
-
screenings(cinema_id).map { |hash| new hash[:film_name] }.uniq
|
23
|
-
end
|
24
|
-
|
25
|
-
# Allows sort on objects
|
26
|
-
# @param [PicturehouseUk::Film] other another film object
|
27
|
-
# @return [Integer] -1, 0 or 1
|
28
|
-
def <=>(other)
|
29
|
-
slug <=> other.slug
|
30
|
-
end
|
31
|
-
|
32
|
-
# Check an object is the same as another object.
|
33
|
-
# @param [PicturehouseUk::Film] other another film
|
34
|
-
# @return [Boolean] True if both objects are the same exact object, or if
|
35
|
-
# they are of the same type and share an equal slug
|
36
|
-
# @note Guided by http://woss.name/2011/01/20/equality-comparison-and-ordering-in-ruby/
|
37
|
-
def eql?(other)
|
38
|
-
self.class == other.class && self == other
|
39
|
-
end
|
40
|
-
|
41
|
-
# Generates hash of slug in order to allow two records of the same type and
|
42
|
-
# id to work with something like:
|
43
|
-
#
|
44
|
-
# [ Film.new('AB'), Film.new('EF') ] & [ Film.new('EF'), Film.new('GH') ]
|
45
|
-
# #=> [ Film.new('EF') ]
|
46
|
-
#
|
47
|
-
# @return [Integer] hash of slug
|
48
|
-
# @note Guided by http://woss.name/2011/01/20/equality-comparison-and-ordering-in-ruby/
|
49
|
-
def hash
|
50
|
-
slug.hash
|
51
|
-
end
|
52
|
-
|
53
|
-
private
|
54
|
-
|
55
|
-
def self.screenings(cinema_id)
|
56
|
-
PicturehouseUk::Internal::Parser::Screenings.new(cinema_id).to_a
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
module PicturehouseUk
|
2
|
-
# A single screening of a film on the Picturehouse UK website
|
3
|
-
class Screening
|
4
|
-
# @return [String] the booking URL on the cinema website
|
5
|
-
attr_reader :booking_url
|
6
|
-
# @return [String] the cinema name
|
7
|
-
attr_reader :cinema_name
|
8
|
-
# @return [String] 2d or 3d
|
9
|
-
attr_reader :dimension
|
10
|
-
# @return [String] the film name
|
11
|
-
attr_reader :film_name
|
12
|
-
|
13
|
-
# @param [Hash] options
|
14
|
-
def initialize(options)
|
15
|
-
@booking_url = options.fetch(:booking_url, nil)
|
16
|
-
@cinema_name = options.fetch(:cinema_name)
|
17
|
-
@cinema_id = options.fetch(:cinema_id)
|
18
|
-
@dimension = options.fetch(:dimension, '2d')
|
19
|
-
@film_name = options.fetch(:film_name)
|
20
|
-
@time = options.fetch(:time)
|
21
|
-
@variant = options.fetch(:variant, [])
|
22
|
-
end
|
23
|
-
|
24
|
-
# Screenings at a single cinema
|
25
|
-
# @param [String] cinema_id the id of the cinema
|
26
|
-
# @return [Array<PicturehouseUk::Screening>]
|
27
|
-
def self.at(cinema_id)
|
28
|
-
screenings(cinema_id).map do |attributes|
|
29
|
-
new cinema_hash(cinema_id).merge(attributes)
|
30
|
-
end.uniq
|
31
|
-
end
|
32
|
-
|
33
|
-
# The UTC time of the screening
|
34
|
-
# @return [Time]
|
35
|
-
def showing_at
|
36
|
-
@showing_at ||= begin
|
37
|
-
if @time.utc?
|
38
|
-
@time
|
39
|
-
else
|
40
|
-
TZInfo::Timezone.get('Europe/London').local_to_utc(@time)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
# The date of the screening
|
46
|
-
# @return [Date]
|
47
|
-
def showing_on
|
48
|
-
showing_at.to_date
|
49
|
-
end
|
50
|
-
|
51
|
-
# The kinds of screening
|
52
|
-
# @return <Array[String]>
|
53
|
-
def variant
|
54
|
-
@variant.map(&:downcase).sort
|
55
|
-
end
|
56
|
-
|
57
|
-
private
|
58
|
-
|
59
|
-
def self.cinema_hash(cinema_id)
|
60
|
-
{
|
61
|
-
cinema_id: cinema_id,
|
62
|
-
cinema_name: PicturehouseUk::Cinema.find(cinema_id).name
|
63
|
-
}
|
64
|
-
end
|
65
|
-
|
66
|
-
def self.screenings(cinema_id)
|
67
|
-
PicturehouseUk::Internal::Parser::Screenings.new(cinema_id).to_a
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|