private_captcha 0.0.3 → 0.0.5
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/README.md +1 -1
- data/lib/private_captcha/client.rb +5 -4
- data/lib/private_captcha/verify_output.rb +4 -0
- data/lib/private_captcha/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 70c3d94ed5a3020b3f71df8c50558c2e1a09c5e245374844209d2734bc4d51a8
|
|
4
|
+
data.tar.gz: 6a3a267b62466abc243069c922af1440f77d6feaeac24c96238d1841aa9d4437
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 88e3e2caef19070d9aba49ceaf62b9a9eb0fb0c80bf56e6c9c90a86d513137248c9a8435b5fb751604c1bd1814f5d771ba9bf021a3278aa6ac964f13e0021716
|
|
7
|
+
data.tar.gz: 7bb7b45b726e696b3ea57d38c2ad6fbb1a9a7e37ac2ece858f50e43741512c39469f68732894ac0696b70c98c977459f18ebecb2cba12c4e8f294b628d76f4de
|
data/README.md
CHANGED
|
@@ -25,7 +25,7 @@ module PrivateCaptcha
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
28
|
-
def verify(solution, max_backoff_seconds: nil, attempts: nil)
|
|
28
|
+
def verify(solution, max_backoff_seconds: nil, attempts: nil, sitekey: nil)
|
|
29
29
|
raise EmptySolutionError if solution.nil? || solution.empty?
|
|
30
30
|
|
|
31
31
|
max_backoff = max_backoff_seconds || @config.max_backoff_seconds
|
|
@@ -52,7 +52,7 @@ module PrivateCaptcha
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
begin
|
|
55
|
-
response = do_verify(solution)
|
|
55
|
+
response = do_verify(solution, sitekey: sitekey)
|
|
56
56
|
error = nil
|
|
57
57
|
break
|
|
58
58
|
rescue RetriableError => e
|
|
@@ -81,7 +81,7 @@ module PrivateCaptcha
|
|
|
81
81
|
|
|
82
82
|
output = verify(solution)
|
|
83
83
|
|
|
84
|
-
unless output.
|
|
84
|
+
unless output.ok?
|
|
85
85
|
raise Error.new("captcha verification failed: #{output.error_message}",
|
|
86
86
|
trace_id: output.trace_id)
|
|
87
87
|
end
|
|
@@ -100,11 +100,12 @@ module PrivateCaptcha
|
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
103
|
-
def do_verify(solution)
|
|
103
|
+
def do_verify(solution, sitekey: nil)
|
|
104
104
|
request = Net::HTTP::Post.new(@endpoint)
|
|
105
105
|
request['X-Api-Key'] = @config.api_key
|
|
106
106
|
request['User-Agent'] = "private-captcha-ruby/#{VERSION}"
|
|
107
107
|
request['Content-Type'] = 'text/plain'
|
|
108
|
+
request['X-PC-Sitekey'] = sitekey if sitekey
|
|
108
109
|
request.body = solution
|
|
109
110
|
|
|
110
111
|
@logger.debug('Sending HTTP request') { "path=#{@endpoint.path} method=POST" }
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: private_captcha
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Taras Kushnir
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-12-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rack
|