Interest Rate API - Ruby Gem

Interest Rate is a tool for retrieving current and historical central bank policy interest rates for major economies worldwide. It returns the latest rate along with the central bank name and effective date.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_interestrate'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_interestrate

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_interestrate'

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

# Make a request
response = client.execute({
  country: "US",
  date: "2024-06"
})

# Print the response
puts response

Error Handling

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

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "country": "US",
    "countryName": "United States",
    "centralBank": "Federal Reserve",
    "rate": 4.5,
    "date": "2026-02-05",
    "lastUpdated": "2026-02-05T05:00:00.000Z",
    "lastChanged": "2026-01-29",
    "change": -0.25,
    "changeDirection": "down",
    "previousRate": 4.75
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.