Thesaurus API - Ruby Gem

Thesaurus is a simple tool for getting word synonyms. It returns a list of synonyms.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_thesaurus'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_thesaurus

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_thesaurus'

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

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

# Print the response
puts response

Error Handling

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

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "word": "big",
    "similarCount": 50,
    "similarWords": [
      "large",
      "ample",
      "sizable",
      "sizeable",
      "astronomic",
      "astronomical",
      "galactic",
      "bigger",
      "larger",
      "biggest",
      "greatest",
      "largest",
      "biggish",
      "largish",
      "blown-up",
      "enlarged",
      "bouffant",
      "puffy",
      "bulky",
      "capacious",
      "colossal",
      "prodigious",
      "stupendous",
      "cosmic",
      "deep",
      "double",
      "elephantine",
      "gargantuan",
      "giant",
      "jumbo",
      "enormous",
      "tremendous",
      "epic",
      "heroic",
      "larger-than-life",
      "extensive",
      "extended",
      "gigantic",
      "mammoth",
      "great",
      "hulking",
      "hulky",
      "huge",
      "immense",
      "vast",
      "Brobdingnagian",
      "humongous",
      "banging",
      "thumping",
      "whopping"
    ]
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.