isbndb 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c2a691f9b65c589234a60140904dd8c5b176a634
4
+ data.tar.gz: 1e205fc7452beedcf928559709bacbeb38d78c34
5
+ SHA512:
6
+ metadata.gz: 9584cceebbca389b7a1ad8db8550cc027a8f0a9a497799029f5550aece9fe3118dc4592766f29c2afed3b8ad48273ecc9b1c4c3385e4d53e27bd26ec3a5c5c8d
7
+ data.tar.gz: b4c45b259ca96c76d141406de8d99f4041b46f2b5cf5301f9cfa63dbc0380ad388de2d5b98a5ee6fa3bda5cac7ced827da393a983c4248aae634fbbbf9fd19a3
data/.gitignore CHANGED
@@ -15,5 +15,11 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ bin/
18
19
 
19
20
  config/isbndb.yml
21
+ *~
22
+
23
+ .rvmrc
24
+ .rspec
25
+ .ruby-version
@@ -1,6 +1,3 @@
1
- language: ruby
2
1
  rvm:
3
- - 1.9.2
4
2
  - 1.9.3
5
- before_script: "cp config/isbndb.example.yml config/isbndb.yml"
6
- script: "bundle exec rake test:ci --trace"
3
+ - 2.0.0
data/Gemfile CHANGED
@@ -1,3 +1,2 @@
1
- source :rubygems
2
-
1
+ source 'https://rubygems.org'
3
2
  gemspec
File without changes
data/Rakefile CHANGED
@@ -3,7 +3,8 @@ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- namespace :test do
7
- desc 'Run tests against the CI'
8
- task :ci => [:spec]
6
+ task :setup do
7
+ FileUtils.cp('config/isbndb.example.yml', 'config/isbndb.yml')
9
8
  end
9
+
10
+ task default: [:setup, :spec]
@@ -1,9 +1,9 @@
1
1
  # encoding: utf-8
2
- $:.push File.expand_path("../lib", __FILE__)
2
+ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'isbndb'
6
- s.version = '2.0.1'
6
+ s.version = '2.0.2'
7
7
  s.author = 'Seth Vargo'
8
8
  s.email = 'sethvargo@gmail.com'
9
9
  s.homepage = 'https://github.com/sethvargo/isbndb'
@@ -15,11 +15,11 @@ Gem::Specification.new do |s|
15
15
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
16
  s.require_paths = ["lib"]
17
17
 
18
- s.add_development_dependency 'rspec', '~> 2.10.0'
19
- s.add_development_dependency 'shoulda', '~> 3.0.1'
20
- s.add_development_dependency 'simplecov', '~> 0.6.4'
21
- s.add_development_dependency 'webmock', '~> 1.8.7'
18
+ # Runtime dependencies
19
+ s.add_runtime_dependency 'httparty', '~> 0.12'
20
+ s.add_runtime_dependency 'rake'
22
21
 
23
- s.add_runtime_dependency 'httparty', '~> 0.8.3'
24
- s.add_runtime_dependency 'rake', '~> 0.9.2.2'
22
+ # Development dependencies
23
+ s.add_development_dependency 'rspec', '~> 2.14'
24
+ s.add_development_dependency 'webmock', '~> 1.15'
25
25
  end
@@ -31,12 +31,17 @@ module ISBNdb
31
31
  end
32
32
 
33
33
  # Because ResultSet extends Enumerable, we need to define the each method. This allows users
34
- # to call methods like .first, .last, [5], and .each on the ResultSet, making it behave like
34
+ # to call methods like .first, .last, and .each on the ResultSet, making it behave like
35
35
  # a primitive array.
36
36
  def each(&block)
37
37
  @results.each &block
38
38
  end
39
39
 
40
+ # Access via index
41
+ def [](i)
42
+ @results[i]
43
+ end
44
+
40
45
  # Jump to a specific page. This method will return nil if the specified page does not exist.
41
46
  def go_to_page(page)
42
47
  get_total_pages unless @total_pages
@@ -75,7 +80,12 @@ module ISBNdb
75
80
  # each child. This method works because the API always returns #{@collection}List followed by a subset
76
81
  # of #{@collection}Data. These results are all pushed into the @results array for accessing.
77
82
  def build_results
