Stars Lookup API - Ruby Gem
Stars Lookup is a simple tool for looking up star data. It returns the star name, mass, diameter, and more.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_starslookup'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_starslookup
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_starslookup'
# Initialize the client
client = APIVerve::Starslookup::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({ name: "Sirius" })
# Print the response
puts response
Error Handling
begin
response = client.execute({ name: "Sirius" })
puts response["data"]
rescue APIVerve::Starslookup::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Starslookup::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Starslookup::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"starName": "Sirius",
"mass": 4.674385e+30,
"diameter": 2825760,
"galX": -5.895,
"galY": -6.152,
"galZ": -1.167,
"dist": 8.6,
"starType": "A1(V)",
"temp": 9500,
"color": "0xbaccff"
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/starslookup?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.