Cron Expression Generator API - Ruby Gem
Cron Expression Generator is an AI-powered tool for converting natural language schedule descriptions into cron expressions. It returns valid cron syntax along with human-readable descriptions.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_crongenerator'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_crongenerator
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_crongenerator'
# Initialize the client
client = APIVerve::Crongenerator::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({ schedule: "every weekday at 9am" })
# Print the response
puts response
Error Handling
begin
response = client.execute({ schedule: "every weekday at 9am" })
puts response["data"]
rescue APIVerve::Crongenerator::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Crongenerator::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Crongenerator::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"schedule": "every weekday at 9am",
"expression": "0 9 * * 1-5",
"description": "Runs every weekday at 9:00 AM."
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/crongenerator?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.