Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ To use the api2captcha gem, you'll need to import the module and create a Client
```ruby
require 'api-2captcha'

client = Api2Captcha.new(api_key: "YOUR_API_KEY")
client = Api2Captcha.new("YOUR_API_KEY")
```

There are a few options that can be configured using the Client instance:

```ruby
client.apy_key = "YOUR_API_KEY"
client.api_key = "YOUR_API_KEY"
```

### Client instance options
Expand Down
11 changes: 8 additions & 3 deletions lib/api_2captcha/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ def solve(method, params = {}, file_path = nil, return_id: false)
params["key"] = @api_key
params["soft_id"] = @soft_id
params["json"] = 1

if @callback
params["pingback"] = @callback
return_id = true
else
return_id
end
complete_params = get_params(params)
captcha_id = send_request(complete_params)
return_id ? get_result(captcha_id) : captcha_id

return_id ? captcha_id : get_result(captcha_id)
end

def send(*args)
Expand Down Expand Up @@ -184,7 +190,6 @@ def send_request(params)
req.content_type = 'application/json'
req.body = params.to_json
captcha_id = get_captcha_id(make_request(uri, req))
handle_response(captcha_id)
end

def get_params(params)
Expand Down