Random Word API - Ruby Gem

Random Word is a simple tool for getting random words. It returns a random word.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_randomwords'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_randomwords

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_randomwords'

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

# Make a request
response = client.execute

# Print the response
puts response

Error Handling

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

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "word": "persevering",
    "definitions": [
      "Characterized by perseverance; persistent. -- Per`se*ver\"ing*ly, adv."
    ],
    "pronunciation": "P ER0 S AH0 V IH1 R IH0 NG"
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.