78
- @results = (@parsed_response["#{@collection}List"]["#{@collection}Data"] || []).collect{ |json| Result.new(json) }
83
+ result_json = @parsed_response["#{@collection}List"]["#{@collection}Data"]
84
+ if result_json.is_a?(Hash) ## One result, typically from find_by_isbn
85
+ @results = [Result.new(result_json)]
86
+ else
87
+ @results = (result_json || []).collect{ |json| Result.new(json) }
88
+ end
79
89
  end
80
90
 
81
91
  # This helper method is mainly designed for use with the go_to_page(page) method. It parses the XML
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <ISBNdb server_time="2012-06-16T20:10:13Z">
4
+ <BookList total_results="1664" page_size="10" page_number="1" shown_results="1">
5
+ <BookData book_id="100th_day_of_school_a04" isbn="1590543947" isbn13="9781590543948">
6
+ <Title>100th Day of School</Title>
7
+ <TitleLong>100th Day of School (Hello Reader Level 2)</TitleLong>
8
+ <AuthorsText>Angela Shelf Medearis, </AuthorsText>
9
+ <PublisherText publisher_id="fitzgerald_books">Fitzgerald Books</PublisherText>
10
+ <Details change_time="2011-03-08T18:28:45Z" price_time="2012-05-29T16:45:46Z" edition_info="Unknown Binding; 2007-01" language="" physical_description_text="6.0&quot;x9.0&quot;x0.5&quot;; 0.4 lb; 32 pages" lcc_number="" dewey_decimal_normalized="" dewey_decimal="" />
11
+ </BookData>
12
+ </BookList>
13
+ </ISBNdb>
@@ -1,8 +1,4 @@
1
- require 'simplecov'
2
- SimpleCov.start
3
-
4
1
  require 'rspec'
5
- require 'shoulda'
6
2
  require 'webmock/rspec'
7
3
 
8
4
  Dir[File.expand_path('spec/support/**/*.rb')].each { |f| require f }
@@ -1,23 +1,21 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ISBNdb::ResultSet do
4
- before do
5
- stub_request(:get, /http:\/\/isbndb\.com\/api\/books\.xml\?access_key=ABC123&index1=title(&page_number=(.+))?&results=details&value1=hello/).to_return(:body => File.new('spec/responses/books_hello.xml'), :headers => {'Content-Type'=>'text/xml'})
6
- @result_set = ISBNdb::ResultSet.new('/books.xml?access_key=ABC123&index1=title&results=details&value1=hello', :books)
7
- end
3
+ # These examples are used to test multiple books returned and a single book return
4
+ # Actual specs at the bottom of this file
8
5
 
6
+ shared_examples "AProperResultSet" do
9
7
  context 'initialize' do
10
8
  it 'should set all the instance variables' do
11
9
  @result_set.instance_variable_get('@uri').should == '/books.xml?access_key=ABC123&index1=title&results=details&value1=hello'
12
10
  @result_set.instance_variable_get('@collection').should == 'Book'
13
11
  @result_set.instance_variable_get('@current_page').should == 1
