Short Code Generator API - Ruby Gem

Short Code Generator is a tool for generating short alphanumeric codes. It supports multiple character sets including alphanumeric, alphabetic, numeric, hexadecimal, and Base58 with customizable length.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_shortcodegenerator'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_shortcodegenerator

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_shortcodegenerator'

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

# Make a request
response = client.execute({
  count: 1,
  length: 8,
  charset: "alphanumeric"
})

# Print the response
puts response

Error Handling

begin
  response = client.execute({ count: 1, length: 8, charset: "alphanumeric" })
  puts response["data"]
rescue APIVerve::Shortcodegenerator::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Shortcodegenerator::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "codes": [
      "bgiFznFh",
      "jr84hHsG",
      "Q77qABwn",
      "gvMjXxXs",
      "WDPJzCsi"
    ],
    "count": 5,
    "length": 8,
    "charset": "alphanumeric",
    "url_safe": true
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.