rio_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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e3e5119b7aa4f3c0822c76f974c76e2be2ebdfb9a9c08fcc3fac80549551eaf
4
- data.tar.gz: b06872046de7982781e513ff8813e87b832490aafc18d5da46f0ef1b69ce7575
3
+ metadata.gz: e5ef446c0ede3a7a5303a2b0b508cb852d3449e40e3f4b6a0a217dbe5ad3999c
4
+ data.tar.gz: fe3e3af145fab3fa0024a09d8cb0b2c62983ece7af107083622366dee162f046
5
5
  SHA512:
6
- metadata.gz: e952d79239ed7ccffd543dd7a0cbb4e540ec8c0fa66c0ccb889af162b2269720fc481ac39efbae8dd9e5ea770b81e12679fbca672b7ca76f8a369fd273a44c89
7
- data.tar.gz: 1f2909dcd30cdf621ceeadcf1d1b4e1d184668cccba4c75b5dbfc6cbfb3ca85cc53e8228ed0f6b5541b3555aa57341c0e87f6fbba112de55b631a2079c9b7adb
6
+ metadata.gz: 95e1fb398ff5a15fd5ff0f9617ec71efc6f2b915e2937e0422d6b5edad900403ce55bdbe99b127e283d9cfbf9e6d4ba2afb7c723a98687b911b5b5cd8ac9eb1f
7
+ data.tar.gz: 65d10f4992e8503f1ba5adf338b2f1cbd3e15a5998c0539618ecc0f599a5a208b9010d991783c30a69f127f9237e256a4c826815362b8f14ba86fe4e760ca848
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
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 riocinema.org.uk" instead of "Rio Cinema HTTP error 500".
10
+
11
+ ### Removed
12
+ - `RioUk::Performance::TIME_ZONE`, now unused.
13
+
5
14
  ## [1.0.0] - 2026-11-02
6
15
 
7
16
  The first release, as 1.0.0.
@@ -33,7 +33,6 @@ module RioUk
33
33
  YES = 'Y'
34
34
  THREE_D = /\b3D\b/i
35
35
  YEAR = /\A\d{4}\z/
36
- TIME_ZONE = 'Europe/London'
37
36
 
38
37
  # @param [Hash] event one of the website's Savoy events
39
38
  def initialize(event)
@@ -101,7 +100,7 @@ module RioUk
101
100
  def starting_at(performance, date)
102
101
  hour, minute = performance.fetch('StartTime').unpack('a2a2').map(&:to_i)
103
102
  local = Time.utc(date.year, date.month, date.day, hour, minute)
104
- TZInfo::Timezone.get(TIME_ZONE).local_to_utc(local) { |periods| periods.first }.utc
103
+ Cinebase::London.utc(local)
105
104
  end
106
105
 
107
106
  def strands
@@ -7,17 +7,19 @@ module RioUk
7
7
  # Reads the Rio Cinema's website, run on Savoy Systems' ticketing. No
8
8
  # token is needed.
9
9
  class Website
10
- include Http
11
-
12
10
  WHATS_ON = 'https://riocinema.org.uk/Rio.dll/WhatsOn'
13
11
  # Savoy pages carry the whole programme as one line of JSON
14
12
  EVENTS = /^var Events =\s*(\{.*\})\s*$/
15
13
 
14
+ def initialize
15
+ @http = Cinebase::Http.new
16
+ end
17
+
16
18
  # Every event on sale with every advertised performance, however far
17
19
  # ahead, including sold out ones
18
20
  # @return [Array<Hash>] Savoy events, each with its 'Performances'
19
21
  def events
20
- JSON.parse(get(WHATS_ON)[EVENTS, 1] || '{}').fetch('Events', [])
22
+ JSON.parse(@http.get(WHATS_ON)[EVENTS, 1] || '{}').fetch('Events', [])
21
23
  end
22
24
 
23
25
  # @param [String] path a Savoy link relative to the what's on page,
@@ -23,8 +23,6 @@ module RioUk
23
23
  # @option options [Integer] :film_year (nil) year of the film
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, from one
29
27
  # request: the what's on page holds every advertised date.
30
28
  # @param [String] cinema_id the cinema's id, 'rio'
@@ -33,7 +31,7 @@ module RioUk
33
31
  # @return [Array<RioUk::Performance>]
34
32
  def self.at(
35
33
  cinema_id,
36
- from: TZInfo::Timezone.get(TIME_ZONE).now.to_date,
34
+ from: Cinebase::London.today,
37
35
  to: from + 13
38
36
  )
39
37
  raise ArgumentError, 'to must not precede from' if to < from
@@ -1,6 +1,6 @@
1
1
  # Ruby interface for https://riocinema.org.uk
2
- # @version 1.0.0
2
+ # @version 1.0.1
3
3
  module RioUk
4
4
  # Gem version
5
- VERSION = '1.0.0'.freeze
5
+ VERSION = '1.0.1'.freeze
6
6
  end
data/lib/rio_uk.rb CHANGED
@@ -5,7 +5,6 @@ require 'cinebase'
5
5
 
6
6
  require_relative './rio_uk/version'
7
7
 
8
- require_relative './rio_uk/internal/http'
9
8
  require_relative './rio_uk/internal/website'
10
9
  require_relative './rio_uk/internal/title_sanitizer'
11
10
  require_relative './rio_uk/internal/parser/event'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rio_uk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.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.7'
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.7'
109
+ version: '5.8'
110
110
  description: Pull movie & cinema information from the Rio Cinema website
111
111
  email:
112
112
  - andy@goodscary.com
@@ -120,7 +120,6 @@ files:
120
120
  - README.md
121
121
  - lib/rio_uk.rb
122
122
  - lib/rio_uk/cinema.rb
123
- - lib/rio_uk/internal/http.rb
124
123
  - lib/rio_uk/internal/parser/event.rb
125
124
  - lib/rio_uk/internal/title_sanitizer.rb
126
125
  - lib/rio_uk/internal/website.rb
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'net/http'
4
-
5
- module RioUk
6
- # Internal utility classes: Do not use
7
- # @api private
8
- module Internal
9
- # Requests to riocinema.org.uk
10
- module Http
11
- RETRIES = 2
12
- TRANSIENT_ERRORS = [
13
- EOFError, Errno::ECONNRESET, Errno::ECONNREFUSED, Net::OpenTimeout, Net::ReadTimeout, OpenSSL::SSL::SSLError
14
- ].freeze
15
-
16
- private
17
-
18
- def get(url)
19
- uri = URI(url)
20
- attempts = 0
21
- begin
22
- response = Net::HTTP.start(uri.host, uri.port, use_ssl: true, open_timeout: 10, read_timeout: 30) do |http|
23
- http.request(Net::HTTP::Get.new(uri))
24
- end
25
- rescue *TRANSIENT_ERRORS
26
- attempts += 1
27
- raise if attempts > RETRIES
28
-
29
- sleep(attempts)
30
- retry
31
- end
32
- # Omit response bodies from errors, and never follow redirects.
33
- raise "Rio Cinema HTTP error #{response.code}" unless response.is_a?(Net::HTTPSuccess)
34
-
35
- String.new(response.body, encoding: Encoding::UTF_8)
36
- end
37
- end
38
- end
39
- end