Website Screenshot API - Ruby Gem

Web Screenshots is a simple tool for capturing screenshots of web pages. It returns an image screenshot of the web page provided.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_webscreenshots'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_webscreenshots

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_webscreenshots'

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

# Make a request
response = client.execute({
  url: "https://ebay.com/",
  type: "png",
  width: 1024,
  height: 600,
  fullpage: false
})

# Print the response
puts response

Error Handling

begin
  response = client.execute({ url: "https://ebay.com/", type: "png", width: 1024, height: 600, fullpage: false })
  puts response["data"]
rescue APIVerve::Webscreenshots::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Webscreenshots::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "width": 1024,
    "height": 600,
    "scaleFactor": 1,
    "imageName": "77072426-6af8-45c2-93dd-d7013d2c765e.png",
    "expires": 1766097105719,
    "url": "https://ebay.com/",
    "downloadURL": "https://storage.googleapis.com/apiverve-helpers.appspot.com/webscreenshots/77072426-6af8-45c2-93dd-d7013d2c765e.png?GoogleAccessId=1089020767582-compute%40developer.gserviceaccount.com&Expires=1766097105&Signature=uZKa777XpeVnlwOZG7Uhjs%2BNkPzkEuiV4Wug2%2B%2BAHcPovRZ3iVjZEX%2FZhp7gnADXI6au5q0ggPwweoOFJeMCdk9zod6aZo4hlUDe1DsJf0oao4rh3tGUl5wPeudXLp7Y%2F3zVflup9Mp255LY6%2B2JdU0auOHdPnEYLDCvf705X9C%2BflmWQZKh7QKi74gvU8pqsP6Zc7SfJJsv5kmhP8SkO7TBZKBU6pAr2mNHKpKgB5mtfCRLbyPYcxawSGlTuyIyRXffWbkfHdDl6pquPX9J%2Fp5uGYM4jTrqrrrR1MPAOfkD7d9V5juqe5A7VvWmhiAyCMGDO%2BeqUO%2BSe6t9php0vA%3D%3D"
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.