Antonym Finder API - Ruby Gem

Antonym is a simple tool for getting the antonyms of a word. It returns a list of antonyms for the given word.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_antonym'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_antonym

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_antonym'

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

# Make a request
response = client.execute({ word: "happy" })

# Print the response
puts response

Error Handling

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

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "word": "happy",
    "language": "en",
    "antonyms": [
      "sad",
      "unhappy",
      "miserable",
      "depressed",
      "glum"
    ]
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.