14
- @result_set.instance_variable_get('@parsed_response').should == {"server_time"=>"2012-06-16T20:10:13Z", "BookList"=>{"total_results"=>"1664", "page_size"=>"10", "page_number"=>"1", "shown_results"=>"10", "BookData"=>[{"book_id"=>"100th_day_of_school_a04", "isbn"=>"1590543947", "isbn13"=>"9781590543948", "Title"=>"100th Day of School", "TitleLong"=>"100th Day of School (Hello Reader Level 2)", "AuthorsText"=>"Angela Shelf Medearis, ", "PublisherText"=>{"publisher_id"=>"fitzgerald_books", "__content__"=>"Fitzgerald Books"}, "Details"=>{"change_time"=>"2011-03-08T18:28:45Z", "price_time"=>"2012-05-29T16:45:46Z", "edition_info"=>"Unknown Binding; 2007-01", "language"=>"", "physical_description_text"=>"6.0\"x9.0\"x0.5\"; 0.4 lb; 32 pages", "lcc_number"=>"", "dewey_decimal_normalized"=>"", "dewey_decimal"=>""}}, {"book_id"=>"100th_day_the", "isbn"=>"0439330173", "isbn13"=>"9780439330176", "Title"=>"100th Day, The", "TitleLong"=>"100th Day, The (level 1) (Hello Reader Level 1)", "AuthorsText"=>"Alayne Pick, Grace Maccarone, Laura Freeman (Illustrator)", "PublisherText"=>{"publisher_id"=>"cartwheel", "__content__"=>"Cartwheel"}, "Details"=>{"change_time"=>"2006-02-27T21:34:15Z", "price_time"=>"2012-05-29T16:46:08Z", "edition_info"=>"Paperback; 2002-12-01", "language"=>"", "physical_description_text"=>"32 pages", "lcc_number"=>"", "dewey_decimal_normalized"=>"", "dewey_decimal"=>""}}, {"book_id"=>"2011_hello_kitty_engagement_calendar", "isbn"=>"1423803558", "isbn13"=>"9781423803553", "Title"=>"2011 Hello Kitty Engagement Calendar", "TitleLong"=>nil, "AuthorsText"=>"Day Dream (Contributor)", "PublisherText"=>{"publisher_id"=>"day_dream", "__content__"=>"Day Dream"}, "Details"=>{"change_time"=>"2010-09-21T21:20:39Z", "price_time"=>"2012-03-24T04:44:44Z", "edition_info"=>"Calendar; 2010-08-01", "language"=>"", "physical_description_text"=>"7.0\"x8.5\"x0.9\"; 1.1 lb", "lcc_number"=>"", "dewey_decimal_normalized"=>"741", "dewey_decimal"=>"741"}}, {"book_id"=>"2011_hello_kitty_wall_calendar", "isbn"=>"1423803981", "isbn13"=>"9781423803980", "Title"=>"2011 Hello Kitty Wall Calendar", "TitleLong"=>nil, "AuthorsText"=>"Day Dream (Contributor)", "PublisherText"=>{"publisher_id"=>"day_dream", "__content__"=>"Day Dream"}, "Details"=>{"change_time"=>"2010-09-21T18:46:02Z", "price_time"=>"2012-04-25T20:26:40Z", "edition_info"=>"Calendar; 2010-08-01", "language"=>"", "physical_description_text"=>"10.8\"x11.8\"x0.2\"; 0.3 lb", "lcc_number"=>"", "dewey_decimal_normalized"=>"", "dewey_decimal"=>""}}, {"book_id"=>"2012_hello_kitty_2_year_pocket_planner_calendar", "isbn"=>"1423809424", "isbn13"=>"9781423809425", "Title"=>"2012 Hello Kitty 2 Year Pocket Planner Calendar", "TitleLong"=>nil, "AuthorsText"=>"Day Dream, ", "PublisherText"=>{"publisher_id"=>"day_dream", "__content__"=>"Day Dream"}, "Details"=>{"change_time"=>"2012-01-17T22:23:43Z", "price_time"=>"2012-03-04T05:32:03Z", "edition_info"=>"Calendar; 2011-07-01", "language"=>"", "physical_description_text"=>"3.5\"x6.2\"x0.0\"; 0.1 lb", "lcc_number"=>"", "dewey_decimal_normalized"=>"636", "dewey_decimal"=>"636"}}, {"book_id"=>"2012_hello_kitty_juvenile_activity_calendar", "isbn"=>"1423811194", "isbn13"=>"9781423811190", "Title"=>"2012 Hello Kitty Juvenile Activity Calendar", "TitleLong"=>nil, "AuthorsText"=>"Day Dream, ", "PublisherText"=>{"publisher_id"=>"day_dream", "__content__"=>"Day Dream"}, "Details"=>{"change_time"=>"2012-05-15T00:52:54Z", "price_time"=>"2012-06-16T20:10:13Z", "edition_info"=>"Calendar; 2011-07-01", "language"=>"", "physical_description_text"=>"11.0\"x12.0\"x0.3\"; 0.8 lb", "lcc_number"=>"", "dewey_decimal_normalized"=>"741", "dewey_decimal"=>"741"}}, {"book_id"=>"2012_hello_kitty_mini_calendar", "isbn"=>"1423809165", "isbn13"=>"9781423809166", "Title"=>"2012 Hello Kitty Mini Calendar", "TitleLong"=>nil, "AuthorsText"=>"Day Dream, ", "PublisherText"=>{"publisher_id"=>"day_dream", "__content__"=>"Day Dream"}, "Details"=>{"change_time"=>"2012-01-17T22:24:12Z", "price_time"=>"2012-02-09T06:11:01Z", "edition_info"=>"Calendar; 2011-07-01", "language"=>"", "physical_description_text"=>"6.2\"x6.9\"x0.2\"; 0.1 lb", "lcc_number"=>"", "dewey_decimal_normalized"=>"741", "dewey_decimal"=>"741"}}, {"book_id"=>"2012_hello_kitty_wall_calendar", "isbn"=>"1423809696", "isbn13"=>"9781423809692", "Title"=>"2012 Hello Kitty Wall Calendar", "TitleLong"=>nil, "AuthorsText"=>"Day Dream, ", "PublisherText"=>{"publisher_id"=>"day_dream", "__content__"=>"Day Dream"}, "Details"=>{"change_time"=>"2012-01-17T22:14:27Z", "price_time"=>"2012-02-09T06:02:14Z", "edition_info"=>"Calendar; 2011-07-01", "language"=>"", "physical_description_text"=>"10.6\"x11.8\"x0.2\"; 0.5 lb", "lcc_number"=>"", "dewey_decimal_normalized"=>"741", "dewey_decimal"=>"741"}}, {"book_id"=>"2012_hello_kitty_weekly_engagement_calendar", "isbn"=>"1423809092", "isbn13"=>"9781423809098", "Title"=>"2012 Hello Kitty Weekly Engagement Calendar", "TitleLong"=>nil, "AuthorsText"=>"Day Dream, ", "PublisherText"=>{"publisher_id"=>"day_dream", "__content__"=>"Day Dream"}, "Details"=>{"change_time"=>"2012-01-17T22:14:34Z", "price_time"=>"2012-02-08T12:37:05Z", "edition_info"=>"Calendar; 2011-07-01", "language"=>"", "physical_description_text"=>"7.2\"x8.5\"x0.9\"; 1.0 lb", "lcc_number"=>"", "dewey_decimal_normalized"=>"741", "dewey_decimal"=>"741"}}, {"book_id"=>"2_grrrls_hello_gorgeous", "isbn"=>"0439187370", "isbn13"=>"9780439187374", "Title"=>"Hello gorgeous", "TitleLong"=>"Hello gorgeous: a guide to style", "AuthorsText"=>"by Kristen Kemp", "PublisherText"=>{"publisher_id"=>"scholastic", "__content__"=>"New York : Scholastic, c2000."}, "Details"=>{"change_time"=>"2009-09-29T18:09:13Z", "price_time"=>"2011-03-25T22:20:05Z", "edition_info"=>"(pbk.) :$3.99", "language"=>"eng", "physical_description_text"=>"64 p. : ill. (some col.) ; 20 cm.", "lcc_number"=>"", "dewey_decimal_normalized"=>"", "dewey_decimal"=>""}}]}}
12
+ @result_set.instance_variable_get('@parsed_response').should == @expected_parsed_response
15
13
  end
