Class: ProverbsNiv
- Inherits:
-
Object
- Object
- ProverbsNiv
- Defined in:
- lib/proverbs_niv.rb
Class Method Summary collapse
- .getAllChapterNumbers ⇒ Object
- .getChapterContent(chapNum) ⇒ Object
- .getChapterVerses(chapNum) ⇒ Object
- .getContentOfAllChapters ⇒ Object
- .getRecurCountNoSw(chapNum) ⇒ Object
- .getRecurCountNoSwAllChapters ⇒ Object
- .getRecurCountSw(chapNum) ⇒ Object
- .getRecurCountSwAllChapters ⇒ Object
- .getVersesOfAllChapters ⇒ Object
- .init ⇒ Object
Instance Method Summary collapse
- #get_chapter ⇒ Object
- #get_rec_nsw ⇒ Object
- #get_sw_count ⇒ Object
- #get_verses ⇒ Object
-
#initialize(chapter, verses, stop_worded_verses, rec_nsw) ⇒ ProverbsNiv
constructor
A new instance of ProverbsNiv.
Constructor Details
#initialize(chapter, verses, stop_worded_verses, rec_nsw) ⇒ ProverbsNiv
Returns a new instance of ProverbsNiv.
7 8 9 10 11 12 |
# File 'lib/proverbs_niv.rb', line 7 def initialize(chapter, verses, stop_worded_verses, rec_nsw) @chapter = chapter @verses = verses @stop_worded_verses = stop_worded_verses @rec_nsw = rec_nsw end |
Class Method Details
.getAllChapterNumbers ⇒ Object
50 51 52 |
# File 'lib/proverbs_niv.rb', line 50 def self.getAllChapterNumbers return @outerHash.keys end |
.getChapterContent(chapNum) ⇒ Object
82 83 84 |
# File 'lib/proverbs_niv.rb', line 82 def self.getChapterContent(chapNum) return @outerHash[chapNum.to_s] end |
.getChapterVerses(chapNum) ⇒ Object
86 87 88 |
# File 'lib/proverbs_niv.rb', line 86 def self.getChapterVerses(chapNum) return @outerHash[chapNum.to_s]["verses"] end |
.getContentOfAllChapters ⇒ Object
54 55 56 |
# File 'lib/proverbs_niv.rb', line 54 def self.getContentOfAllChapters return @outerHash end |
.getRecurCountNoSw(chapNum) ⇒ Object
90 91 92 |
# File 'lib/proverbs_niv.rb', line 90 def self.getRecurCountNoSw(chapNum) return @outerHash[chapNum.to_s]["rec_nsw"] end |
.getRecurCountNoSwAllChapters ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/proverbs_niv.rb', line 66 def self.getRecurCountNoSwAllChapters @verses = Hash.new @outerHash.each do |chap_num, chap_value| @verses[chap_num] = chap_value["rec_nsw"] end return @verses end |
.getRecurCountSw(chapNum) ⇒ Object
94 95 96 |
# File 'lib/proverbs_niv.rb', line 94 def self.getRecurCountSw(chapNum) return @outerHash[chapNum.to_s]["sw_rec_count"] end |
.getRecurCountSwAllChapters ⇒ Object
74 75 76 77 78 79 80 |
# File 'lib/proverbs_niv.rb', line 74 def self.getRecurCountSwAllChapters @verses = Hash.new @outerHash.each do |chap_num, chap_value| @verses[chap_num] = chap_value["sw_rec_count"] end return @verses end |
.getVersesOfAllChapters ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/proverbs_niv.rb', line 58 def self.getVersesOfAllChapters @verses = Hash.new @outerHash.each do |chap_num, chap_value| @verses[chap_num] = chap_value["verses"] end return @verses end |
.init ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/proverbs_niv.rb', line 30 def self.init uri = URI("http://bookofproverbs.herokuapp.com/api/v1/niv_bible") http = Net::HTTP.new(uri.host, uri.port) req = Net::HTTP::Get.new(uri.path) resp = http.request(req) data = JSON.parse(resp.body) data.each do |key, value| @localHash = Hash.new @proverb = ProverbsNiv.new(key, value["verses"], value["stop_worded_verses"], value["rec_nsw"]) @localHash["chapter"] = @proverb.get_chapter @localHash["verses"] = @proverb.get_verses @localHash["rec_nsw"] = @proverb.get_rec_nsw @localHash["sw_rec_count"] = @proverb.get_sw_count @outerHash[@proverb.get_chapter] = @localHash end return "init complete" end |
Instance Method Details
#get_chapter ⇒ Object
14 15 16 |
# File 'lib/proverbs_niv.rb', line 14 def get_chapter return @chapter end |
#get_rec_nsw ⇒ Object
26 27 28 |
# File 'lib/proverbs_niv.rb', line 26 def get_rec_nsw return @rec_nsw end |
#get_sw_count ⇒ Object
22 23 24 |
# File 'lib/proverbs_niv.rb', line 22 def get_sw_count return @stop_worded_verses end |
#get_verses ⇒ Object
18 19 20 |
# File 'lib/proverbs_niv.rb', line 18 def get_verses return @verses end |