SEO Quick Validator API - Ruby Gem

SEO Validator is a simple tool for validating SEO metrics. It returns a structured breakdown of on-page SEO checks, a list of issues to fix, and a composite 0-100 SEO score with a letter grade for the web page.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_seovalidator'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_seovalidator

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_seovalidator'

# Initialize the client
client = APIVerve::Seovalidator::Client.new(api_key: "YOUR_API_KEY")

# Make a request
response = client.execute({ url: "https://apiverve.com" })

# Print the response
puts response

Error Handling

begin
  response = client.execute({ url: "https://apiverve.com" })
  puts response["data"]
rescue APIVerve::Seovalidator::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Seovalidator::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

# Enable debug logging
client = APIVerve::Seovalidator::Client.new(
  api_key: "YOUR_API_KEY",
  debug: true
)

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "url": "https://apiverve.com",
    "passed": false,
    "issueCount": 6,
    "issues": [
      "Image missing 'alt' attribute: '/assets/img/hero-diagram.png'",
      "Image missing 'alt' attribute: '/assets/img/logo-mark.svg'",
      "External link missing 'rel' attribute: 'https://twitter.com/apiverve'",
      "External link missing 'rel' attribute: 'https://github.com/apiverve'",
      "External link missing 'rel' attribute: 'https://status.apiverve.com'",
      "Missing meta 'keywords' tag in head"
    ],
    "checks": {
      "hasTitle": true,
      "titleLength": 54,
      "hasMetaDescription": true,
      "metaDescriptionLength": 158,
      "hasMetaKeywords": false,
      "h1Count": 1,
      "hasCanonical": true,
      "hasViewport": true,
      "imagesTotal": 8,
      "imagesMissingAlt": 2,
      "externalLinksTotal": 10,
      "externalLinksMissingRel": 3
    },
    "seoScore": 93,
    "grade": "A"
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.