QR Code Reader API - Ruby Gem

QR Code Reader is a powerful tool that extracts text and data from QR codes in images. Simply provide an image URL or upload an image containing a QR code to decode its contents.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_qrcodereader'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_qrcodereader

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_qrcodereader'

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

# Make a request
response = client.execute({ image: "https://upload.wikimedia.org/wikipedia/commons/d/d7/Commons_QR_code.png" })

# Print the response
puts response

File Upload

# Upload a file
response = client.execute_with_file("/path/to/file.jpg")

# Or use a URL
response = client.execute_with_url("https://example.com/image.jpg")

Error Handling

begin
  response = client.execute({ image: "https://upload.wikimedia.org/wikipedia/commons/d/d7/Commons_QR_code.png" })
  puts response["data"]
rescue APIVerve::Qrcodereader::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Qrcodereader::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "text": "'Twas brillig",
    "location": {
      "topLeft": {
        "x": 9.927694968294492,
        "y": 9.927694968294492
      },
      "topRight": {
        "x": 215.24999999999997,
        "y": 9.749999999999996
      },
      "bottomLeft": {
        "x": 9.749999999999996,
        "y": 215.24999999999997
      },
      "bottomRight": {
        "x": 216.14779062994094,
        "y": 216.14779062994094
      }
    }
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.