16
14
  end
17
15
 
18
16
  context 'size' do
19
17
  it 'should return the size of @results' do
20
- @result_set.size.should == 10
18
+ @result_set.size.should == @expected_result_size
21
19
  end
22
20
  end
23
21
 
@@ -29,6 +27,12 @@ describe ISBNdb::ResultSet do
29
27
  end
30
28
  end
31
29
 
30
+ context '[]' do
31
+ it 'should return the first result' do
32
+ @result_set[0].should == @result_set.first
33
+ end
34
+ end
35
+
32
36
  context 'go_to_page' do
33
37
  it 'should get the total number of pages' do
34
38
  expect{ @result_set.go_to_page(1) }.to change { @result_set.instance_variable_get('@total_pages') }.to(167)
@@ -68,7 +72,7 @@ describe ISBNdb::ResultSet do
68
72
 
69
73
  context 'to_s' do
70
74
  it 'should return the correct string' do
71
- @result_set.to_s.should == '#<ResultSet::Book :total_results => 10>'
75
+ @result_set.to_s.should == '#<ResultSet::Book :total_results => ' + @expected_result_size.to_s + '>'
72
76
  end
73
77
  end
74
78
 
@@ -87,3 +91,27 @@ describe ISBNdb::ResultSet do
87
91
  end
