Open Source Licenses API - Ruby Gem
Open Source Licenses is a simple tool for getting information on open source licenses. It returns information on various open source licenses.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_openlicenses'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_openlicenses
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_openlicenses'
# Initialize the client
client = APIVerve::Openlicenses::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({ name: "MIT" })
# Print the response
puts response
Error Handling
begin
response = client.execute({ name: "MIT" })
puts response["data"]
rescue APIVerve::Openlicenses::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Openlicenses::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Openlicenses::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"domain_content": false,
"domain_data": false,
"domain_software": true,
"legacy_ids": [
"mit-license"
],
"license": "MIT",
"name": "MIT License",
"license_url": "https://opensource.org/licenses/MIT",
"license_status": "active",
"isOsiApproved": true,
"compatibleDomains": [
"software"
]
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/openlicenses?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.