Random Quote API - Ruby Gem

Random Quote is a simple tool for getting random quotes. It returns a random quote from a collection of quotes.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_randomquote'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_randomquote

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_randomquote'

# Initialize the client
client = APIVerve::Randomquote::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::Randomquote::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Randomquote::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "quote": "Your sacred space is where you can find yourself again and again.",
    "author": "Joseph Campbell"
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.