88
92
  end
89
93
  end
94
+
95
+ describe "MultipleISBNdb::ResultSet" do
96
+ before do
97
+ stub_request(:get, /http:\/\/isbndb\.com\/api\/books\.xml\?access_key=ABC123&index1=title(&page_number=(.+))?&results=details&value1=hello/).to_return(:body => File.new('spec/responses/books_hello.xml'), :headers => {'Content-Type'=>'text/xml'})
98
+ @result_set = ISBNdb::ResultSet.new('/books.xml?access_key=ABC123&index1=title&results=details&value1=hello', :books)
99
+ @expected_result_size = 10
100
+ @expected_parsed_response = {"server_time"=>"2012-06-16T20:10:13Z", "BookList"=>{"total_results"=>"1664", "page_size"=>"10", "page_number"=>"1", "shown_results"=>"10", "BookData"=>[{"book_id"=>"100th_day_of_school_a04", "isbn"=>"1590543947", "isbn13"=>"9781590543948", "Title"=>"100th Day of School", "TitleLong"=>"100th Day of School (Hello Reader Level 2)", "AuthorsText"=>"Angela Shelf Medearis, ", "PublisherText"=>{"publisher_id"=>"fitzgerald_books", "__content__"=>"Fitzgerald Books"}, "Details"=>{"change_time"=>"2011-03-08T18:28:45Z", "price_time"=>"2012-05-29T16:45:46Z", "edition_info"=>"Unknown Binding; 2007-01", "language"=>"", "physical_description_text"=>"6.0\"x9.0\"x0.5\"; 0.4 lb; 32 pages", "lcc_number"=>"", "dewey_decimal_normalized"=>"", "dewey_decimal"=>""}}, {"book_id"=>"100th_day_the", "isbn"=>"0439330173", "isbn13"=>"9780439330176", "Title"=>"100th Day, The", "TitleLong"=>"100th Day, The (level 1) (Hello Reader Level 1)", "AuthorsText"=>"Alayne Pick, Grace Maccarone, Laura Freeman (Illustrator)", "PublisherText"=>{"publisher_id"=>"cartwheel", "__content__"=>"Cartwheel"}, "Details"=>{"change_time"=>"2006-02-27T21:34:15Z", "price_time"=>"2012-05-29T16:46:08Z", "edition_info"=>"Paperback; 2002-12-01", "language"=>"", "physical_description_text"=>"32 pages", "lcc_number"=>"", "dewey_decimal_normalized"=>"", "dewey_decimal"=>""}}, {"book_id"=>"2011_hello_kitty_engagement_calendar", "isbn"=>"1423803558", "isbn13"=>"9781423803553", "Title"=>"2011 Hello Kitty Engagement Calendar", "TitleLong"=>nil, "AuthorsText"=>"Day Dream (Contributor)", "PublisherText"=>{"publisher_id"=>"day_dream", "__content__"=>"Day Dream"}, "Details"=>{"change_time"=>"2010-09-21T21:20:39Z", "price_time"=>"2012-03-24T04:44:44Z", "edition_info"=>"Calendar; 2010-08-01", "language"=>"", "physical_description_text"=>"7.0\"x8.5\"x0.9\"; 1.1 lb", "lcc_number"=>"", "dewey_decimal_normalized"=>"741", "dewey_decimal"=>"741"}}, {"book_id"=>"2011_hello_kitty_wall_calendar", "isbn"=>"1423803981", "isbn13"=>"9781423803980", "Title"=>"2011 Hello Kitty Wall Calendar", "TitleLong"=>nil, "AuthorsText"=>"Day Dream (Contributor)", "PublisherText"=>{"publisher_id"=>"day_dream", "__content__"=>"Day Dream"}, "Details"=>{"change_time"=>"2010-09-21T18:46:02Z", "price_time"=>"2012-04-25T20:26:40Z", "edition_info"=>"Calendar; 2010-08-01", "language"=>"", "physical_description_text"=>"10.8\"x11.8\"x0.2\"; 0.3 lb", "lcc_number"=>"", "dewey_decimal_normalized"=>"", "dewey_decimal"=>""}}, {"book_id"=>"2012_hello_kitty_2_year_pocket_planner_calendar", "isbn"=>"1423809424", "isbn13"=>"9781423809425", "Title"=>"2012 Hello Kitty 2 Year Pocket Planner Calendar", "TitleLong"=>nil, "AuthorsText"=>"Day Dream, ", "PublisherText"=>{"publisher_id"=>"day_dream", "__content__"=>"Day Dream"}, "Details"=>{"change_time"=>"2012-01-17T22:23:43Z", "price_time"=>"2012-03-04T05:32:03Z", "edition_info"=>"Calendar; 2011-07-01", "language"=>"", "physical_description_text"=>"3.5\"x6.2\"x0.0\"; 0.1 lb", "lcc_number"=>"", "dewey_decimal_normalized"=>"636", "dewey_decimal"=>"636"}}, {"book_id"=>"2012_hello_kitty_juvenile_activity_calendar", "isbn"=>"1423811194", "isbn13"=>"9781423811190", "Title"=>"2012 Hello Kitty Juvenile Activity Calendar", "TitleLong"=>nil, "AuthorsText"=>"Day Dream, ", "PublisherText"=>{"publisher_id"=>"day_dream", "__content__"=>"Day Dream"}, "Details"=>{"change_time"=>"2012-05-15T00:52:54Z", "price_time"=>"2012-06-16T20:10:13Z", "edition_info"=>"Calendar; 2011-07-01", "language"=>"", "physical_description_text"=>"11.0\"x12.0\"x0.3\"; 0.8 lb", "lcc_number"=>"", "dewey_decimal_normalized"=>"741", "dewey_decimal"=>"741"}}, {"book_id"=>"2012_hello_kitty_mini_calendar", "isbn"=>"1423809165", "isbn13"=>"9781423809166", "Title"=>"2012 Hello Kitty Mini Calendar", "TitleLong"=>nil, "AuthorsText"=>"Day Dream, ", "PublisherText"=>{"publisher_id"=>"day_dream", "__content__"=>"Day Dream"}, "Details"=>{"change_time"=>"2012-01-17T22:24:12Z", "price_time"=>"2012-02-09T06:11:01Z", "edition_info"=>"Calendar; 2011-07-01", "language"=>"", "physical_description_text"=>"6.2\"x6.9\"x0.2\"; 0.1 lb", "lcc_number"=>"", "dewey_decimal_normalized"=>"741", "dewey_decimal"=>"741"}}, {"book_id"=>"2012_hello_kitty_wall_calendar", "isbn"=>"1423809696", "isbn13"=>"9781423809692", "Title"=>"2012 Hello Kitty Wall Calendar", "TitleLong"=>nil, "AuthorsText"=>"Day Dream, ", "PublisherText"=>{"publisher_id"=>"day_dream", "__content__"=>"Day Dream"}, "Details"=>{"change_time"=>"2012-01-17T22:14:27Z", "price_time"=>"2012-02-09T06:02:14Z", "edition_info"=>"Calendar; 2011-07-01", "language"=>"", "physical_description_text"=>"10.6\"x11.8\"x0.2\"; 0.5 lb", "lcc_number"=>"", "dewey_decimal_normalized"=>"741", "dewey_decimal"=>"741"}}, {"book_id"=>"2012_hello_kitty_weekly_engagement_calendar", "isbn"=>"1423809092", "isbn13"=>"9781423809098", "Title"=>"2012 Hello Kitty Weekly Engagement Calendar", "TitleLong"=>nil, "AuthorsText"=>"Day Dream, ", "PublisherText"=>{"publisher_id"=>"day_dream", "__content__"=>"Day Dream"}, "Details"=>{"change_time"=>"2012-01-17T22:14:34Z", "price_time"=>"2012-02-08T12:37:05Z", "edition_info"=>"Calendar; 2011-07-01", "language"=>"", "physical_description_text"=>"7.2\"x8.5\"x0.9\"; 1.0 lb", "lcc_number"=>"", "dewey_decimal_normalized"=>"741", "dewey_decimal"=>"741"}}, {"book_id"=>"2_grrrls_hello_gorgeous", "isbn"=>"0439187370", "isbn13"=>"9780439187374", "Title"=>"Hello gorgeous", "TitleLong"=>"Hello gorgeous: a guide to style", "AuthorsText"=>"by Kristen Kemp", "PublisherText"=>{"publisher_id"=>"scholastic", "__content__"=>"New York : Scholastic, c2000."}, "Details"=>{"change_time"=>"2009-09-29T18:09:13Z", "price_time"=>"2011-03-25T22:20:05Z", "edition_info"=>"(pbk.) :$3.99", "language"=>"eng", "physical_description_text"=>"64 p. : ill. (some col.) ; 20 cm.", "lcc_number"=>"", "dewey_decimal_normalized"=>"", "dewey_decimal"=>""}}]}}
101
+ end
102
+ it_behaves_like "AProperResultSet" do
103
+ end
104
+ end
105
+
106
+
107
+ describe "SingleISBNdb::ResultSet" do
108
+ before do
109
+ stub_request(:get, /http:\/\/isbndb\.com\/api\/books\.xml\?access_key=ABC123&index1=title(&page_number=(.+))?&results=details&value1=hello/).to_return(:body => File.new('spec/responses/single_book.xml'), :headers => {'Content-Type'=>'text/xml'})
110
+ @result_set = ISBNdb::ResultSet.new('/books.xml?access_key=ABC123&index1=title&results=details&value1=hello', :books)
111
+ @expected_parsed_response = {"server_time"=>"2012-06-16T20:10:13Z", "BookList"=>{"total_results"=>"1664", "page_size"=>"10", "page_number"=>"1", "shown_results"=>"1", "BookData"=>{"book_id"=>"100th_day_of_school_a04", "isbn"=>"1590543947", "isbn13"=>"9781590543948", "Title"=>"100th Day of School", "TitleLong"=>"100th Day of School (Hello Reader Level 2)", "AuthorsText"=>"Angela Shelf Medearis, ", "PublisherText"=>{"publisher_id"=>"fitzgerald_books", "__content__"=>"Fitzgerald Books"}, "Details"=>{"change_time"=>"2011-03-08T18:28:45Z", "price_time"=>"2012-05-29T16:45:46Z", "edition_info"=>"Unknown Binding; 2007-01", "language"=>"", "physical_description_text"=>"6.0\"x9.0\"x0.5\"; 0.4 lb; 32 pages", "lcc_number"=>"", "dewey_decimal_normalized"=>"", "dewey_decimal"=>""}}}}
112
+ @expected_result_size = 1
113
+ end
114
+ it_behaves_like "AProperResultSet" do
115
+ end
116
+ end
117
+
metadata CHANGED
@@ -1,112 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isbndb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
5
- prerelease:
4
+ version: 2.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Seth Vargo
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-07-06 00:00:00.000000000 Z
11
+ date: 2013-11-04 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: rspec
14
+ name: httparty
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 2.10.0
22
- type: :development
19
+ version: '0.12'
20
+ type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: 2.10.0
26
+ version: '0.12'
30
27
  - !ruby/object:Gem::Dependency
