scott_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: 5c75ad6918639978c21390326e38fdfcf5886f1370aa334cbf033126612eaae1
4
- data.tar.gz: 2ef1613c736ff2ecfff93a4c5f8aca5c5d006be0f54a6224f852a98a7d28d773
3
+ metadata.gz: 312a255283c7d0e40ff0b942ad794a932970546989f1037405b1f82796ff71bb
4
+ data.tar.gz: f804e8a6edaa0ffd9d152f670dc792eedcdbec76d3e8840053aab9d6e6b121fe
5
5
  SHA512:
6
- metadata.gz: 92e4acd0631ca75f7dea25e2fd1cf8ff38e5684824c63aac58571cd9913e3574dba9c39ce61ad7bb5c2b556a9d65b1bcb39c920ca70c847fe595a7707cdd3a0b
7
- data.tar.gz: 24bb933aed665e63108747fa5073bb4f05c476d79f8ab664dc94fe7a97c1a443ac16513d0707c9c3b94d765952af272928226a05512692b58a0dc75c64605f63
6
+ metadata.gz: 732fadf6628e5cb09fcda60ad72d0a4841becc4b72d5f483c07325df1723e86804d971e96613f471184a69df2f3f783f57496e6217559b12c983633b186336af
7
+ data.tar.gz: 21b345e48610f083a195e9007f47b53fe9e8872408bf333d8b44b3cffba82bf82e6386f223f10494bb4df029fa26d22889f3bc503c6427ea474442e1b0074a27
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
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 www.scottcinemas.co.uk" rather than "Scott Cinemas HTTP error 500".
10
+
5
11
  ## [1.0.0] - 2026-11-01
6
12
 
7
13
  ### Added
@@ -8,16 +8,18 @@ module ScottUk
8
8
  # https://www.scottcinemas.co.uk/api. Each venue's feed holds every
9
9
  # advertised date.
10
10
  class Feed
11
- include Http
12
-
13
11
  URL = 'https://www.scottcinemas.co.uk/json.php'
14
12
 
13
+ def initialize
14
+ @http = Cinebase::Http.new
15
+ end
16
+
15
17
  # @param [String] code a venue's feed code, e.g. 'SCOBAR'
16
18
  # @return [Hash] the feed: 'cinema', 'films' by id, and 'schedule' of
17
19
  # showtimes by local midnight, then screen, then start, each a Unix
18
20
  # timestamp
19
21
  def listings(code)
20
- JSON.parse(get("#{URL}?cinema=#{CGI.escape(code)}"))
22
+ JSON.parse(@http.get("#{URL}?cinema=#{CGI.escape(code)}"))
21
23
  end
22
24
  end
23
25
  end
@@ -24,8 +24,6 @@ module ScottUk
24
24
  # @option options [String] :language (nil) audio language, e.g. 'Hindi'
25
25
  # @option options [Time] :starting_at listed start time of the performance
26
26
 
27
- TIME_ZONE = 'Europe/London'.freeze
28
-
29
27
  # Performances within an inclusive range of showing dates, from one
30
28
  # request: the venue's feed holds every advertised date.
31
29
  # @param [String] cinema_id the cinema's feed code, e.g. 'SCOBAR'
@@ -34,7 +32,7 @@ module ScottUk
34
32
  # @return [Array<ScottUk::Performance>]
35
33
  def self.at(
36
34
  cinema_id,
37
- from: TZInfo::Timezone.get(TIME_ZONE).now.to_date,
35
+ from: Cinebase::London.today,
38
36
  to: from + 13
39
37
  )
40
38
  raise ArgumentError, 'to must not precede from' if to < from
@@ -68,7 +66,7 @@ module ScottUk
68
66
  def self.showtimes_between(feed, from, to)
69
67
  films = Hash(feed['films'])
70
68
  Hash(feed['schedule']).flat_map do |midnight, screens|
71
- if (from..to).cover?(london_date(midnight))
69
+ if (from..to).cover?(Cinebase::London.date(Time.at(midnight.to_i)))
72
70
  Hash(screens).values.flat_map do |showtimes|
73
71
  Hash(showtimes).filter_map do |timestamp, showtime|
74
72
  film = films[showtime['film_id']]
@@ -81,10 +79,5 @@ module ScottUk
81
79
  end
82
80
  end
83
81
  private_class_method :showtimes_between
84
-
85
- def self.london_date(timestamp)
86
- TZInfo::Timezone.get(TIME_ZONE).to_local(Time.at(timestamp.to_i).utc).to_date
87
- end
88
- private_class_method :london_date
89
82
  end
90
83
  end
@@ -1,6 +1,6 @@
1
1
  # Ruby interface for https://www.scottcinemas.co.uk
2
- # @version 1.0.0
2
+ # @version 1.0.1
3
3
  module ScottUk
4
4
  # Gem version
5
- VERSION = '1.0.0'.freeze
5
+ VERSION = '1.0.1'.freeze
6
6
  end
data/lib/scott_uk.rb CHANGED
@@ -5,7 +5,6 @@ require 'cinebase'
5
5
 
6
6
  require_relative './scott_uk/version'
7
7
 
8
- require_relative './scott_uk/internal/http'
9
8
  require_relative './scott_uk/internal/feed'
10
9
  require_relative './scott_uk/internal/title_sanitizer'
11
10
  require_relative './scott_uk/internal/parser/showtime'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scott_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 Scott Cinemas website
111
111
  email:
112
112
  - andy@goodscary.com
@@ -121,7 +121,6 @@ files:
121
121
  - lib/scott_uk.rb
122
122
  - lib/scott_uk/cinema.rb
123
123
  - lib/scott_uk/internal/feed.rb
124
- - lib/scott_uk/internal/http.rb
125
124
  - lib/scott_uk/internal/parser/showtime.rb
126
125
  - lib/scott_uk/internal/title_sanitizer.rb
127
126
  - lib/scott_uk/performance.rb
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'net/http'
4
-
5
- module ScottUk
6
- # Internal utility classes: Do not use
7
- # @api private
8
- module Internal
9
- # Requests to scottcinemas.co.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 "Scott Cinemas 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