Slugify API - Ruby Gem
Slugify is a tool for converting text into URL-friendly slugs. It handles special characters, accents, and spaces to create clean, SEO-friendly URLs.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_slugify'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_slugify
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_slugify'
# Initialize the client
client = APIVerve::Slugify::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({
text: "Hello World! This is a Test & Example",
separator: "-",
lowercase: true
})
# Print the response
puts response
Error Handling
begin
response = client.execute({ text: "Hello World! This is a Test & Example", separator: "-", lowercase: true })
puts response["data"]
rescue APIVerve::Slugify::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Slugify::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Slugify::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"original": "Hello World! This is a Test & Example",
"slug": "hello-world-this-is-a-test-example",
"separator": "-",
"lowercase": true,
"length": 34
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/slugify?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.