Ring Size Converter API - Ruby Gem

Ring Size Converter is a tool for converting ring sizes between US, UK, EU, JP, CH, and AU standards. It can also convert from diameter measurements in millimeters.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_ringsizeconverter'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_ringsizeconverter

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_ringsizeconverter'

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

# Make a request
response = client.execute({
  size: "7",
  from: "us"
})

# Print the response
puts response

Error Handling

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

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "input_diameter_mm": 17.3,
    "circumference_mm": 54.3,
    "conversions": {
      "diameter_mm": 17.3,
      "circumference_mm": 54.3,
      "us": 7,
      "uk": "N",
      "eu": 52,
      "jp": 17,
      "ch": -22,
      "au": "N"
    },
    "note": "Sizes are approximate. For accurate sizing, visit a jeweler."
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.