google_books 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -3,4 +3,5 @@ pkg/*
3
3
  .bundle
4
4
  spec/fixtures/cassette_library/*.yml
5
5
  .idea/*
6
- .DS_Store
6
+ .DS_Store
7
+ .rbx
data/CHANGELOG.md CHANGED
@@ -37,3 +37,10 @@ v0.2.0
37
37
  * Standardized publisher names in a similar fashion to the [google-book gem](https://rubygems.org/gems/google-book)
38
38
  * Bug Fixes
39
39
  * The publishedDate field in the Google Books API are strings in the format of YYYY-MM-DD. Sometimes it's just YYYY and other times it's YYYY-MM. Previously the `published_date` attribute was a Date type, now it is a string and you can convert the date however you want in your applications.
40
+ v0.2.1
41
+ ------
42
+ * Bug Fixes
43
+ * Removed call to blank? in the `normalize_publisher` method of the Book class
44
+ * Other
45
+ * Added specific versions for required gems
46
+ * Fixed VCR cassette problem between Ruby 1.8.7 and 1.9.2 (Run the tests using 1.8.7 first and then 1.9.2 to reuse the same cassette)
data/Gemfile.lock CHANGED
@@ -2,27 +2,31 @@ PATH
2
2
  remote: .
3
3
  specs:
4
4
  google_books (0.2.0)
5
- hashie
6
- httparty
5
+ hashie (~> 1.1.0)
6
+ httparty (~> 0.8.1)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- ZenTest (4.6.0)
11
+ ZenTest (4.6.2)
12
12
  addressable (2.2.6)
13
13
  archive-tar-minitar (0.5.2)
14
14
  autotest (4.4.6)
15
15
  ZenTest (>= 4.4.1)
16
16
  columnize (0.3.4)
17
- crack (0.1.8)
18
- diff-lcs (1.1.2)
17
+ crack (0.3.1)
18
+ diff-lcs (1.1.3)
19
19
  hashie (1.1.0)
20
- httparty (0.7.8)
21
- crack (= 0.1.8)
20
+ httparty (0.8.1)
21
+ multi_json
22
+ multi_xml
22
23
  linecache (0.46)
23
24
  rbx-require-relative (> 0.0.4)
24
25
  linecache19 (0.5.12)
25
26
  ruby_core_source (>= 0.1.4)
27
+ multi_json (1.0.3)
28
+ multi_xml (0.4.1)
29
+ rake (0.8.7)
26
30
  rbx-require-relative (0.0.5)
27
31
  rspec (2.6.0)
28
32
  rspec-core (~> 2.6.0)
@@ -47,8 +51,8 @@ GEM
47
51
  ruby-debug-base19 (>= 0.11.19)
48
52
  ruby_core_source (0.1.5)
49
53
  archive-tar-minitar (>= 0.5.2)
50
- vcr (1.10.3)
51
- webmock (1.6.4)
54
+ vcr (1.11.3)
55
+ webmock (1.7.6)
52
56
  addressable (~> 2.2, > 2.2.5)
53
57
  crack (>= 0.1.7)
54
58
 
@@ -56,10 +60,11 @@ PLATFORMS
56
60
  ruby
57
61
 
58
62
  DEPENDENCIES
59
- autotest
63
+ autotest (~> 4.4.6)
60
64
  google_books!
61
- rspec
65
+ rake (~> 0.8.7)
66
+ rspec (~> 2.6.0)
62
67
  ruby-debug
63
68
  ruby-debug19
64
- vcr
65
- webmock
69
+ vcr (~> 1.11.3)
70
+ webmock (~> 1.7.6)
data/google_books.gemspec CHANGED
@@ -12,13 +12,14 @@ Gem::Specification.new do |s|
12
12
  s.summary = %q{A Ruby wrapper around the Google Books API}
13
13
  s.description = %q{A Ruby wrapper that allows you to query the Google Books API. This project was inspired by google-book, see the README for more information}
14
14
 
15
- s.add_dependency('httparty')
16
- s.add_dependency('hashie')
15
+ s.add_dependency('httparty', '~> 0.8.1')
16
+ s.add_dependency('hashie', '~> 1.1.0')
17
17
 
18
- s.add_development_dependency('autotest')
19
- s.add_development_dependency('rspec')
20
- s.add_development_dependency('webmock')
21
- s.add_development_dependency('vcr')
18
+ s.add_development_dependency('rake', '~> 0.8.7')
19
+ s.add_development_dependency('autotest', '~> 4.4.6')
20
+ s.add_development_dependency('rspec', '~> 2.6.0')
21
+ s.add_development_dependency('webmock', '~> 1.7.6')
22
+ s.add_development_dependency('vcr', '~> 1.11.3')
22
23
 
23
24
  s.files = `git ls-files`.split("\n")
24
25
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -40,7 +40,7 @@ module GoogleBooks
40
40
  end
41
41
 
42
42
  def normalize_publisher(name)
43
- return name if name.blank?
43
+ return name if (name.nil? || name.empty?)
44
44
 
45
45
  name.
46
46
  gsub(/[ ,]+Inc.?$/i, ' Inc.').
@@ -1,3 +1,3 @@
1
1
  module GoogleBooks
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  module GoogleBooks
4
4
  module API
@@ -89,6 +89,12 @@ module GoogleBooks
89
89
  book = Book.new(item)
90
90
  book.publisher.should eq "Publisher University Press"
91
91
  end
92
+
93
+ it "should handle strings with apostrophes" do
94
+ item['volumeInfo']['publisher'] = "O'Reilly Media, Inc."
95
+ book = Book.new(item)
96
+ book.publisher.should eq "O'Reilly Media Inc."
97
+ end
92
98
  end
93
99
 
94
100
  describe "published_date" do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  module GoogleBooks
4
4
  module API
@@ -15,6 +15,11 @@ module GoogleBooks
15
15
  response.first.should be_a Book
16
16
  end
17
17
 
18
+ it "should correctly parse O'Reilly Media Inc" do
19
+ response = API.search('Douglas Crockford')
20
+ book = response.first
21
+ book.publisher.should eq "O'Reilly Media Inc."
22
+ end
18
23
  end
19
24
  end
20
25
  end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  module GoogleBooks
4
4
  describe API do
@@ -27,7 +27,10 @@ module GoogleBooks
27
27
 
28
28
  it "should join parameters" do
29
29
  API.search('damien white', :count => 20, :page => 2)
30
- API.send(:query).should include 'startIndex=2&maxResults=20'
30
+ API.send(:query).should include 'startIndex=2'
31
+ API.send(:query).should include 'maxResults=20'
32
+ API.send(:query).should include 'q=damien+white'
33
+ API.send(:query).count('&').should eq 2
31
34
  end
32
35
 
33
36
  it "should return the proper number results based on the count passed in" do
data/spec/support/vcr.rb CHANGED
@@ -1,7 +1,11 @@
1
1
  require 'vcr'
2
+ require 'yaml'
3
+ YAML::ENGINE.yamler = 'syck' if defined?(YAML::ENGINE)
4
+
5
+ cassette_dir = File.dirname(__FILE__) + '/../fixtures/cassette_library'
2
6
 
3
7
  VCR.config do |c|
4
- c.cassette_library_dir = File.dirname(__FILE__) + '/../fixtures/cassette_library'
8
+ c.cassette_library_dir = cassette_dir
5
9
  c.default_cassette_options = { :record => :new_episodes }
6
10
  c.stub_with :webmock
7
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_books
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,74 +9,85 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-29 00:00:00.000000000Z
12
+ date: 2011-10-18 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
16
- requirement: &70187585301000 !ruby/object:Gem::Requirement
16
+ requirement: &70335070032720 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 0.8.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70187585301000
24
+ version_requirements: *70335070032720
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: hashie
27
- requirement: &70187585300580 !ruby/object:Gem::Requirement
27
+ requirement: &70335070032220 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
- - - ! '>='
30
+ - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: '0'
32
+ version: 1.1.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70187585300580
35
+ version_requirements: *70335070032220
36
+ - !ruby/object:Gem::Dependency
37
+ name: rake
38
+ requirement: &70335070031760 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 0.8.7
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70335070031760
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: autotest
38
- requirement: &70187585300160 !ruby/object:Gem::Requirement
49
+ requirement: &70335070031300 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
- - - ! '>='
52
+ - - ~>
42
53
  - !ruby/object:Gem::Version
43
- version: '0'
54
+ version: 4.4.6
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *70187585300160
57
+ version_requirements: *70335070031300
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: rspec
49
- requirement: &70187585299740 !ruby/object:Gem::Requirement
60
+ requirement: &70335070030840 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
- - - ! '>='
63
+ - - ~>
53
64
  - !ruby/object:Gem::Version
54
- version: '0'
65
+ version: 2.6.0
55
66
  type: :development
56
67
  prerelease: false
57
- version_requirements: *70187585299740
68
+ version_requirements: *70335070030840
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: webmock
60
- requirement: &70187585299320 !ruby/object:Gem::Requirement
71
+ requirement: &70335070030380 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
- - - ! '>='
74
+ - - ~>
64
75
  - !ruby/object:Gem::Version
65
- version: '0'
76
+ version: 1.7.6
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *70187585299320
79
+ version_requirements: *70335070030380
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: vcr
71
- requirement: &70187585298900 !ruby/object:Gem::Requirement
82
+ requirement: &70335070029920 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
- - - ! '>='
85
+ - - ~>
75
86
  - !ruby/object:Gem::Version
76
- version: '0'
87
+ version: 1.11.3
77
88
  type: :development
78
89
  prerelease: false
79
- version_requirements: *70187585298900
90
+ version_requirements: *70335070029920
80
91
  description: A Ruby wrapper that allows you to query the Google Books API. This project
81
92
  was inspired by google-book, see the README for more information
82
93
  email: