Class: BibleGateway
- Inherits:
-
Object
- Object
- BibleGateway
- Defined in:
- lib/bible_gateway.rb,
lib/bible_gateway/version.rb
Constant Summary collapse
- GATEWAY_URL =
"http://biblegateway.com"
- CLASSIC_GATEWAY_URL =
"http://classic.biblegateway.com"
- VERSIONS =
{ :american_standard_version => "ASV", :amplified_bible => "AMP", :common_english_bible => "CEB", :contemporary_english_version => "CEV", :darby_translation => "DARBY", :english_standard_version => "ESV", :holman_christian_standard_bible => "HCSB", :king_james_version => "KJV", :king_james_version_21st_century => "KJ21", :new_american_standard_bible => "NASB", :new_century_version => "NCV", :new_international_readers_version => "NIRV", :new_international_version => "NIV", :new_international_version_uk => "NIVUK", :new_king_james_version => "NKJV", :new_living_translation => "NLT", :new_revised_standard_version => "NRSV", :the_message => "MSG", :todays_new_international_version => "TNIV", :world_english_bible => "WEB", :worldwide_english_new_testament => "WE", :wycliffe_new_testament => "WYC", :youngs_literal_translation => "YLT", # French :bible_du_semeur => "BDS", :louis_segond => "LSG", :nouvelle_edition_de_geneve => "NEG1979", :segond_21 => "SG21", #Chinese :chinese_new_version_simplified => "CNVS", :chinese_union_version_simplified => "CUVS", }
- VERSION =
"0.1.0"
Instance Attribute Summary collapse
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(version = :king_james_version) ⇒ BibleGateway
constructor
A new instance of BibleGateway.
- #lookup(passage) ⇒ Object
- #old_lookup(passage) ⇒ Object
Constructor Details
#initialize(version = :king_james_version) ⇒ BibleGateway
Returns a new instance of BibleGateway.
54 55 56 |
# File 'lib/bible_gateway.rb', line 54 def initialize(version = :king_james_version) self.version = version end |
Instance Attribute Details
#version ⇒ Object
Returns the value of attribute version.
52 53 54 |
# File 'lib/bible_gateway.rb', line 52 def version @version end |
Class Method Details
.versions ⇒ Object
48 49 50 |
# File 'lib/bible_gateway.rb', line 48 def self.versions VERSIONS.keys end |
Instance Method Details
#lookup(passage) ⇒ Object
63 64 65 66 67 |
# File 'lib/bible_gateway.rb', line 63 def lookup(passage) response = Typhoeus.get(passage_url(passage), followlocation: true) doc = Nokogiri::HTML(response.body) scrape_passage(doc, @version) end |
#old_lookup(passage) ⇒ Object
69 70 71 72 73 |
# File 'lib/bible_gateway.rb', line 69 def old_lookup(passage) response = Typhoeus.get(old_passage_url(passage), followlocation: true) doc = Nokogiri::HTML(response.body) old_way_scrape_passage(doc) end |