ruby-2captcha 1.0.5 → 1.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: 6cc7d94f83479f1d8c57bb4cf2315a2fcb04475a7c9f2ca170b09648d95d830e
4
- data.tar.gz: 759ff2de9c3fed201fcb467e52b4fe2c0d24af9c006596ed58002c3b2f7b42b4
3
+ metadata.gz: d80f00729bbf9f6f08867c59bb5d6e078dbe7675dc14a0b7dd65922ab640663c
4
+ data.tar.gz: b8dd22428eab71d775a7d597bd42d661f8ded8cd1b94f30c7c54be507ea5a769
5
5
  SHA512:
6
- metadata.gz: 9c9f92edcd7270fa86a6fcc287734596c8a9de31bb491451ab2569adb3d555c104716436cfb386dab9d95e0a4bb747a85e6a4dfc7ff705c4ae2b31689e8615ad
7
- data.tar.gz: 71bd866a8dfe6e82b49abe66537ec7d2b0bcdef58e6e2bace9f9fc024a0e21e071aaa021cca517a31bf2f1d2b3296c94ece3485a76dab9d2d92190aab86c84aa
6
+ metadata.gz: 36f2d745961278c462b64b2cccbc30b6fee82b67e0b4f768f8068babb1c9af5b8e675b88089ad7c81afa33321f288749ac808d01f23966a50c498a70dea4aeac
7
+ data.tar.gz: f91c2ec90c7d09edf188c47b9718bf4152f508f808146b965a3be0e8fa69dbf661cc70df9b8634ff760bcdf54d79d44873119abf09bb353f494203139b670c02
@@ -27,7 +27,8 @@ module Api2Captcha
27
27
  @domain = DEFAULT_DOMAIN
28
28
  end
29
29
 
30
- def solve(method, params = {}, file_path = nil, return_id: false)
30
+ def solve(method, file_path = nil, return_id: false, **params)
31
+ params = params.transform_keys(&:to_s)
31
32
  params["method"] = method
32
33
  params["key"] = @api_key
33
34
  params["soft_id"] = @soft_id
@@ -70,7 +71,8 @@ module Api2Captcha
70
71
  when Net::HTTPSuccess
71
72
  response_json = JSON.parse(response.body)
72
73
  if response_json["status"] == 1
73
- return response_json["request"]
74
+ response_json["captcha_id"] = captcha_id
75
+ return response_json
74
76
  elsif response_json["request"] == "CAPCHA_NOT_READY"
75
77
  sleep(polling_interval)
76
78
  else
@@ -169,12 +171,12 @@ module Api2Captcha
169
171
  end
170
172
 
171
173
  def audio(params)
172
- audio = params.delete(:audio)
174
+ audio = params.delete("audio")
173
175
  audio_content = File.file?(audio) ? File.binread(audio) : audio
174
176
 
175
177
  params = params.merge(
176
178
  "body" => Base64.strict_encode64(audio_content),
177
- "lang" => params[:lang]
179
+ "lang" => params["lang"]
178
180
  )
179
181
  solve("audio", params)
180
182
  end
@@ -198,12 +200,12 @@ module Api2Captcha
198
200
  end
199
201
 
200
202
  def get_params(params)
201
- params[:image].nil? ? params : file_params(params)
203
+ params["image"].nil? ? params : file_params(params)
202
204
  end
203
205
 
204
206
  def file_params(params)
205
- image = params.delete(:image)
206
- hint_image = params.delete(:hint_image)
207
+ image = params.delete("image")
208
+ hint_image = params.delete("hint_image")
207
209
 
208
210
  image_content = get_image_content(image)
209
211
  hint_image_content = get_image_content(hint_image) if hint_image
@@ -245,7 +247,7 @@ module Api2Captcha
245
247
  if response_json["status"] == 1
246
248
  response_json["request"]
247
249
  else
248
- raise ApiException, "API Error: #{response_json["error_text"]}"
250
+ raise ApiException, "API Error: #{response_json["request"]}"
249
251
  end
250
252
  else
251
253
  raise NetworkException, "Network Error: #{response.code.to_i}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Api2Captcha
4
- VERSION = "1.0.5"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-2captcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 2captcha.com
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-03 00:00:00.000000000 Z
11
+ date: 2023-07-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby package for easy integration with the API of 2captcha captcha solving
14
14
  service to bypass recaptcha, hcaptcha, funcaptcha, geetest and solve any other captchas.