Number Base Converter API - Ruby Gem

Number Base Converter is a tool for converting numbers between different bases (2-36). It supports binary, octal, decimal, hexadecimal, and custom bases with comprehensive conversion results.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_numberbaseconverter'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_numberbaseconverter

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_numberbaseconverter'

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

# Make a request
response = client.execute({
  value: "255",
  from: 10,
  to: 10
})

# Print the response
puts response

Error Handling

begin
  response = client.execute({ value: "255", from: 10, to: 10 })
  puts response["data"]
rescue APIVerve::Numberbaseconverter::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Numberbaseconverter::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "input_value": "FF",
    "input_base": 16,
    "input_base_name": "hexadecimal",
    "decimal_value": 255,
    "output_value": "255",
    "output_base": 10,
    "output_base_name": "decimal"
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.