31
- name: shoulda
28
+ name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
- version: 3.0.1
38
- type: :development
33
+ version: '0'
34
+ type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
- version: 3.0.1
40
+ version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
- name: simplecov
42
+ name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
53
- version: 0.6.4
47
+ version: '2.14'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
61
- version: 0.6.4
54
+ version: '2.14'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: webmock
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
69
- version: 1.8.7
61
+ version: '1.15'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- version: 1.8.7
78
- - !ruby/object:Gem::Dependency
79
- name: httparty
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ~>
84
- - !ruby/object:Gem::Version
85
- version: 0.8.3
86
- type: :runtime
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ~>
92
- - !ruby/object:Gem::Version
93
- version: 0.8.3
94
- - !ruby/object:Gem::Dependency
95
- name: rake
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ~>
100
- - !ruby/object:Gem::Version
101
- version: 0.9.2.2
102
- type: :runtime
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
65
  requirements:
107
66
  - - ~>
108
67
  - !ruby/object:Gem::Version
109
- version: 0.9.2.2
68
+ version: '1.15'
110
69
  description: Ruby ISBNdb is a amazingly fast and accurate gem that reads ISBNdb.com's
111
70
  XML API and gives you incredible flexibilty with the results! The newest version
112
71
  of the gem also features caching, so developers minimize API-key usage.
