esv 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +74 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/bin/esv +9 -0
- data/bin/esv_daily_verse +5 -0
- data/esv.gemspec +72 -0
- data/lib/esv.rb +56 -0
- data/lib/esv/bible.rb +55 -0
- data/lib/esv/reading_plan.rb +29 -0
- data/spec/esv/bible_spec.rb +32 -0
- data/spec/esv/reading_plan_spec.rb +34 -0
- data/spec/esv_spec.rb +4 -0
- data/spec/fixtures/passage_query.html +51 -0
- data/spec/fixtures/passage_query.xml +96 -0
- data/spec/fixtures/reading_plan_info.xml +19 -0
- data/spec/fixtures/reading_plan_query.html +96 -0
- data/spec/fixtures/reading_plan_query.xml +257 -0
- data/spec/spec_helper.rb +25 -0
- metadata +109 -0
data/.document
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Geoffrey Dagley
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
= esv
|
2
|
+
|
3
|
+
Wrapper for English Standard Version (ESV) Bible Web Service. See ESV API docs http://www.esvapi.org/
|
4
|
+
|
5
|
+
This is a work in progress. Things are still in flux.
|
6
|
+
|
7
|
+
Source: http://github.com/gdagley/esv
|
8
|
+
Build status: http://runcoderun.com/gdagley/esv
|
9
|
+
|
10
|
+
== SYNOPSIS:
|
11
|
+
|
12
|
+
Application use:
|
13
|
+
|
14
|
+
b = ESV::Bible.new
|
15
|
+
|
16
|
+
Default response for most actions is HTML
|
17
|
+
b.passage_query('John 1:1') # => "<div class=\"esv\"><h2>John 1:1 <object type=\"application/x-shockwave-flash\" data=\"http://www.esvapi.org/assets/play.swf?myUrl=hw%2F43001001\" width=\"40\" height=\"12\" class=\"audio\"><param name=\"movie\" value=\"http://www.esvapi.org/assets/play.swf?myUrl=hw%2F43001001\" /><param name=\"wmode\" value=\"transparent\" /></object></h2>\n<div class=\"esv-text\"><h3 id=\"p43001001.01-1\">The Word Became Flesh</h3>\n<p class=\"chapter-first\" id=\"p43001001.05-1\"><span class=\"chapter-num\" id=\"v43001001-1\">1:1 </span>In the beginning was the Word, and the Word was with God, and the Word was God. (<a href=\"http://www.esv.org\" class=\"copyright\">ESV</a>)</p>\n</div>\n</div>"
|
18
|
+
|
19
|
+
XML responses are converted to Hashes
|
20
|
+
b.passage_query('John 1:1', 'output-format' => 'crossway-xml-1.0') # => {"crossway_bible"=>{"class"=>"passage-query", "passage"=>{"reference"=>"John 1:1", "surrounding_chapters"=>{"previous"=>"Luke 24", "current"=>"John 1", "next"=>"John 2"}, "content"=>{"verse_unit"=>"<markerclass=\"begin-verse\" mid=\"v43001001\"></marker><begin_chapternum=\"1\"></begin_chapter><heading>The Word Became Flesh</heading><begin_paragraphclass=\"chapter-first\"></begin_paragraph><verse_numbegin_chapter=\"1\">1</verse_num>In the beginning was the Word, and the Word was with God, and the Word was God.<end_paragraph></end_paragraph>"}}, "copyright"=>"The Holy Bible, English Standard Version copyright (c)2001 by Crossway Bibles, a division of Good News Publishers. Used by permission. All rights reserved. http://www.esv.org"}}
|
21
|
+
|
22
|
+
Command line use:
|
23
|
+
|
24
|
+
'esv' - for looking up verses and passages
|
25
|
+
|
26
|
+
> esv John 1:1
|
27
|
+
=======================================================
|
28
|
+
John 1:1
|
29
|
+
_______________________________________________________
|
30
|
+
The Word Became Flesh
|
31
|
+
|
32
|
+
[1:1]In the beginning was the Word, and the Word was with God, and the
|
33
|
+
Word was God. (ESV)
|
34
|
+
|
35
|
+
'esv_daily_verse' - for retrieving the ESV Daily Verse
|
36
|
+
|
37
|
+
> esv_daily_verse
|
38
|
+
=======================================================
|
39
|
+
Romans 8:38-39
|
40
|
+
[38]For I am sure that neither death nor life, nor angels nor rulers,
|
41
|
+
nor things present nor things to come, nor powers, [39]nor height nor
|
42
|
+
depth, nor anything else in all creation, will be able to separate us
|
43
|
+
from the love of God in Christ Jesus our Lord. (ESV)
|
44
|
+
|
45
|
+
== TODO
|
46
|
+
|
47
|
+
* Add command line binaries for:
|
48
|
+
* 'esv_daily_reading' - for retrieving the ESV Daily Reading Plan
|
49
|
+
* Finish specs
|
50
|
+
* Make more Ruby-like
|
51
|
+
|
52
|
+
== REQUIREMENTS:
|
53
|
+
|
54
|
+
* httparty
|
55
|
+
|
56
|
+
== INSTALL:
|
57
|
+
|
58
|
+
* sudo gem install gdagley-esv
|
59
|
+
|
60
|
+
== Note on Patches/Pull Requests
|
61
|
+
|
62
|
+
* Fork the project.
|
63
|
+
* Make your feature addition or bug fix.
|
64
|
+
* Add tests for it. This is important so I don't break it in a
|
65
|
+
future version unintentionally.
|
66
|
+
* Commit, do not mess with rakefile, version, or history.
|
67
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
68
|
+
* Send me a pull request. Bonus points for topic branches.
|
69
|
+
|
70
|
+
== Copyright
|
71
|
+
|
72
|
+
Copyright (c) 2009 Geoffrey Dagley. See LICENSE for details.
|
73
|
+
|
74
|
+
The Holy Bible, English Standard Version copyright (c)2001 by Crossway Bibles, a publishing ministry of Good News Publishers. Used by permission. All rights reserved.
|
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "esv"
|
8
|
+
gem.summary = %Q{Wrapper for English Standard Version (ESV) Bible Web Service. See ESV API docs http://www.esvapi.org/}
|
9
|
+
gem.email = "gdagley@gmail.com"
|
10
|
+
gem.homepage = "http://github.com/gdagley/esv"
|
11
|
+
gem.authors = ["Geoffrey Dagley"]
|
12
|
+
gem.add_dependency "httparty"
|
13
|
+
gem.add_development_dependency "rspec"
|
14
|
+
gem.add_development_dependency "fakeweb"
|
15
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
+
end
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'spec/rake/spectask'
|
22
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
23
|
+
spec.libs << 'lib' << 'spec'
|
24
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
25
|
+
end
|
26
|
+
|
27
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
28
|
+
spec.libs << 'lib' << 'spec'
|
29
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
30
|
+
spec.rcov = true
|
31
|
+
end
|
32
|
+
|
33
|
+
task :spec => :check_dependencies
|
34
|
+
|
35
|
+
task :default => :spec
|
36
|
+
|
37
|
+
require 'rake/rdoctask'
|
38
|
+
Rake::RDocTask.new do |rdoc|
|
39
|
+
if File.exist?('VERSION')
|
40
|
+
version = File.read('VERSION')
|
41
|
+
else
|
42
|
+
version = ""
|
43
|
+
end
|
44
|
+
|
45
|
+
rdoc.rdoc_dir = 'rdoc'
|
46
|
+
rdoc.title = "esv #{version}"
|
47
|
+
rdoc.rdoc_files.include('README*')
|
48
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.3
|
data/bin/esv
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
3
|
+
require 'esv'
|
4
|
+
|
5
|
+
if ARGV.empty?
|
6
|
+
puts "Usage : esv PASSAGE\nexample: esv John 1:1"
|
7
|
+
else
|
8
|
+
puts ESV::Bible.new('output-format' => 'plain-text').passage_query(ARGV.join(' '))
|
9
|
+
end
|
data/bin/esv_daily_verse
ADDED
data/esv.gemspec
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{esv}
|
8
|
+
s.version = "0.1.3"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Geoffrey Dagley"]
|
12
|
+
s.date = %q{2009-09-16}
|
13
|
+
s.email = %q{gdagley@gmail.com}
|
14
|
+
s.executables = ["esv", "esv_daily_verse"]
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"bin/esv",
|
27
|
+
"bin/esv_daily_verse",
|
28
|
+
"esv.gemspec",
|
29
|
+
"lib/esv.rb",
|
30
|
+
"lib/esv/bible.rb",
|
31
|
+
"lib/esv/reading_plan.rb",
|
32
|
+
"spec/esv/bible_spec.rb",
|
33
|
+
"spec/esv/reading_plan_spec.rb",
|
34
|
+
"spec/esv_spec.rb",
|
35
|
+
"spec/fixtures/passage_query.html",
|
36
|
+
"spec/fixtures/passage_query.xml",
|
37
|
+
"spec/fixtures/reading_plan_info.xml",
|
38
|
+
"spec/fixtures/reading_plan_query.html",
|
39
|
+
"spec/fixtures/reading_plan_query.xml",
|
40
|
+
"spec/spec_helper.rb"
|
41
|
+
]
|
42
|
+
s.homepage = %q{http://github.com/gdagley/esv}
|
43
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
44
|
+
s.require_paths = ["lib"]
|
45
|
+
s.rubygems_version = %q{1.3.5}
|
46
|
+
s.summary = %q{Wrapper for English Standard Version (ESV) Bible Web Service. See ESV API docs http://www.esvapi.org/}
|
47
|
+
s.test_files = [
|
48
|
+
"spec/esv/bible_spec.rb",
|
49
|
+
"spec/esv/reading_plan_spec.rb",
|
50
|
+
"spec/esv_spec.rb",
|
51
|
+
"spec/spec_helper.rb"
|
52
|
+
]
|
53
|
+
|
54
|
+
if s.respond_to? :specification_version then
|
55
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
56
|
+
s.specification_version = 3
|
57
|
+
|
58
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
59
|
+
s.add_runtime_dependency(%q<httparty>, [">= 0"])
|
60
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
61
|
+
s.add_development_dependency(%q<fakeweb>, [">= 0"])
|
62
|
+
else
|
63
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
64
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
65
|
+
s.add_dependency(%q<fakeweb>, [">= 0"])
|
66
|
+
end
|
67
|
+
else
|
68
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
69
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
70
|
+
s.add_dependency(%q<fakeweb>, [">= 0"])
|
71
|
+
end
|
72
|
+
end
|
data/lib/esv.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'esv/bible'
|
2
|
+
require 'esv/reading_plan'
|
3
|
+
|
4
|
+
module ESV
|
5
|
+
OUTPUT_FORMATS =
|
6
|
+
['html', 'crossway-xml-1.0', 'plain-text', 'mp3']
|
7
|
+
|
8
|
+
HTML_OPTIONS =
|
9
|
+
{
|
10
|
+
'include-passage-references' => true,
|
11
|
+
'include-first-verse-numbers' => true,
|
12
|
+
'include-verse-numbers' => true,
|
13
|
+
'include-footnotes' => true,
|
14
|
+
'include-footnote-links' => true,
|
15
|
+
'include-headings' => true,
|
16
|
+
'include-subheadings' => true,
|
17
|
+
'include-surrounding-chapters' => false,
|
18
|
+
'include-word-ids' => false,
|
19
|
+
'link-url' => 'http://www.gnpcb.org/esv/search/',
|
20
|
+
'include-audio-link' => true,
|
21
|
+
'audio-format' => 'flash',
|
22
|
+
'audio-version' => 'hw',
|
23
|
+
'include-short-copyright' => true,
|
24
|
+
'include-copyright' => false,
|
25
|
+
}
|
26
|
+
|
27
|
+
XML_OPTIONS =
|
28
|
+
{
|
29
|
+
'include-xml-declaration' => false,
|
30
|
+
'include-doctype' => true,
|
31
|
+
'include-quote-entities' => true,
|
32
|
+
'include-simple-entities' => false,
|
33
|
+
'include-cross-references' => false,
|
34
|
+
'include-line-breaks' => true,
|
35
|
+
'include-word-ids' => false,
|
36
|
+
'include-virtual-attributes' => false,
|
37
|
+
'base-element' => 'verse-unit',
|
38
|
+
}
|
39
|
+
|
40
|
+
TEXT_OPTIONS =
|
41
|
+
{
|
42
|
+
'include-passage-references' => true,
|
43
|
+
'include-first-verse-numbers' => true,
|
44
|
+
'include-verse-numbers' => true,
|
45
|
+
'include-footnotes' => true,
|
46
|
+
'include-short-copyright' => true,
|
47
|
+
'include-copyright' => false,
|
48
|
+
'include-passage-horizontal-lines' => true,
|
49
|
+
'include-heading-horizontal-lines' => true,
|
50
|
+
'include-headings' => true,
|
51
|
+
'include-subheadings' => true,
|
52
|
+
'include-selahs' => true,
|
53
|
+
'include-content-type' => true,
|
54
|
+
'line-length' => 74,
|
55
|
+
}
|
56
|
+
end
|
data/lib/esv/bible.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
|
3
|
+
module ESV
|
4
|
+
class Bible
|
5
|
+
include HTTParty
|
6
|
+
|
7
|
+
base_uri 'http://www.esvapi.org/v2/rest/'
|
8
|
+
|
9
|
+
# The ESV API requires a key that can be passed in as one of the options, :key => 'value'. By default, it is 'IP'
|
10
|
+
def initialize(default_options={})
|
11
|
+
@default_options = default_options
|
12
|
+
@default_options[:key] ||= 'IP'
|
13
|
+
end
|
14
|
+
|
15
|
+
# Lookup a passage
|
16
|
+
#
|
17
|
+
# See http://www.esvapi.org/api for more information and options
|
18
|
+
def passage_query(passage, options={})
|
19
|
+
options[:passage] = passage
|
20
|
+
self.class.get '/passageQuery', :query => @default_options.merge(options)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Look up a passage or show word-search results, depending on the query
|
24
|
+
#
|
25
|
+
# The output format is always HTML.
|
26
|
+
#
|
27
|
+
# See http://www.esvapi.org/api for more information and options
|
28
|
+
def query(q, options={})
|
29
|
+
options[:q] = q
|
30
|
+
self.class.get '/query', :query => @default_options.merge(options)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Parse and display information about your query, including identify whether it is a passage reference or a word search
|
34
|
+
#
|
35
|
+
# See http://www.esvapi.org/api for more information and options
|
36
|
+
def query_info(q)
|
37
|
+
options = {:q => q}
|
38
|
+
self.class.get '/queryInfo', :query => @default_options.merge(options)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Display a random verse from a preselected list, or specify verse(s)
|
42
|
+
#
|
43
|
+
# See http://www.esvapi.org/api for more information and options
|
44
|
+
def verse(options={})
|
45
|
+
self.class.get '/verse', :query => @default_options.merge(options)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Display a verse that changes every day
|
49
|
+
#
|
50
|
+
# See http://www.esvapi.org/api for more information and options
|
51
|
+
def daily_verse(options={})
|
52
|
+
self.class.get '/dailyVerse', :query => @default_options.merge(options)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
|
3
|
+
module ESV
|
4
|
+
class ReadingPlan
|
5
|
+
include HTTParty
|
6
|
+
|
7
|
+
base_uri 'http://www.esvapi.org/v2/rest/'
|
8
|
+
|
9
|
+
# The ESV API requires a key that can be passed in as one of the options, :key => 'value'. By default, it is 'IP'
|
10
|
+
def initialize(default_options={})
|
11
|
+
@default_options = default_options
|
12
|
+
@default_options[:key] ||= 'IP'
|
13
|
+
end
|
14
|
+
|
15
|
+
# Retrieve passages from our Devotions section
|
16
|
+
#
|
17
|
+
# See http://www.esvapi.org/api for more information and options
|
18
|
+
def query(options={})
|
19
|
+
self.class.get '/readingPlanQuery', :query => @default_options.merge(options)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Parse and display information about the reading plan for a given date
|
23
|
+
#
|
24
|
+
# See http://www.esvapi.org/api for more information and options
|
25
|
+
def info(options={})
|
26
|
+
self.class.get '/readingPlanInfo', :query => @default_options.merge(options)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe ESV::Bible do
|
4
|
+
before do
|
5
|
+
@bible = ESV::Bible.new(:key => 'TEST')
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "passage_query" do
|
9
|
+
it "should retrieve the passage" do
|
10
|
+
stub_get("http://www.esvapi.org/v2/rest/passageQuery?passage=John%201&key=TEST", "passage_query.html")
|
11
|
+
@bible.passage_query('John 1').should include("<h2>John 1")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should retrieve the passage as XML" do
|
15
|
+
stub_get("http://www.esvapi.org/v2/rest/passageQuery?output-format=crossway-xml-1.0&key=TEST&passage=John%201", "passage_query.xml")
|
16
|
+
passage = @bible.passage_query('John 1', 'output-format' => 'crossway-xml-1.0')['crossway_bible']["passage"]
|
17
|
+
passage["reference"].should == "John 1"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "query" do
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "query_info" do
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "verse" do
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "daily_verse" do
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe ESV::ReadingPlan do
|
4
|
+
before do
|
5
|
+
@plan = ESV::ReadingPlan.new(:key => 'TEST')
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "query" do
|
9
|
+
it "should retrieve the daily reading" do
|
10
|
+
stub_get("http://www.esvapi.org/v2/rest/readingPlanQuery?key=TEST", "reading_plan_query.html")
|
11
|
+
@plan.query.should include("<h2>2 Samuel 2")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should retrieve the daily reading as XML" do
|
15
|
+
stub_get("http://www.esvapi.org/v2/rest/readingPlanQuery?output-format=crossway-xml-1.0&key=TEST", "reading_plan_query.xml")
|
16
|
+
reading = @plan.query('output-format' => 'crossway-xml-1.0')["crossway_bible"]
|
17
|
+
reading["passage"][0]["reference"].should == "2 Samuel 2"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should retrieve the daily reading for a specific date" do
|
21
|
+
stub_get("http://www.esvapi.org/v2/rest/readingPlanQuery?date=2009-10-01&key=TEST", "reading_plan_query.html")
|
22
|
+
@plan.query('date' => '2009-10-01').should include("<h2>2 Samuel 2")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "info" do
|
27
|
+
it "should retrieve XML info for reading plan" do
|
28
|
+
stub_get("http://www.esvapi.org/v2/rest/readingPlanInfo?key=TEST", "reading_plan_info.xml")
|
29
|
+
info = @plan.info['crossway_bible']
|
30
|
+
info["plan"].should == "one-year-tract"
|
31
|
+
info["date"].should == "20090908"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|