Silver Price API - Ruby Gem
Silver Price is a simple tool for getting the current price of silver. It returns the current price of silver in any currency and in various units.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_silverprice'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_silverprice
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_silverprice'
# Initialize the client
client = APIVerve::Silverprice::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({
currency: "USD",
hourly: true
})
# Print the response
puts response
Error Handling
begin
response = client.execute({ currency: "USD", hourly: true })
puts response["data"]
rescue APIVerve::Silverprice::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Silverprice::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Silverprice::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"currency": "USD",
"gram": 1.74,
"kilogram": 1737.95,
"ounce": 49.27,
"lastUpdated": "2026-02-07T12:00:00.000Z",
"change24h": 0.42,
"change24hPct": 0.86,
"changeDirection": "up",
"high24h": 49.55,
"low24h": 48.8,
"formatted": {
"ounce": "$49.27",
"gram": "$1.74",
"kilogram": "$1,737.95"
}
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://silverprice.apiverve.com?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.