Class: ESV::Bible
Instance Method Summary collapse
-
#daily_verse(options = {}) ⇒ Object
Display a verse that changes every day.
-
#initialize(default_options = {}) ⇒ Bible
constructor
The ESV API requires a key that can be passed in as one of the options, :key => ‘value’.
-
#passage_query(passage, options = {}) ⇒ Object
Lookup a passage.
-
#query(q, options = {}) ⇒ Object
Look up a passage or show word-search results, depending on the query.
-
#query_info(q) ⇒ Object
Parse and display information about your query, including identify whether it is a passage reference or a word search.
-
#verse(options = {}) ⇒ Object
Display a random verse from a preselected list, or specify verse(s).
Constructor Details
#initialize(default_options = {}) ⇒ Bible
The ESV API requires a key that can be passed in as one of the options, :key => ‘value’. By default, it is ‘IP’
10 11 12 13 |
# File 'lib/esv/bible.rb', line 10 def initialize(={}) @default_options = @default_options[:key] ||= 'IP' end |
Instance Method Details
#daily_verse(options = {}) ⇒ Object
Display a verse that changes every day
See www.esvapi.org/api for more information and options
51 52 53 |
# File 'lib/esv/bible.rb', line 51 def daily_verse(={}) self.class.get '/dailyVerse', :query => @default_options.merge() end |
#passage_query(passage, options = {}) ⇒ Object
Lookup a passage
See www.esvapi.org/api for more information and options
18 19 20 21 |
# File 'lib/esv/bible.rb', line 18 def passage_query(passage, ={}) [:passage] = passage self.class.get '/passageQuery', :query => @default_options.merge() end |
#query(q, options = {}) ⇒ Object
Look up a passage or show word-search results, depending on the query
The output format is always HTML.
See www.esvapi.org/api for more information and options
28 29 30 31 |
# File 'lib/esv/bible.rb', line 28 def query(q, ={}) [:q] = q self.class.get '/query', :query => @default_options.merge() end |
#query_info(q) ⇒ Object
Parse and display information about your query, including identify whether it is a passage reference or a word search
See www.esvapi.org/api for more information and options
36 37 38 39 |
# File 'lib/esv/bible.rb', line 36 def query_info(q) = {:q => q} self.class.get '/queryInfo', :query => @default_options.merge() end |
#verse(options = {}) ⇒ Object
Display a random verse from a preselected list, or specify verse(s)
See www.esvapi.org/api for more information and options
44 45 46 |
# File 'lib/esv/bible.rb', line 44 def verse(={}) self.class.get '/verse', :query => @default_options.merge() end |