Module: BibleSearch::Chapters
- Defined in:
- lib/biblesearch-api/endpoints/chapters.rb
Instance Method Summary collapse
-
#chapter(chapter_sig, options = {}) ⇒ Object
def chapter(chapter_sig) #original.
- #chapters(book_sig) ⇒ Object
Instance Method Details
#chapter(chapter_sig, options = {}) ⇒ Object
def chapter(chapter_sig) #original
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/biblesearch-api/endpoints/chapters.rb', line 35 def chapter(chapter_sig, ={}) #option 1 # def chapter(options) #option 2 (options merged with sig, breaks string sig) chapter_sig = valid_chapter(chapter_sig) # uri += '?include_marginalia=true' if options.fetch(:include_marginalia, false) api_result = get_mash("/chapters/#{chapter_sig}.js", query: ) if api_result..http_code == 200 chapter = nil chapter = api_result.response.chapters.first fumsify(api_result, chapter) else nil end end |
#chapters(book_sig) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/biblesearch-api/endpoints/chapters.rb', line 20 def chapters(book_sig) book_sig = valid_book(book_sig) api_result = get_mash("/books/#{book_sig}/chapters.js") if api_result..http_code == 200 chapters = [] chapters = pluralize_result(api_result.response.chapters) fumsify(api_result, chapters) else # raise ArgumentError.new("Unrecognized book signature.") [] end end |