Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Wrapper around the ESV api (http://www.esvapi.org/api)

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE.md
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 esv_api.gemspec
README.md

ESV_API

An API Wrapper for the ESV API

Installation

    gem 'esv_api'

Usage

For your rails app:

    #Create an initializer:

    ESV.configure do |config|
      config.api_key = YOUR_API_KEY
    end
    @esv_text = ESV.passage_query( params[:passage] || "John 1", { 'include-footnotes' => 'false', 'include-headings' => 'false', 'include-subheadings' => 'false', 'include-audio-link' => 'false' } )

Query Types

The following methods are available as query types:

    passage_query(passage, options={})

    query( q, options={} )

    reading_plan_query( options={} )

    query_info( q, options={} )

    reading_plan_info( options={} )

    verse( options={} )

    daily_verse( options={} )

Query Options

The gem mirrors the API. To pass in options, just use the options hash in any available method, using options of the same name as specified in the ESV API documentation.

For example:

    @esv_text = ESV.passage_query( params[:passage] || "John 1", { 'include-footnotes' => 'false', 'include-headings' => 'false', 'include-subheadings' => 'false', 'include-audio-link' => 'false' } )

Formatting HTML Output

HTML is the default output and will appear unless output-format is specified. To make full use of the text, you will probably want to link a CSS stylesheet to your page, either one you've created or GNP's CSS. This stylesheet contains close to the minimum markup needed to render the text accurately.

Caching

If you have the dalli gem installed, esv_api will cache the data returned from passage_query calls, taking options into account when setting the key.

Credits

With love to the Twitter Gem, from which I borrowed heavily.

Something went wrong with that request. Please try again.