Bible API - Ruby Gem
Bible is a simple tool for getting bible verses. Simply provide the book, chapter, and verse, and the API will return the verse.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_bible'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_bible
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_bible'
# Initialize the client
client = APIVerve::Bible::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({
book: "Genesis",
version: "KJV",
chapter: 5,
verse: 17
})
# Print the response
puts response
Error Handling
begin
response = client.execute({ book: "Genesis", version: "KJV", chapter: 5, verse: 17 })
puts response["data"]
rescue APIVerve::Bible::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Bible::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Bible::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"text": "But with thee will I establish my covenant; and thou shalt come into the ark, thou, and thy sons, and thy wife, and thy sons' wives with thee.",
"book": "Genesis",
"abbr": "gn",
"chapter": 6,
"verses": [
18
],
"version": "KJV",
"testament": "Old Testament",
"bookNumber": 1,
"totalChapters": 50,
"totalVersesInChapter": 22,
"wordCount": 29
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://bible.apiverve.com?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.