@@ -116,12 +75,10 @@ extensions: []
116
75
  extra_rdoc_files: []
117
76
  files:
118
77
  - .gitignore
119
- - .rspec
120
- - .rvmrc
121
78
  - .travis.yml
122
79
  - Gemfile
123
80
  - Gemfile.lock
124
- - README.markdown
81
+ - README.md
125
82
  - Rakefile
126
83
  - config/isbndb.example.yml
127
84
  - isbndb.gemspec
@@ -140,6 +97,7 @@ files:
140
97
  - spec/responses/keystats.xml
141
98
  - spec/responses/publishers_francis.xml
142
99
  - spec/responses/search.xml
100
+ - spec/responses/single_book.xml
143
101
  - spec/responses/subjects_ruby.xml
144
102
  - spec/spec_helper.rb
145
103
  - spec/support/helpers.rb
@@ -151,33 +109,26 @@ files:
151
109
  - spec/units/string_spec.rb
152
110
  homepage: https://github.com/sethvargo/isbndb
153
111
  licenses: []
112
+ metadata: {}
154
113
  post_install_message:
155
114
  rdoc_options: []
156
115
  require_paths:
157
116
  - lib
158
117
  required_ruby_version: !ruby/object:Gem::Requirement
159
- none: false
160
118
  requirements:
