aliyun_intelligent_captcha 0.1.1 → 0.1.2
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 +9 -0
- data/lib/aliyun_intelligent_captcha/client.rb +5 -2
- data/lib/aliyun_intelligent_captcha/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: caa9e4f6902d4de2aac79931b4defab776b00dd83adc8d3aa3f74939474fce64
|
|
4
|
+
data.tar.gz: a46e141473aec0fbe94c8e44570ffa1b4ed3e1fc10e52594795248ece4b4440c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ba5cabbf2947d157fbb3d5fadb8ffeb55e89bb5052e7506b81d63409036834e48f1d736a0081ab6ef3fec267258d586711b278d4beefe28aa9944de2496b2ca6
|
|
7
|
+
data.tar.gz: a32e969511454e5364c5f6167e1edaadd01d8715316dbd03353e3738aae89aa147d056111c7b686073b0cfe31b240772879daa7c941901d604da0d12be9252b1
|
data/README.md
CHANGED
|
@@ -4,6 +4,15 @@ Ruby gem for verifying Alibaba Cloud intelligent captcha tokens with the `Verify
|
|
|
4
4
|
|
|
5
5
|
It has no runtime dependency on the Alibaba Cloud SDK. The client signs requests with Alibaba Cloud ACS3-HMAC-SHA256 and uses Ruby's standard `Net::HTTP`.
|
|
6
6
|
|
|
7
|
+
## Changelog
|
|
8
|
+
|
|
9
|
+
See [CHANGELOG.md](CHANGELOG.md) for version history and release notes.
|
|
10
|
+
|
|
11
|
+
## Latest Release
|
|
12
|
+
|
|
13
|
+
- `0.1.1`
|
|
14
|
+
- Fix railtie inheritance to use top-level `::Rails::Railtie`, preventing constant lookup conflicts in Rails apps.
|
|
15
|
+
|
|
7
16
|
## Installation
|
|
8
17
|
|
|
9
18
|
Add this line to your application's Gemfile:
|
|
@@ -15,7 +15,7 @@ require_relative "result"
|
|
|
15
15
|
module AliyunIntelligentCaptcha
|
|
16
16
|
class Client
|
|
17
17
|
ACTION = "VerifyIntelligentCaptcha"
|
|
18
|
-
CONTENT_TYPE = "application/
|
|
18
|
+
CONTENT_TYPE = "application/x-www-form-urlencoded"
|
|
19
19
|
SIGNATURE_ALGORITHM = "ACS3-HMAC-SHA256"
|
|
20
20
|
|
|
21
21
|
def initialize(access_key_id:,
|
|
@@ -57,12 +57,15 @@ module AliyunIntelligentCaptcha
|
|
|
57
57
|
|
|
58
58
|
def perform_request(payload)
|
|
59
59
|
uri = URI::HTTPS.build(host: @endpoint, path: "/")
|
|
60
|
-
body =
|
|
60
|
+
body = URI.encode_www_form(payload)
|
|
61
61
|
request = Net::HTTP::Post.new(uri)
|
|
62
62
|
request.body = body
|
|
63
63
|
signed_headers(body).each { |key, value| request[key] = value }
|
|
64
|
+
@logger&.info("[aliyun_intelligent_captcha] request: POST https://#{@endpoint}/ body=#{body.inspect}")
|
|
64
65
|
|
|
65
66
|
response = @http_client ? @http_client.call(request, uri) : net_http_request(uri, request)
|
|
67
|
+
@logger&.info("[aliyun_intelligent_captcha] response: status=#{response.code} body=#{response.body}")
|
|
68
|
+
|
|
66
69
|
validate_response!(response)
|
|
67
70
|
response
|
|
68
71
|
rescue Timeout::Error, SocketError, SystemCallError, OpenSSL::SSL::SSLError => error
|