omniplex_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: 214a923918e2ceaf94c27e71c88acefd9fbd529adaa6439b73e77415a46c1681
4
- data.tar.gz: 1ae9efee80308dfecf8dadafdc279a20417d4222694bdd4e184d1a79a574bc59
3
+ metadata.gz: c038439c8f7c98392325fff083019c8fa95a58347298be95026f11e49d11a8f1
4
+ data.tar.gz: 1ace9daee1c3ef257ce828a956377fe255bc6d3523de935c146851388c451c10
5
5
  SHA512:
6
- metadata.gz: 7e0a5d219d980dba3fce49080a9a52e137606f6ce9f1845b297e5a2751e978a90668cb4913e9a890caca9f5001184395f170d7549c96ae2cd957710d277774f5
7
- data.tar.gz: 0477df8657519fad5d298ebbe593a815a2decd253ed9c242229385eff87494edab66ea618341cb68550dfb67abf5672254d4bcad6f6ec3399e14240ac811849d
6
+ metadata.gz: bc8beb4a53abc83aa96e69fe5ed3423162b6a088ee4a7edcb992d786a3f7ac4038b0d4d74bfa750c835b1622a92d2308dbade85211c6ede6170b993c2f35d641
7
+ data.tar.gz: b534fc6c45bb756c870aef4ca18b11914a9eebb42af12c9a73a9fac8cdc73e30ca64c2990f5504ee79dc6d76770ed1a54eb48c88c5a516f8498f6e5f45106dc2
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
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
+
5
10
  ## [1.0.0] - 2026-11-01
6
11
 
7
12
  ### Added
@@ -1,5 +1,4 @@
1
1
  require 'cgi/escape'
2
- require 'net/http'
3
2
 
4
3
  module OmniplexUk
5
4
  # Internal utility classes: Do not use
@@ -19,10 +18,10 @@ module OmniplexUk
19
18
 
20
19
  # Pages claim ISO-8859-1 but mix UTF-8 with Windows-1252 apostrophes
21
20
  LEGACY_ENCODING = Encoding::Windows_1252
22
- RETRIES = 2
23
- TRANSIENT_ERRORS = [
24
- EOFError, Errno::ECONNRESET, Errno::ECONNREFUSED, Net::OpenTimeout, Net::ReadTimeout, OpenSSL::SSL::SSLError
25
- ].freeze
21
+
22
+ def initialize
23
+ @http = Cinebase::Http.new(keep_alive: true)
24
+ end
26
25
 
27
26
  # UK venues in the home page's site picker
28
27
  # @return [Array<Hash>] with :url, :name and :code, e.g.
@@ -58,8 +57,7 @@ module OmniplexUk
58
57
  end
59
58
 
60
59
  def close
61
- @http.finish if @http&.started?
62
- @http = nil
60
+ @http.close
63
61
  end
64
62
 
65
63
  private
@@ -71,35 +69,11 @@ module OmniplexUk
71
69
  end
72
70
 
73
71
  def get(path)
74
- attempts = 0
75
- begin
76
- response = http.request(Net::HTTP::Get.new(path))
77
- rescue *TRANSIENT_ERRORS
78
- close
79
- attempts += 1
80
- raise if attempts > RETRIES
81
-
82
- sleep(attempts)
83
- retry
84
- end
85
-
86
- if response.is_a?(Net::HTTPSuccess)
87
- decode(response.body)
88
- else
89
- # Omit response bodies from errors, and never follow redirects.
90
- raise "HTTP error #{response.code} from #{URI(WEBSITE).host}"
91
- end
92
- end
93
-
94
- def http
95
- @http ||= begin
96
- uri = URI(WEBSITE)
97
- Net::HTTP.start(uri.host, uri.port, use_ssl: true, open_timeout: 10, read_timeout: 30, max_retries: 0)
98
- end
72
+ decode(@http.get(WEBSITE + path))
99
73
  end
100
74
 
101
75
  def decode(body)
102
- body.dup.force_encoding(Encoding::UTF_8).scrub do |bytes|
76
+ body.scrub do |bytes|
103
77
  bytes.force_encoding(LEGACY_ENCODING).encode(Encoding::UTF_8, invalid: :replace, undef: :replace)
104
78
  end
105
79
  end
@@ -36,7 +36,6 @@ module OmniplexUk
36
36
  # Films whose genres include it are live and recorded events
37
37
  EVENT_GENRE = 'Event'.freeze
38
38
  MILLISECONDS = 1000
39
- TIME_ZONE = 'Europe/London'.freeze
40
39
 
41
40
  # @return [Date, nil] the day this page lists
42
41
  attr_reader :date
@@ -84,12 +83,12 @@ module OmniplexUk
84
83
  end
85
84
 
86
85
  def local_date(seconds)
87
- TZInfo::Timezone.get(TIME_ZONE).to_local(Time.at(seconds).utc).to_date
86
+ Cinebase::London.date(Time.at(seconds))
88
87
  end
89
88
 
90
89
  def starting_at(hour, minute)
91
90
  local = Time.utc(date.year, date.month, date.day, hour, minute)
92
- TZInfo::Timezone.get(TIME_ZONE).local_to_utc(local) { |periods| periods.first }.utc
91
+ Cinebase::London.utc(local)
93
92
  end
94
93
 
95
94
  def text(html)
@@ -67,7 +67,7 @@ module OmniplexUk
67
67
  # @return [Array<OmniplexUk::Performance>]
68
68
  def self.at(
69
69
  cinema_id,
70
- from: TZInfo::Timezone.get(TIME_ZONE).now.to_date,
70
+ from: Cinebase::London.today,
71
71
  to: from + 13
72
72
  )
73
73
  raise ArgumentError, 'to must not precede from' if to < from
@@ -1,6 +1,6 @@
1
1
  # Ruby interface for https://www.omniplexcinemas.co.uk
2
- # @version 1.0.0
2
+ # @version 1.0.1
3
3
  module OmniplexUk
4
4
  # Gem version
5
- VERSION = '1.0.0'.freeze
5
+ VERSION = '1.0.1'.freeze
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniplex_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 Omniplex Cinemas website
111
111
  email:
112
112
  - andy@goodscary.com