Nobel Prizes API - Ruby Gem
Nobel Prizes is a simple tool for getting information on Nobel Prizes. It returns information on various Nobel Prizes.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_nobelprizes'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_nobelprizes
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_nobelprizes'
# Initialize the client
client = APIVerve::Nobelprizes::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({
firstname: "Albert",
lastname: "Einstein",
category: "Physics",
year: 1921
})
# Print the response
puts response
Error Handling
begin
response = client.execute({ firstname: "Albert", lastname: "Einstein", category: "Physics", year: 1921 })
puts response["data"]
rescue APIVerve::Nobelprizes::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Nobelprizes::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Nobelprizes::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"count": 1,
"filteredOn": [
"firstName",
"lastName",
"category",
"year"
],
"nobelPrizes": [
{
"firstName": "Albert",
"lastName": "Einstein",
"born": "1879-03-14",
"died": "1955-04-18",
"countryborn": "Germany",
"countrybornCode": "DE",
"born city": "Ulm",
"diedCountry": "USA",
"diedCountryCode": "US",
"diedCity": "Princeton NJ",
"gender": "male",
"year": "1921",
"category": "Physics",
"motivation": "for his services to Theoretical Physics and especially for his discovery of the law of the photoelectric effect",
"organization": "Kaiser-Wilhelm-Institut (now Max-Planck-Institut) für Physik",
"organizationCity": "Berlin",
"organizationCountry": "Germany"
}
]
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/nobelprizes?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.