watershed_uk 1.0.0 → 1.0.1
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 +7 -0
- data/lib/watershed_uk/internal/ticketsolve.rb +6 -2
- data/lib/watershed_uk/performance.rb +2 -5
- data/lib/watershed_uk/version.rb +2 -2
- data/lib/watershed_uk.rb +0 -1
- metadata +3 -4
- data/lib/watershed_uk/internal/http.rb +0 -41
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 176f84354ab0579e88f79acea5ab9b2f973202b526c7422505854b9d4fe1ddd1
|
|
4
|
+
data.tar.gz: 05753a54475ea569b0dece05aa623d9eede9b916a0d0e9e0e8b16b6645070487
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eca038a9f071b6ef9e479ba8da6c0b51c5217cd84c0fd42b90b42deedcb778193451d5c14221e874e72e5285fdccc68d8a53bd855664ebdcf2f6701402686810
|
|
7
|
+
data.tar.gz: 178b595764435675f9f875d04411ac6dfe687d016821707db8e3b2927665afac60ef3f3f3e6502c6c64c7334e518d7e944fb170ab3c78dd3e699e3a6b8c4dfe7
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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
|
+
## [1.0.1] - 2026-11-02
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- Requests and London times use cinebase 5.8's `Cinebase::Http` and `Cinebase::London`.
|
|
9
|
+
- HTTP errors read "HTTP error 500 from watershed.ticketsolve.com" rather than "Ticketsolve HTTP error 500".
|
|
10
|
+
- Connections give up after 10 seconds rather than 30; responses still have 30 seconds.
|
|
11
|
+
|
|
5
12
|
## [1.0.0] - 2026-11-02
|
|
6
13
|
|
|
7
14
|
### Added
|
|
@@ -6,15 +6,19 @@ module WatershedUk
|
|
|
6
6
|
module Internal
|
|
7
7
|
# Reads Watershed's Ticketsolve box office
|
|
8
8
|
class Ticketsolve
|
|
9
|
-
|
|
9
|
+
USER_AGENT = 'Mozilla/5.0 (compatible; watershed_uk; +https://github.com/andycroll/watershed_uk)'
|
|
10
10
|
|
|
11
11
|
# Every show on sale at Watershed and its partner venues, with every
|
|
12
12
|
# advertised event, in one public document
|
|
13
13
|
FEED_URL = 'https://watershed.ticketsolve.com/shows.xml'
|
|
14
14
|
|
|
15
|
+
def initialize
|
|
16
|
+
@http = Cinebase::Http.new(headers: { 'User-Agent' => USER_AGENT })
|
|
17
|
+
end
|
|
18
|
+
|
|
15
19
|
# @return [String] the shows feed, parsed by {Parser::Feed}
|
|
16
20
|
def feed
|
|
17
|
-
get(FEED_URL)
|
|
21
|
+
@http.get(FEED_URL)
|
|
18
22
|
end
|
|
19
23
|
end
|
|
20
24
|
end
|
|
@@ -23,8 +23,6 @@ module WatershedUk
|
|
|
23
23
|
# @option options [Integer] :film_year (nil) year from the film's title
|
|
24
24
|
# @option options [Time] :starting_at listed start time of the performance
|
|
25
25
|
|
|
26
|
-
TIME_ZONE = 'Europe/London'.freeze
|
|
27
|
-
|
|
28
26
|
# Performances within an inclusive range of showing dates. The Ticketsolve
|
|
29
27
|
# feed holds every advertised date, so any range is one request.
|
|
30
28
|
# @param [String] cinema_id the cinema's id, 'watershed'
|
|
@@ -33,7 +31,7 @@ module WatershedUk
|
|
|
33
31
|
# @return [Array<WatershedUk::Performance>]
|
|
34
32
|
def self.at(
|
|
35
33
|
cinema_id,
|
|
36
|
-
from:
|
|
34
|
+
from: Cinebase::London.today,
|
|
37
35
|
to: from + 13
|
|
38
36
|
)
|
|
39
37
|
raise ArgumentError, 'to must not precede from' if to < from
|
|
@@ -65,10 +63,9 @@ module WatershedUk
|
|
|
65
63
|
# @return <Array[String]>
|
|
66
64
|
|
|
67
65
|
def self.screenings(shows, dates)
|
|
68
|
-
london = TZInfo::Timezone.get(TIME_ZONE)
|
|
69
66
|
shows.select { |show| Internal::Parser::Screening.film?(show) }.flat_map do |show|
|
|
70
67
|
show.events
|
|
71
|
-
.select { |event| dates.cover?(
|
|
68
|
+
.select { |event| dates.cover?(Cinebase::London.date(event.starting_at)) }
|
|
72
69
|
.map { |event| Internal::Parser::Screening.new(show, event) }
|
|
73
70
|
end
|
|
74
71
|
end
|
data/lib/watershed_uk/version.rb
CHANGED
data/lib/watershed_uk.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: watershed_uk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andy Croll
|
|
@@ -99,14 +99,14 @@ dependencies:
|
|
|
99
99
|
requirements:
|
|
100
100
|
- - "~>"
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '5.
|
|
102
|
+
version: '5.8'
|
|
103
103
|
type: :runtime
|
|
104
104
|
prerelease: false
|
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
106
106
|
requirements:
|
|
107
107
|
- - "~>"
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: '5.
|
|
109
|
+
version: '5.8'
|
|
110
110
|
- !ruby/object:Gem::Dependency
|
|
111
111
|
name: rexml
|
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -134,7 +134,6 @@ files:
|
|
|
134
134
|
- README.md
|
|
135
135
|
- lib/watershed_uk.rb
|
|
136
136
|
- lib/watershed_uk/cinema.rb
|
|
137
|
-
- lib/watershed_uk/internal/http.rb
|
|
138
137
|
- lib/watershed_uk/internal/parser/feed.rb
|
|
139
138
|
- lib/watershed_uk/internal/parser/screening.rb
|
|
140
139
|
- lib/watershed_uk/internal/ticketsolve.rb
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'net/http'
|
|
4
|
-
|
|
5
|
-
module WatershedUk
|
|
6
|
-
# Internal utility classes: Do not use
|
|
7
|
-
# @api private
|
|
8
|
-
module Internal
|
|
9
|
-
# Requests to Ticketsolve
|
|
10
|
-
module Http
|
|
11
|
-
TIMEOUT = 30
|
|
12
|
-
RETRIES = 2
|
|
13
|
-
USER_AGENT = 'Mozilla/5.0 (compatible; watershed_uk; +https://github.com/andycroll/watershed_uk)'
|
|
14
|
-
TRANSIENT_ERRORS = [
|
|
15
|
-
EOFError, Errno::ECONNRESET, Errno::ECONNREFUSED, Net::OpenTimeout, Net::ReadTimeout, OpenSSL::SSL::SSLError
|
|
16
|
-
].freeze
|
|
17
|
-
|
|
18
|
-
private
|
|
19
|
-
|
|
20
|
-
def get(url)
|
|
21
|
-
uri = URI(url)
|
|
22
|
-
attempts = 0
|
|
23
|
-
begin
|
|
24
|
-
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true, open_timeout: TIMEOUT, read_timeout: TIMEOUT) do |http|
|
|
25
|
-
http.request(Net::HTTP::Get.new(uri, 'User-Agent' => USER_AGENT))
|
|
26
|
-
end
|
|
27
|
-
rescue *TRANSIENT_ERRORS
|
|
28
|
-
attempts += 1
|
|
29
|
-
raise if attempts > RETRIES
|
|
30
|
-
|
|
31
|
-
sleep(attempts)
|
|
32
|
-
retry
|
|
33
|
-
end
|
|
34
|
-
# Omit response bodies from errors, and never follow redirects.
|
|
35
|
-
raise "Ticketsolve HTTP error #{response.code}" unless response.is_a?(Net::HTTPSuccess)
|
|
36
|
-
|
|
37
|
-
String.new(response.body, encoding: Encoding::UTF_8)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|