161
- - - ! '>='
119
+ - - '>='
162
120
  - !ruby/object:Gem::Version
163
121
  version: '0'
164
- segments:
165
- - 0
166
- hash: -3629372956676132832
167
122
  required_rubygems_version: !ruby/object:Gem::Requirement
168
- none: false
169
123
  requirements:
170
- - - ! '>='
124
+ - - '>='
171
125
  - !ruby/object:Gem::Version
172
126
  version: '0'
173
- segments:
174
- - 0
175
- hash: -3629372956676132832
176
127
  requirements: []
177
128
  rubyforge_project:
178
- rubygems_version: 1.8.24
129
+ rubygems_version: 2.0.3
179
130
  signing_key:
180
- specification_version: 3
131
+ specification_version: 4
181
132
  summary: Connect with ISBNdb.com's API
182
133
  test_files:
183
134
  - spec/responses/access_key_error.xml
@@ -187,6 +138,7 @@ test_files:
187
138
  - spec/responses/keystats.xml
188
139
  - spec/responses/publishers_francis.xml
189
140
  - spec/responses/search.xml
141
+ - spec/responses/single_book.xml
190
142
  - spec/responses/subjects_ruby.xml
191
143
  - spec/spec_helper.rb
192
144
  - spec/support/helpers.rb
@@ -196,3 +148,4 @@ test_files:
196
148
  - spec/units/result_set_spec.rb
197
149
  - spec/units/result_spec.rb
198
150
  - spec/units/string_spec.rb
151
+ has_rdoc:
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color
data/.rvmrc DELETED
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
- # development environment upon cd'ing into the directory
5
-
6
- # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
- # Only full ruby name is supported here, for short names use:
8
- # echo "rvm use 1.9.3" > .rvmrc
9
- environment_id="ruby-1.9.3-p194@isbndb"
10
-
11
- # Uncomment the following lines if you want to verify rvm version per project
12
- # rvmrc_rvm_version="1.13.6 (master)" # 1.10.1 seams as a safe start
13
- # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
- # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
- # return 1
16
- # }
17
-
18
- # First we attempt to load the desired environment directly from the environment
19
- # file. This is very fast and efficient compared to running through the entire
20
- # CLI and selector. If you want feedback on which environment was used then
21
- # insert the word 'use' after --create as this triggers verbose mode.
22
- if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
- && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
- then
25
- \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
- [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
- \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
- else
29
- # If the environment file has not yet been created, use the RVM CLI to select.
30
- rvm --create "$environment_id" || {
31
- echo "Failed to create RVM environment '${environment_id}'."
32
- return 1
33
- }
34
- fi
35
-
36
- # If you use bundler, this might be useful to you:
37
- # if [[ -s Gemfile ]] && {
38
- # ! builtin command -v bundle >/dev/null ||
39
- # builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
40
- # }
41
- # then
42
- # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
43
- # gem install bundler
44
- # fi
45
- # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
46
- # then
47
- # bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
48
- # fi