ULID Generator API - Ruby Gem
ULID Generator is a tool for generating Universally Unique Lexicographically Sortable Identifiers (ULIDs). ULIDs are 26-character strings that are sortable by time and collision-resistant.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_ulidgenerator'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_ulidgenerator
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_ulidgenerator'
# Initialize the client
client = APIVerve::Ulidgenerator::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({
count: 1,
timestamp: 1609459200000
})
# Print the response
puts response
Error Handling
begin
response = client.execute({ count: 1, timestamp: 1609459200000 })
puts response["data"]
rescue APIVerve::Ulidgenerator::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Ulidgenerator::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Ulidgenerator::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"ulids": [
"01KCMMK564DMMCC17AVBZTVNT1",
"01KCMMK565ZE4681DFAEWBF95G",
"01KCMMK566K1REYH0JEK4Q8DKW",
"01KCMMK5670W9EHFNX76R8FKWH",
"01KCMMK568SFRY6DCZTZYMR66Y"
],
"count": 5,
"timestamp": 1765924246724,
"format": "26 characters (10 timestamp + 16 random)",
"sortable": true,
"case_insensitive": true
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/ulidgenerator?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.