vpndetection 3.0.0 → 3.1.0

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: d80c8ce32eeb125e13622a5edae6ea738396941432e2d1d666872b5d1f1caff5
4
- data.tar.gz: b895a219283c89c84690405ad7bd7719175d7e4303885e05de9325a1f273c785
3
+ metadata.gz: ec6ec791baf60e18a16396d053982e23588f084125fa8e54d73554cdfabeea26
4
+ data.tar.gz: 2f8abd7e9159b1ae42840706a8f387602f5a655400634147a7facdeb501a1efe
5
5
  SHA512:
6
- metadata.gz: 579cb6d0adcd24b1e83b8bcca8d9aefcde2c5f2ff99a0534cf447a397a133942bdeab4c41245cc541c9e46e6c193601e850a02a70c1e0e29ba79d6dcd0d77f82
7
- data.tar.gz: efb8371a1b228608ebc835bf15fd7942004b9aabca5668c6cc0d471e26ddcce5367e9daa2e376bb57934ed67e509aad521754981481c94d65c335ef42a673807
6
+ metadata.gz: 9b64120388a69ece3380e2c413f25967738a8afaef826d62d1729ed16fce48b6980bea4b301e8f19d66a2f2f3c4f9e0c1e00d2761e0243b6d8777a9a947f9596
7
+ data.tar.gz: 8d427526b7b79d44aa777080c140da7e79da69160018cff9766f17b2fe8ccd9464f825173fe8593f5b3e5dae7d3ed94d9d373f0d0df783bbaedf08d9eac2e361
@@ -32,6 +32,7 @@ module VPNDetection
32
32
  # publishes is the API's choice, not ours, and the response nests them one
33
33
  # level down under `checksums`.
34
34
  def checksums(id, format)
35
+ check_format!(format)
35
36
  call { @api.database_checksum(id, format).checksums }
36
37
  end
37
38
 
@@ -47,6 +48,7 @@ module VPNDetection
47
48
  # START of a transfer, so one already running is not interrupted when it
48
49
  # lapses.
49
50
  def download_url(id, format)
51
+ check_format!(format)
50
52
  call { redirect_location(id, format) }
51
53
  end
52
54
 
@@ -91,6 +93,19 @@ module VPNDetection
91
93
 
92
94
  private
93
95
 
96
+ # A format the API does not publish is refused HERE rather than sent.
97
+ #
98
+ # The generator used to emit this check inline in the wire client; naming
99
+ # the enum in the spec made it stop, so an unknown format became a network
100
+ # round trip and a 400. Owning it in this layer keeps the behaviour where a
101
+ # caller can see it and independent of what the generator emits.
102
+ def check_format!(format)
103
+ return if DatabaseFormat.all_vars.include?(format)
104
+
105
+ raise ArgumentError,
106
+ "invalid value for \"format\", must be one of #{DatabaseFormat.all_vars}"
107
+ end
108
+
94
109
  # Runs one transfer of a presigned link, handing each chunk to the block, and
95
110
  # returns the bytes that reached it.
96
111
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VPNDetection
4
- VERSION = '3.0.0'
4
+ VERSION = '3.1.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vpndetection
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mslm Dev