0.01
No commit activity in last 3 years
No release in over 3 years
A gem to assist in pulling back and querying scripture.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

~> 1.2.1
~> 1.15.0
 Project Readme

Scripture Lookup Gem Build Status Code Climate

Providers a clean interface to common scripture providers, such as Crossways ESV and Bible Gateway.

Current (default) provider is BibleGatewayScraper, which pulls back scripture from Bible Gateway.

This is a work in progress and all feedback or collaboration is welcome.

Progress Thus Far

A screen-scrape interface to Bible Gateway has been implemented and provides (by far) the most comprehensive list of translations available.

The Crossways ESV API provider is a work in progress on the crossways branch.

Usage

gem install scripture_lookup
require 'scripture_lookup'

Shortcut to bring back a BibleGatewayScraper instance:

provider = ScriptureLookup.new

Example usage - #to_s to pull back the text only:

response = provider.lookup("John 3:16", :NASB)
response.to_s

=> "\“For God so loved the world, that He gave His only begotten Son, that whoever believes in Him shall not perish, but have eternal life."

Example usage - #verses to pull back an array of verses

response = provider.lookup("1 Thess 5:16-18", :ESV)
response.verses

=> ["Rejoice always,",
    "pray without ceasing,",
    "give thanks in all circumstances; for this is the will of God in Christ Jesus for you."]

The ScriptureLookup::Response object also gives access to the full response data, by way of the #response_data accessor.

  • This is a fairly complicated collection of hashes and arrays.
  • See comments in response.rb for the dirty details.

Command Line Interface

Installation of this gem includes a command line interface. To utilize, call "scripture , " from the command line.

defaults to "NASB" if none is provided.

The command line interface utilizes the Bible Gateway screen-scrape provider.

ex.

scripture "John 3:16", NASB
scripture "John 3:16"
scripture "Psalm 23", ESV
scripture "Rom 12:1-2", NIV

Error Handling

Taking a page from Avdi Grimm's Exceptional Ruby book, any errors that descend from StandardError are caught and wrapped in a namespaced error (ScriptureLookup::Error) before they are allowed to unwind back to the client application.

This is true of any public interface into the gem.

To Do

  • Refactor CrosswaysEsvProvider to utilize the new Response object.
  • Refactor the Response object's @response_data structure into something more object-oriented than the current hash of hashes/arrays.
  • Obtain credentials and access to the new Bible Gateway API and implement a non-screen-scraped provider.