picturehouse_uk 6.0.0-x86_64-linux-gnu → 6.0.1-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a83a8906383b34dd528cbc7e0e9e8ba544451e598f4bdff3daac5c88859e6387
4
- data.tar.gz: 7f25eaf8d6ded251a4747fb31b865cfb9cd1a0c2bdc7f9556df86b3dc91b8f82
3
+ metadata.gz: fac24a15e6d610e273d5e6e5b07f5ca7105cb41a3f17ce3efd010f35e67116ed
4
+ data.tar.gz: fe58044d6693d6a462a150f334966b03240ed423566b652daef5839bdb50f8ce
5
5
  SHA512:
6
- metadata.gz: a3ece7b8c341a0bdffa8d0c198e31b8bb0d5a347e1683c27f4dabb4c51681355bce5edd148cb0b6f1da4866399c9883a0ef4824150363017e83e3d1dc6814387
7
- data.tar.gz: 25d4b2880e9a6630fb0234a182160fc3ea5a32eef182962b63e809273af7f6dfd8dc0d0a90d0e226a1330a3861118e7844432fdd6aa3edf5e16bc7173e4c68d2
6
+ metadata.gz: 3226a90addbc189b3ede1d137379e0c90a945f05d939253eb40732f62d0fd5a5fcd337b9e980ffbdbacabb4df2f6184b4a40326b49f04709853681df7e7b74d3
7
+ data.tar.gz: 8790b89ab6d0c8ad891df56f4ad45c240a817b4ceb2dccc8650665e172179112e22ee552b8cf895e30f9927158423c12a2f2874ec92a6f6fb37e9ddd818c7219
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
+ ## [6.0.1] - 2026-10-22
6
+
7
+ ### Changed
8
+ - Reuse one Vista client, and so one kept-alive connection, for all requests until the token changes, instead of opening a TLS connection for every request. Requires cinebase 5.5.
9
+
5
10
  ## [6.0.0] - 2026-10-22
6
11
 
7
12
  ### Changed
@@ -25,10 +25,17 @@ module PicturehouseUk
25
25
 
26
26
  private
27
27
 
28
- # Picturehouse's API rejects every Connect-Region-Code, so send none.
28
+ # One client keeps one connection open, so reuse it until the token
29
+ # changes. Picturehouse's API rejects every Connect-Region-Code, so
30
+ # send none.
29
31
  def client
30
- Cinebase::Vista::Client.new(base_url: BASE_URL, region_code: nil,
31
- token: PicturehouseUk.token)
32
+ token = PicturehouseUk.token
33
+ if @client.nil? || @client_token != token
34
+ @client_token = token
35
+ @client = Cinebase::Vista::Client.new(base_url: BASE_URL, region_code: nil,
36
+ token: token)
37
+ end
38
+ @client
32
39
  end
33
40
  end
34
41
  end
@@ -1,6 +1,6 @@
1
1
  # Ruby interface for https://www.picturehouses.com
2
- # @version 6.0.0
2
+ # @version 6.0.1
3
3
  module PicturehouseUk
4
4
  # Gem version
5
- VERSION = '6.0.0'.freeze
5
+ VERSION = '6.0.1'.freeze
6
6
  end
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'simplecov', '< 1'
26
26
  spec.add_development_dependency 'webmock'
27
27
 
28
- spec.add_runtime_dependency 'cinebase', '~> 5.4'
28
+ spec.add_runtime_dependency 'cinebase', '~> 5.5'
29
29
  end
@@ -44,8 +44,36 @@ class PicturehouseUk::Internal::ApiResponseTest < Minitest::Test
44
44
  assert_raises(PicturehouseUk::AuthenticationError) { api.sites }
45
45
  end
46
46
 
47
+ def test_reuses_one_client_while_the_token_holds
48
+ stub_request(:get, "#{BASE_URL}/sites").to_return(status: 200, body: sites_json)
49
+ shared = api
50
+
51
+ assert_equal 1, count_clients { 3.times { shared.sites } }
52
+ end
53
+
54
+ def test_builds_a_new_client_for_a_new_token
55
+ stub_request(:get, "#{BASE_URL}/sites").to_return(status: 200, body: sites_json)
56
+ shared = api
57
+
58
+ clients = count_clients do
59
+ shared.sites
60
+ PicturehouseUk.token = 'renewed-jwt'
61
+ shared.sites
62
+ end
63
+
64
+ assert_equal 2, clients
65
+ end
66
+
47
67
  private
48
68
 
69
+ def count_clients
70
+ clients = 0
71
+ original = Cinebase::Vista::Client.method(:new)
72
+ counting = ->(**options) { clients += 1; original.call(**options) }
73
+ Cinebase::Vista::Client.stub(:new, counting) { yield }
74
+ clients
75
+ end
76
+
49
77
  def api
50
78
  PicturehouseUk::Internal::ApiResponse.new
51
79
  end
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.0
4
+ version: 6.0.1
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.4'
116
+ version: '5.5'
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.4'
123
+ version: '5.5'
124
124
  description: Pull movie & cinema information from the Picturehouse Vista API
125
125
  email:
126
126
  - andy@goodscary.com