Roman Numeral Math API - Ruby Gem

Roman Numeral Math is a tool for performing mathematical operations (add, subtract, multiply, divide) with Roman numerals. It shows both numeric and Roman numeral equations.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_romannumeralmath'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_romannumeralmath

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_romannumeralmath'

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

# Make a request
response = client.execute({
  roman1: "XIV",
  roman2: "VI",
  operation: "add"
})

# Print the response
puts response

Error Handling

begin
  response = client.execute({ roman1: "XIV", roman2: "VI", operation: "add" })
  puts response["data"]
rescue APIVerve::Romannumeralmath::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Romannumeralmath::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "roman1": "XIV",
    "roman2": "VI",
    "roman1_value": 14,
    "roman2_value": 6,
    "operation": "add",
    "result_number": 20,
    "result_roman": "XX",
    "equation_numeric": "14 + 6 = 20",
    "equation_roman": "XIV + VI = XX"
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.