Chess Move Validator API - Ruby Gem
Chess Move Validator verifies algebraic chess notation and identifies move types including castling, captures, checks, and promotions.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_chessmovevalidator'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_chessmovevalidator
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_chessmovevalidator'
# Initialize the client
client = APIVerve::Chessmovevalidator::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({ move: "Nf3" })
# Print the response
puts response
Error Handling
begin
response = client.execute({ move: "Nf3" })
puts response["data"]
rescue APIVerve::Chessmovevalidator::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Chessmovevalidator::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Chessmovevalidator::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"move": "Nf3",
"valid": true,
"type": "piece move",
"piece": "N",
"capture": false,
"check": false,
"checkmate": false,
"promotion": false
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/chessmovevalidator?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.