Zero dependencies — standard library only (net/http).
Install
gem install muaraicaptcha
Quick start
require "muaraicaptcha"
client = MuaraiCaptcha::Client.new("YOUR_API_KEY")
solution = client.solve(
"type" => "TurnstileTaskProxyless",
"websiteURL" => "https://example.com",
"websiteKey" => "0x4AAAAAAA..."
)
puts solution["token"]
API
client = MuaraiCaptcha::Client.new(client_key, base_url: "...", timeout: 30)
client.get_balance # => Float (USD)
client.create_task(task) # => Integer taskId
client.get_task_result(task_id) # => Hash solution, or nil while processing
client.report_incorrect(task_id) # auto-refund a bad solve
client.solve(task, poll_interval: 5, timeout: 180) # create + poll
Error handling
begin
client.solve(task)
rescue MuaraiCaptcha::ApiError => e
puts "#{e.code}: #{e.description}" # e.g. ERROR_ZERO_BALANCE
rescue MuaraiCaptcha::TimeoutError
puts "gave up waiting"
end
Documentation
License
MIT © MuaraiCaptcha