Pig Latin API - Ruby Gem
Pig Latin is a simple tool for encoding Pig Latin. It returns the encoded Pig Latin.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_piglatin'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_piglatin
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_piglatin'
# Initialize the client
client = APIVerve::Piglatin::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({
text: "The square wooden crate was packed to be shipped. To have is better than to wait and hope.",
exclusions: crate,hope
})
# Print the response
puts response
Error Handling
begin
response = client.execute({ text: "The square wooden crate was packed to be shipped. To have is better than to wait and hope.", exclusions: crate,hope })
puts response["data"]
rescue APIVerve::Piglatin::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Piglatin::APIError => e
puts "API error: #{e.message}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Piglatin::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"text": "Ethay uaresqay oodenway crate asway ackedpay otay ebay ippedshay. Otay avehay isyay etterbay anthay otay aitway andyay hope.",
"exlcusions": [
"crate",
"hope"
]
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/piglatin?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.