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 +4 -4
- data/lib/vpndetection/database_api.rb +15 -0
- data/lib/vpndetection/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ec6ec791baf60e18a16396d053982e23588f084125fa8e54d73554cdfabeea26
|
|
4
|
+
data.tar.gz: 2f8abd7e9159b1ae42840706a8f387602f5a655400634147a7facdeb501a1efe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
#
|
data/lib/vpndetection/version.rb
CHANGED