Solar Potential API - Ruby Gem
Solar Potential is a simple tool for getting the estimated annual energy production of a PV system. It returns the estimated annual energy production of a PV system.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_solarpotential'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_solarpotential
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_solarpotential'
# Initialize the client
client = APIVerve::Solarpotential::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({
lat: 37.7749,
lon: -122.4194
})
# Print the response
puts response
Error Handling
begin
response = client.execute({ lat: 37.7749, lon: -122.4194 })
puts response["data"]
rescue APIVerve::Solarpotential::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Solarpotential::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Solarpotential::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"coordinates": {
"latitude": 37.7749,
"longitude": -122.4194
},
"usableHours": {
"avgDailyUsableSunlightHours": 12.19,
"yearlyUsableSunlightHoursRaw": 4448,
"adjustedYearlyUsableSunlightHours": 1557
},
"bestDirection": "South",
"cloudFactor": 0.35,
"disclaimer": "This is a rough estimate based on coordinates and general climate patterns. For precise solar potential, consider local weather patterns, obstructions, and professional assessments."
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/solarpotential?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.