picturehouse_uk 6.0.1-x86_64-linux-gnu → 6.2.0-x86_64-linux-gnu
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/Gemfile +1 -0
- data/README.md +21 -3
- data/lib/picturehouse_uk/cinema.rb +27 -0
- data/lib/picturehouse_uk/internal/api_response.rb +9 -2
- data/lib/picturehouse_uk/internal/parser/api/showtime.rb +1 -0
- data/lib/picturehouse_uk/internal/title_sanitizer.rb +8 -1
- data/lib/picturehouse_uk/version.rb +2 -2
- data/lib/picturehouse_uk.rb +5 -8
- data/picturehouse_uk.gemspec +1 -1
- data/test/fixtures/api/sites.json +3 -0
- data/test/lib/picturehouse_uk/cinema_test.rb +23 -0
- data/test/lib/picturehouse_uk/internal/api_response_test.rb +8 -0
- data/test/lib/picturehouse_uk/internal/guest_token_test.rb +7 -0
- data/test/lib/picturehouse_uk/internal/parser/api/showtime_test.rb +1 -0
- data/test/lib/picturehouse_uk/internal/title_sanitizer_test.rb +64 -3
- data/test/lib/picturehouse_uk/performance_test.rb +13 -0
- data/test/live/integration_test.rb +10 -0
- data/test/support/api_shapes.rb +5 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 566c6e648487c2f44b81dd55349e70c4e7d934c01ffe93c0ce4cc3f6697e1c84
|
|
4
|
+
data.tar.gz: 49e1a7d000e3855aeb86fcb0e63f87bd6cfbf2c70dff6f0970cc988d9c28150a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fa622555dba96535f1885901b11ebc57ac1826b3e15f31e690c9c606e3d39f09282c53552bc5311393b35302642d1150e56bb155b67e8c8d9c33694f65ac0caa
|
|
7
|
+
data.tar.gz: 0aea06e92680cf9d82e4d519781c8ccec954998c88338841c46fd363d4336a30135ce8365cb7199ad725fdcf6237ea5d057987efe06716478be916fc1e2c1e7b
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
4
4
|
|
|
5
|
+
## [6.2.0] - 2026-11-03
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- Uses cinebase 5.9: performances take the raw `title:`, so audience labels become variants, and series prefixes such as `Met Opera:` become the performance's `event`.
|
|
9
|
+
- National Theatre Live and Bolshoi screenings are named `National Theatre Live: ` and `Bolshoi Ballet: `, the prefixes cinebase moves to `event`.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- `Harbour Highlights: Arrival 10th Anniversary` is now `Arrival`.
|
|
13
|
+
- `Little Theatre's 90th - Mr. Deeds Goes to Town` and `Little Theatre's 90th Anniversary: The Third Man` lose the birthday prefix.
|
|
14
|
+
- `The Devils + Live Q+A with Mark Kermode` and `A Long Winter Livestream Q+A` lose the Q&A.
|
|
15
|
+
- `The Trip to the Northern Lights: Broadcast Q&A` and `…: Preview and Q&A` are now `The Trip to the Northern Lights`.
|
|
16
|
+
- `Book Club: Elif Shafak In Conversation-Broadcast` loses `-Broadcast`.
|
|
17
|
+
- `Raise The Red Lantern 1991` loses its trailing release year. Years before 2020, after a word other than "of", are removed, so `Blade Runner 2049`, `1917` and `2046` keep theirs.
|
|
18
|
+
|
|
19
|
+
## [6.1.0] - 2026-10-31
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
- `Cinema#latitude` and `Cinema#longitude` as Floats in decimal degrees, from the Vista sites response. They are `nil` when a site has no location or sits at 0, 0.
|
|
23
|
+
- `PicturehouseUk.ensure_token!` fetches a guest token only when there is none or it expires within an hour, and `PicturehouseUk.token_expires_at` reads its expiry. Both come from cinebase's `Vista::TokenHolder`.
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
- A token the API rejects is cleared from `PicturehouseUk.token`, so the next `ensure_token!` fetches a fresh one.
|
|
27
|
+
- Requires cinebase 5.6.
|
|
28
|
+
|
|
5
29
|
## [6.0.1] - 2026-10-22
|
|
6
30
|
|
|
7
31
|
### Changed
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -55,9 +55,21 @@ PicturehouseUk.token = ENV.fetch('PICTUREHOUSE_TOKEN')
|
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
Tokens currently last 12 hours. The gem checks the declared expiry but does not
|
|
58
|
-
verify the signature.
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
verify the signature. Normal API calls never acquire or renew a token
|
|
59
|
+
automatically. `PicturehouseUk.ensure_token!` fetches one only when there is no
|
|
60
|
+
token, or the token expires within an hour, and otherwise keeps the current one.
|
|
61
|
+
Call it before each batch of requests:
|
|
62
|
+
|
|
63
|
+
``` ruby
|
|
64
|
+
PicturehouseUk.ensure_token!
|
|
65
|
+
PicturehouseUk.token_expires_at
|
|
66
|
+
#=> 2026-10-31 03:00:00 UTC
|
|
67
|
+
PicturehouseUk::Cinema.all
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Missing, expired or rejected tokens raise `PicturehouseUk::AuthenticationError`. A
|
|
71
|
+
token the API rejects is cleared from `PicturehouseUk.token`, so the next
|
|
72
|
+
`ensure_token!` fetches a fresh one.
|
|
61
73
|
|
|
62
74
|
### Cinema
|
|
63
75
|
|
|
@@ -86,6 +98,12 @@ cinema.brand
|
|
|
86
98
|
cinema.name
|
|
87
99
|
#=> "Duke's at Komedia"
|
|
88
100
|
|
|
101
|
+
cinema.latitude
|
|
102
|
+
#=> 50.8247985839844
|
|
103
|
+
|
|
104
|
+
cinema.longitude
|
|
105
|
+
#=> -0.139400005340576
|
|
106
|
+
|
|
89
107
|
cinema.id
|
|
90
108
|
#=> '019'
|
|
91
109
|
|
|
@@ -80,6 +80,26 @@ module PicturehouseUk
|
|
|
80
80
|
name
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
+
# Latitude of the cinema
|
|
84
|
+
# @return [Float, nil] decimal degrees, or nil when unknown
|
|
85
|
+
# @example
|
|
86
|
+
# cinema = PicturehouseUk::Cinema.new(19)
|
|
87
|
+
# cinema.latitude
|
|
88
|
+
# #=> 50.8247985839844
|
|
89
|
+
def latitude
|
|
90
|
+
coordinates&.first
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Longitude of the cinema
|
|
94
|
+
# @return [Float, nil] decimal degrees, or nil when unknown
|
|
95
|
+
# @example
|
|
96
|
+
# cinema = PicturehouseUk::Cinema.new(19)
|
|
97
|
+
# cinema.longitude
|
|
98
|
+
# #=> -0.139400005340576
|
|
99
|
+
def longitude
|
|
100
|
+
coordinates&.last
|
|
101
|
+
end
|
|
102
|
+
|
|
83
103
|
# The name of the cinema
|
|
84
104
|
# @return [String]
|
|
85
105
|
# @example
|
|
@@ -114,6 +134,13 @@ module PicturehouseUk
|
|
|
114
134
|
end
|
|
115
135
|
end
|
|
116
136
|
|
|
137
|
+
# 0, 0 marks a site whose position was never set
|
|
138
|
+
def coordinates
|
|
139
|
+
location = site_hash['location'] || {}
|
|
140
|
+
pair = [location['latitude'], location['longitude']]
|
|
141
|
+
pair.map(&:to_f) if pair.all?(Numeric) && pair.any?(&:nonzero?)
|
|
142
|
+
end
|
|
143
|
+
|
|
117
144
|
def site_hash
|
|
118
145
|
@site_hash ||= self.class.send(:sites_hash).fetch(id, {})
|
|
119
146
|
end
|
|
@@ -12,19 +12,26 @@ module PicturehouseUk
|
|
|
12
12
|
|
|
13
13
|
# @return [Array<Hash>] cinemas
|
|
14
14
|
def sites
|
|
15
|
-
|
|
15
|
+
get("sites").fetch("sites")
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
# @param [String] cinema_id zero-padded site id, e.g. '019'
|
|
19
19
|
# @param [Date] date business date
|
|
20
20
|
# @return [Hash] showtimes plus their related films and attributes
|
|
21
21
|
def showtimes(cinema_id, date)
|
|
22
|
-
|
|
22
|
+
get("showtimes/by-business-date/#{date.iso8601}",
|
|
23
23
|
"siteIds" => cinema_id)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
private
|
|
27
27
|
|
|
28
|
+
def get(path, query = {})
|
|
29
|
+
client.get(path, query)
|
|
30
|
+
rescue Cinebase::Vista::AuthenticationError
|
|
31
|
+
PicturehouseUk.reject_token!(@client_token)
|
|
32
|
+
raise
|
|
33
|
+
end
|
|
34
|
+
|
|
28
35
|
# One client keeps one connection open, so reuse it until the token
|
|
29
36
|
# changes. Picturehouse's API rejects every Connect-Region-Code, so
|
|
30
37
|
# send none.
|
|
@@ -54,7 +54,14 @@ module PicturehouseUk
|
|
|
54
54
|
/\ARelaxed-Screening: /, # relaxed screening
|
|
55
55
|
/\ALMF Presents: /, # LMF strand
|
|
56
56
|
/\AGreen Screen: /, # Green Screen strand
|
|
57
|
-
/\AFFQ:
|
|
57
|
+
/\AFFQ: /, # FFQ strand
|
|
58
|
+
/\AHarbour Highlights: /, # Harbour Highlights strand
|
|
59
|
+
/\ALittle Theatre['’]s \d+(?:st|nd|rd|th)(?: Anniversary)?\s*[-:]\s*/, # Little Theatre birthday
|
|
60
|
+
/\s*\+\s*(?:Live )?Q[&+]A with .+\z/i, # Q&A with a guest
|
|
61
|
+
/\s+Livestream Q[&+]A\z/i, # livestream Q&A
|
|
62
|
+
/:\s*(?:Broadcast|Preview and) Q[&+]A\z/i, # broadcast Q&A
|
|
63
|
+
/\s*-\s*Broadcast\z/i, # broadcast
|
|
64
|
+
/(?<=\p{L})(?<! of) (?:19\d{2}|20[01]\d)\z/ # release year, not "Blade Runner 2049"
|
|
58
65
|
] + COMMON_REMOVE
|
|
59
66
|
end
|
|
60
67
|
|
data/lib/picturehouse_uk.rb
CHANGED
|
@@ -18,13 +18,10 @@ require_relative './picturehouse_uk/performance'
|
|
|
18
18
|
module PicturehouseUk
|
|
19
19
|
AuthenticationError = Cinebase::Vista::AuthenticationError
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def acquire_token!(curl: nil)
|
|
27
|
-
self.token = Internal::GuestToken.new(curl: curl).fetch
|
|
28
|
-
end
|
|
21
|
+
extend Cinebase::Vista::TokenHolder
|
|
22
|
+
|
|
23
|
+
# @api private
|
|
24
|
+
def self.guest_token_class
|
|
25
|
+
Internal::GuestToken
|
|
29
26
|
end
|
|
30
27
|
end
|
data/picturehouse_uk.gemspec
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
{
|
|
4
4
|
"id": "002",
|
|
5
5
|
"name": { "text": "Arts Picturehouse Cambridge" },
|
|
6
|
+
"location": { "latitude": 0, "longitude": 0 },
|
|
6
7
|
"contactDetails": {
|
|
7
8
|
"addressV2": {
|
|
8
9
|
"line1": { "text": "1 Example Street" },
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
{
|
|
16
17
|
"id": "013",
|
|
17
18
|
"name": { "text": "Picturehouse at FACT Liverpool" },
|
|
19
|
+
"location": null,
|
|
18
20
|
"contactDetails": {
|
|
19
21
|
"addressV2": {
|
|
20
22
|
"line1": { "text": "2 Example Street" },
|
|
@@ -27,6 +29,7 @@
|
|
|
27
29
|
{
|
|
28
30
|
"id": "019",
|
|
29
31
|
"name": { "text": "Duke's at Komedia" },
|
|
32
|
+
"location": { "latitude": 50.8247985839844, "longitude": -0.139400005340576 },
|
|
30
33
|
"contactDetails": {
|
|
31
34
|
"addressV2": {
|
|
32
35
|
"line1": { "text": "3 Example Street" },
|
|
@@ -50,6 +50,29 @@ class PicturehouseUk::CinemaTest < Minitest::Test
|
|
|
50
50
|
assert_equal 'Picturehouse', PicturehouseUk::Cinema.new(19).brand
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
+
def test_latitude_and_longitude
|
|
54
|
+
with_fake_api do
|
|
55
|
+
cinema = PicturehouseUk::Cinema.new(19)
|
|
56
|
+
|
|
57
|
+
assert_in_delta 50.8248, cinema.latitude, 0.0001
|
|
58
|
+
assert_in_delta(-0.1394, cinema.longitude, 0.0001)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def test_latitude_and_longitude_are_nil_without_a_location
|
|
63
|
+
with_fake_api do
|
|
64
|
+
assert_nil PicturehouseUk::Cinema.new(13).latitude
|
|
65
|
+
assert_nil PicturehouseUk::Cinema.new(13).longitude
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def test_latitude_and_longitude_are_nil_at_zero_zero
|
|
70
|
+
with_fake_api do
|
|
71
|
+
assert_nil PicturehouseUk::Cinema.new(2).latitude
|
|
72
|
+
assert_nil PicturehouseUk::Cinema.new(2).longitude
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
53
76
|
def test_name_and_full_name
|
|
54
77
|
with_fake_api do
|
|
55
78
|
assert_equal "Duke's at Komedia", PicturehouseUk::Cinema.new(19).name
|
|
@@ -44,6 +44,14 @@ class PicturehouseUk::Internal::ApiResponseTest < Minitest::Test
|
|
|
44
44
|
assert_raises(PicturehouseUk::AuthenticationError) { api.sites }
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
+
def test_rejected_token_is_cleared
|
|
48
|
+
stub_request(:get, "#{BASE_URL}/sites").to_return(status: 401)
|
|
49
|
+
|
|
50
|
+
assert_raises(PicturehouseUk::AuthenticationError) { api.sites }
|
|
51
|
+
|
|
52
|
+
assert_nil PicturehouseUk.token
|
|
53
|
+
end
|
|
54
|
+
|
|
47
55
|
def test_reuses_one_client_while_the_token_holds
|
|
48
56
|
stub_request(:get, "#{BASE_URL}/sites").to_return(status: 200, body: sites_json)
|
|
49
57
|
shared = api
|
|
@@ -38,6 +38,13 @@ class PicturehouseUk::Internal::GuestTokenTest < Minitest::Test
|
|
|
38
38
|
assert_raises(PicturehouseUk::AuthenticationError) { guest_token(curl).fetch }
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
def test_ensure_token_fetches_only_without_a_current_token
|
|
42
|
+
token = token_expiring_at(Time.now + 7200)
|
|
43
|
+
|
|
44
|
+
assert_equal token, PicturehouseUk.ensure_token!(curl: fake_curl("#{page_with(token)}\n200"))
|
|
45
|
+
assert_equal token, PicturehouseUk.ensure_token!(curl: File.join(@directory, 'missing'))
|
|
46
|
+
end
|
|
47
|
+
|
|
41
48
|
def test_acquire_token_sets_token
|
|
42
49
|
token = token_expiring_at(Time.now + 3600)
|
|
43
50
|
|
|
@@ -138,12 +138,12 @@ class PicturehouseUkInternalTitleSanitizerTest < Minitest::Test
|
|
|
138
138
|
|
|
139
139
|
def test_sanitized_with_bolshoi_screening
|
|
140
140
|
sanitizer = PicturehouseUk::Internal::TitleSanitizer.new('Bolshoi: Spartacus [NO CERT]')
|
|
141
|
-
assert_equal 'Bolshoi: Spartacus', sanitizer.sanitized
|
|
141
|
+
assert_equal 'Bolshoi Ballet: Spartacus', sanitizer.sanitized
|
|
142
142
|
end
|
|
143
143
|
|
|
144
144
|
def test_sanitized_with_bolshoi_with_captured
|
|
145
145
|
sanitizer = PicturehouseUk::Internal::TitleSanitizer.new('Bolshoi: La Bayadere (Captured Live in 2012)')
|
|
146
|
-
assert_equal 'Bolshoi: La Bayadere', sanitizer.sanitized
|
|
146
|
+
assert_equal 'Bolshoi Ballet: La Bayadere', sanitizer.sanitized
|
|
147
147
|
end
|
|
148
148
|
|
|
149
149
|
def test_sanitized_with_glyndebourne
|
|
@@ -168,7 +168,7 @@ class PicturehouseUkInternalTitleSanitizerTest < Minitest::Test
|
|
|
168
168
|
|
|
169
169
|
def test_sanitized_with_nt_live_screening
|
|
170
170
|
sanitizer = PicturehouseUk::Internal::TitleSanitizer.new('National Theatre: Hamlet [PG]')
|
|
171
|
-
assert_equal '
|
|
171
|
+
assert_equal 'National Theatre Live: Hamlet', sanitizer.sanitized
|
|
172
172
|
end
|
|
173
173
|
|
|
174
174
|
def test_sanitized_with_ourscreen
|
|
@@ -240,4 +240,65 @@ class PicturehouseUkInternalTitleSanitizerTest < Minitest::Test
|
|
|
240
240
|
sanitizer = PicturehouseUk::Internal::TitleSanitizer.new('Spartacus (Bolshoi Ballet)')
|
|
241
241
|
assert_equal 'Bolshoi Ballet: Spartacus', sanitizer.sanitized
|
|
242
242
|
end
|
|
243
|
+
|
|
244
|
+
def test_sanitized_removes_harbour_highlights_strand
|
|
245
|
+
sanitizer = PicturehouseUk::Internal::TitleSanitizer.new('Harbour Highlights: Arrival 10th Anniversary')
|
|
246
|
+
assert_equal 'Arrival', sanitizer.sanitized
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
def test_sanitized_removes_little_theatre_birthday
|
|
250
|
+
sanitizer = PicturehouseUk::Internal::TitleSanitizer.new("Little Theatre's 90th - Mr. Deeds Goes to Town")
|
|
251
|
+
assert_equal 'Mr. Deeds Goes to Town', sanitizer.sanitized
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
def test_sanitized_removes_little_theatre_anniversary
|
|
255
|
+
sanitizer = PicturehouseUk::Internal::TitleSanitizer.new("Little Theatre's 90th Anniversary: The Third Man")
|
|
256
|
+
assert_equal 'The Third Man', sanitizer.sanitized
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
def test_sanitized_removes_q_and_a_with_guest
|
|
260
|
+
sanitizer = PicturehouseUk::Internal::TitleSanitizer.new('The Devils + Live Q+A with Mark Kermode')
|
|
261
|
+
assert_equal 'The Devils', sanitizer.sanitized
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
def test_sanitized_removes_livestream_q_and_a
|
|
265
|
+
sanitizer = PicturehouseUk::Internal::TitleSanitizer.new('A Long Winter Livestream Q+A')
|
|
266
|
+
assert_equal 'A Long Winter', sanitizer.sanitized
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
def test_sanitized_removes_broadcast_q_and_a
|
|
270
|
+
sanitizer = PicturehouseUk::Internal::TitleSanitizer.new('The Trip to the Northern Lights: Broadcast Q&A')
|
|
271
|
+
assert_equal 'The Trip to the Northern Lights', sanitizer.sanitized
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
def test_sanitized_removes_preview_and_q_and_a
|
|
275
|
+
sanitizer = PicturehouseUk::Internal::TitleSanitizer.new('The Trip to the Northern Lights: Preview and Q&A')
|
|
276
|
+
assert_equal 'The Trip to the Northern Lights', sanitizer.sanitized
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
def test_sanitized_removes_broadcast_suffix
|
|
280
|
+
sanitizer = PicturehouseUk::Internal::TitleSanitizer.new('Book Club: Elif Shafak In Conversation-Broadcast')
|
|
281
|
+
assert_equal 'Book Club: Elif Shafak In Conversation', sanitizer.sanitized
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def test_sanitized_removes_trailing_release_year
|
|
285
|
+
sanitizer = PicturehouseUk::Internal::TitleSanitizer.new('Raise The Red Lantern 1991')
|
|
286
|
+
assert_equal 'Raise The Red Lantern', sanitizer.sanitized
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
def test_sanitized_keeps_years_that_name_films
|
|
290
|
+
['Blade Runner 2049', '1917', '2046'].each do |title|
|
|
291
|
+
assert_equal title, PicturehouseUk::Internal::TitleSanitizer.new(title).sanitized
|
|
292
|
+
end
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
def test_sanitized_keeps_events_with_their_films
|
|
296
|
+
[
|
|
297
|
+
'Elf + Mulled Wine and Carols',
|
|
298
|
+
'Hocus Pocus + Pumpkin Party',
|
|
299
|
+
'Rammstein - Live in Mexico City'
|
|
300
|
+
].each do |title|
|
|
301
|
+
assert_equal title, PicturehouseUk::Internal::TitleSanitizer.new(title).sanitized
|
|
302
|
+
end
|
|
303
|
+
end
|
|
243
304
|
end
|
|
@@ -36,6 +36,19 @@ class PicturehouseUk::PerformanceTest < Minitest::Test
|
|
|
36
36
|
performance.booking_url
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
+
def test_at_reads_audience_from_title
|
|
40
|
+
@api_response.define_singleton_method(:showtimes) do |cinema_id, date|
|
|
41
|
+
super(cinema_id, date).tap do |data|
|
|
42
|
+
data.dig('relatedData', 'films', 0, 'title')['text'] = 'Relaxed Screening: Wildwood'
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
performance = performances_at(19).first
|
|
46
|
+
|
|
47
|
+
assert_equal 'Relaxed Screening: Wildwood', performance.title
|
|
48
|
+
assert_equal 'Wildwood', performance.film_name
|
|
49
|
+
assert_equal %w(audio_described relaxed), performance.variant
|
|
50
|
+
end
|
|
51
|
+
|
|
39
52
|
def test_at_parses_3d_silver_screen
|
|
40
53
|
performance = performances_at(19)[1]
|
|
41
54
|
|
|
@@ -14,6 +14,16 @@ class LiveCinemaTest < Minitest::Test
|
|
|
14
14
|
refute_empty cinema.postal_code, "#{cinema.id} #{cinema.name}"
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
|
+
|
|
18
|
+
def test_cinemas_have_uk_coordinates
|
|
19
|
+
located = PicturehouseUk::Cinema.all.select(&:latitude)
|
|
20
|
+
|
|
21
|
+
refute_empty located
|
|
22
|
+
located.each do |cinema|
|
|
23
|
+
assert_includes 49.0..61.0, cinema.latitude, "#{cinema.id} #{cinema.name}"
|
|
24
|
+
assert_includes(-9.0..2.0, cinema.longitude, "#{cinema.id} #{cinema.name}")
|
|
25
|
+
end
|
|
26
|
+
end
|
|
17
27
|
end
|
|
18
28
|
|
|
19
29
|
class LivePerformanceTest < Minitest::Test
|
data/test/support/api_shapes.rb
CHANGED
|
@@ -16,6 +16,11 @@ module ApiShapes
|
|
|
16
16
|
line = address.fetch(key)
|
|
17
17
|
assert_kind_of String, line.fetch('text'), "site #{site['id']} #{key}" unless line.nil?
|
|
18
18
|
end
|
|
19
|
+
location = site['location'] || {}
|
|
20
|
+
%w(latitude longitude).each do |key|
|
|
21
|
+
value = location[key]
|
|
22
|
+
assert_kind_of Numeric, value, "site #{site['id']} #{key}" unless value.nil?
|
|
23
|
+
end
|
|
19
24
|
end
|
|
20
25
|
end
|
|
21
26
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: picturehouse_uk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.0
|
|
4
|
+
version: 6.2.0
|
|
5
5
|
platform: x86_64-linux-gnu
|
|
6
6
|
authors:
|
|
7
7
|
- Andy Croll
|
|
@@ -113,14 +113,14 @@ dependencies:
|
|
|
113
113
|
requirements:
|
|
114
114
|
- - "~>"
|
|
115
115
|
- !ruby/object:Gem::Version
|
|
116
|
-
version: '5.
|
|
116
|
+
version: '5.9'
|
|
117
117
|
type: :runtime
|
|
118
118
|
prerelease: false
|
|
119
119
|
version_requirements: !ruby/object:Gem::Requirement
|
|
120
120
|
requirements:
|
|
121
121
|
- - "~>"
|
|
122
122
|
- !ruby/object:Gem::Version
|
|
123
|
-
version: '5.
|
|
123
|
+
version: '5.9'
|
|
124
124
|
description: Pull movie & cinema information from the Picturehouse Vista API
|
|
125
125
|
email:
|
|
126
126
|
- andy@goodscary.com
|