Horoscope API - Ruby Gem

Horoscope is a simple tool for getting horoscope data. It returns the horoscope for the day.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_horoscope'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_horoscope

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_horoscope'

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

# Make a request
response = client.execute({ sign: "aries" })

# Print the response
puts response

Error Handling

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

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "color": "green",
    "compatibility": [
      "leo",
      "sagittarius"
    ],
    "horoscope": "Today, the celestial alignment initiates a deep dive into your emotional landscapes, prompting you to analyze your hidden sentiments to strengthen existing links and navigate difficulties with loved ones more successfully. Open communication becomes essential, allowing you to gracefully balance individual desires. Financially, shrewd judgments keep a cautious route, reducing unnecessary risks and consolidating existing assets. Pay concentrated consideration not to let minor grievances cloud your judgement, strive to discover common understanding and resolve internal clashes diplomatically to facilitate individual advancement, reinforcing your bonds through vulnerability while navigating the ups and downs of interpersonal relationships cautiously keeping everything in balance.",
    "luckyNumber": 12,
    "luckyTime": "8:00 AM",
    "mood": "excited",
    "sign": "aries",
    "zodiac": {
      "element": "fire",
      "name": "Aries",
      "stone": "bloodstone",
      "symbol": "♈"
    }
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.