gogoodreads 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
data/gogoodreads.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gogoodreads}
8
- s.version = "0.0.6"
8
+ s.version = "0.0.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tim Medina"]
@@ -44,11 +44,12 @@ Gem::Specification.new do |s|
44
44
  "lib/go_goodreads/user_status.rb",
45
45
  "lib/gogoodreads.rb",
46
46
  "test/attribute_test.rb",
47
- "test/bad_api_key_test.rb",
48
47
  "test/book_test.rb",
49
48
  "test/config_test.rb",
49
+ "test/exceptions_test.rb",
50
50
  "test/fixtures/vcr_cassettes/book_by_isbn.yml",
51
51
  "test/fixtures/vcr_cassettes/book_by_isbn_bad_api_key.yml",
52
+ "test/fixtures/vcr_cassettes/book_by_isbn_not_found.yml",
52
53
  "test/test_helper.rb"
53
54
  ]
54
55
  s.homepage = %q{http://github.com/iamteem/gogoodreads}
@@ -58,9 +59,9 @@ Gem::Specification.new do |s|
58
59
  s.summary = %q{Goodreads API Ruby Interface}
59
60
  s.test_files = [
60
61
  "test/attribute_test.rb",
61
- "test/bad_api_key_test.rb",
62
62
  "test/book_test.rb",
63
63
  "test/config_test.rb",
64
+ "test/exceptions_test.rb",
64
65
  "test/test_helper.rb"
65
66
  ]
66
67
 
@@ -39,6 +39,13 @@ module GoGoodreads
39
39
  book.current_page = params[:page] || 1
40
40
  book
41
41
  end
42
+
43
+ rescue ::RestClient::Exception => ex
44
+ if ex.http_code == 404
45
+ return nil
46
+ else
47
+ raise
48
+ end
42
49
  end
43
50
 
44
51
  def self.initialize_with_node(xml)
data/test/book_test.rb CHANGED
@@ -30,4 +30,11 @@ class BookTest < Test::Unit::TestCase
30
30
  assert_nil book.publication_date
31
31
  end
32
32
  end
33
+
34
+ def test_show_by_isbn_nil_on_not_found
35
+ VCR.use_cassette('book_by_isbn_not_found') do
36
+ book = GoGoodreads::Book.show_by_isbn("9780935998603")
37
+ assert_nil book
38
+ end
39
+ end
33
40
  end
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
- class BadApiKeyTest < Test::Unit::TestCase
4
- def test_raise_exception
3
+ class ExceptionsTest < Test::Unit::TestCase
4
+ def test_raise_exception_bad_api_key
5
5
  GoGoodreads.configure do |config|
6
6
  config.api_key = "1IlntIwcUm5CpTbQhu7Zf"
7
7
  end
@@ -0,0 +1,36 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: http://www.goodreads.com:80/book/isbn?isbn=9780935998603&key=1IlntIwcUm5CpTbQhu7Zg
6
+ body:
7
+ headers:
8
+ accept:
9
+ - "*/*; q=0.5, application/xml"
10
+ accept-encoding:
11
+ - gzip, deflate
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
+ code: 404
15
+ message: Not Found
16
+ headers:
17
+ content-type:
18
+ - application/xml; charset=utf-8
19
+ status:
20
+ - "404"
21
+ x-powered-by:
22
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.0
23
+ x-runtime:
24
+ - "13"
25
+ content-length:
26
+ - "30"
27
+ set-cookie:
28
+ - _session_id=e6abd26c8dd41149ff33398f8a37f260; domain=.goodreads.com; path=/; HttpOnly
29
+ cache-control:
30
+ - no-cache
31
+ server:
32
+ - nginx/0.8.52 + Phusion Passenger 3.0.0 (mod_rails/mod_rack)
33
+ body: |
34
+ <error>book not found</error>
35
+
36
+ http_version: "1.1"
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gogoodreads
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.6
5
+ version: 0.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tim Medina
@@ -160,11 +160,12 @@ files:
160
160
  - lib/go_goodreads/user_status.rb
161
161
  - lib/gogoodreads.rb
162
162
  - test/attribute_test.rb
163
- - test/bad_api_key_test.rb
164
163
  - test/book_test.rb
165
164
  - test/config_test.rb
165
+ - test/exceptions_test.rb
166
166
  - test/fixtures/vcr_cassettes/book_by_isbn.yml
167
167
  - test/fixtures/vcr_cassettes/book_by_isbn_bad_api_key.yml
168
+ - test/fixtures/vcr_cassettes/book_by_isbn_not_found.yml
168
169
  - test/test_helper.rb
169
170
  has_rdoc: true
170
171
  homepage: http://github.com/iamteem/gogoodreads
@@ -180,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
180
181
  requirements:
181
182
  - - ">="
182
183
  - !ruby/object:Gem::Version
183
- hash: -1480672835965473733
184
+ hash: -2022826134956577794
184
185
  segments:
185
186
  - 0
186
187
  version: "0"
@@ -199,7 +200,7 @@ specification_version: 3
199
200
  summary: Goodreads API Ruby Interface
200
201
  test_files:
201
202
  - test/attribute_test.rb
202
- - test/bad_api_key_test.rb
203
203
  - test/book_test.rb
204
204
  - test/config_test.rb
205
+ - test/exceptions_test.rb
205
206
  - test/test_helper.rb