ASCII85 Encoder API - Ruby Gem

ASCII85 Encoder is a tool for encoding and decoding data using ASCII85 (also known as Base85) encoding. It supports both standard and btoa formats for efficient binary-to-text encoding with better compression than Base64.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_ascii85encoder'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_ascii85encoder

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_ascii85encoder'

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

# Make a request
response = client.execute({
  text: "Hello World",
  action: "encode",
  format: "standard"
})

# Print the response
puts response

Error Handling

begin
  response = client.execute({ text: "Hello World", action: "encode", format: "standard" })
  puts response["data"]
rescue APIVerve::Ascii85encoder::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Ascii85encoder::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "original_text": "Hello World",
    "encoded": "87cURD]i,\"Ebo7",
    "format": "standard",
    "original_length": 11,
    "encoded_length": 14,
    "compression_ratio": "127.27%"
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.