lib/bible_gateway.rb in bible_gateway-0.0.4 vs lib/bible_gateway.rb in bible_gateway-0.0.5
- old
+ new
@@ -1,9 +1,9 @@
# coding: utf-8
require 'bible_gateway/version'
-require 'open-uri'
require 'nokogiri'
+require 'typhoeus'
class BibleGatewayError < StandardError; end
class BibleGateway
GATEWAY_URL = "http://www.biblegateway.com"
@@ -45,10 +45,11 @@
raise BibleGatewayError, 'Unsupported version' unless VERSIONS.keys.include? version
@version = version
end
def lookup(passage)
- doc = Nokogiri::HTML(open(passage_url(passage)))
+ response = Typhoeus.get(passage_url(passage), followlocation: true)
+ doc = Nokogiri::HTML(response.body)
scrape_passage(doc)
end
private
def passage_url(passage)