google-book 0.3.2 → 0.3.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/README.md CHANGED
@@ -6,6 +6,8 @@ Google Book is a Ruby wrapper to the [Google Book Search Data API](http://code.g
6
6
  Usage
7
7
  -----
8
8
 
9
+ require 'google/book'
10
+
9
11
  entries = Google::Book.search('deleuze')
10
12
  entry = entries.first
11
13
 
@@ -39,16 +39,20 @@ module Google
39
39
  end
40
40
 
41
41
  def publisher
42
- @hash['dc:publisher'].
43
- gsub(/[ ,]+Inc.?$/, '').
44
- gsub(/[ ,]+Llc.?$/i, '').
45
- gsub(/[ ,]+Ltd.?$/, '').
46
- gsub(/Intl( |$)/) { "International#{$1}" }.
47
- gsub(/Pr( |$)/) { "Press#{$1}" }.
48
- gsub(/ Pub$/, ' Publishers').
49
- gsub(/ Pubns$/, ' Publications').
50
- gsub('Pub Group', 'Publishing Group').
51
- gsub(/Univ( |$)/) { "University#{$1}" }
42
+ publisher = @hash['dc:publisher']
43
+
44
+ if publisher
45
+ publisher.
46
+ gsub(/[ ,]+Inc.?$/, '').
47
+ gsub(/[ ,]+Llc.?$/i, '').
48
+ gsub(/[ ,]+Ltd.?$/, '').
49
+ gsub(/Intl( |$)/) { "International#{$1}" }.
50
+ gsub(/Pr( |$)/) { "Press#{$1}" }.
51
+ gsub(/ Pub$/, ' Publishers').
52
+ gsub(/ Pubns$/, ' Publications').
53
+ gsub('Pub Group', 'Publishing Group').
54
+ gsub(/Univ( |$)/) { "University#{$1}" }
55
+ end
52
56
  end
53
57
 
54
58
  def subjects
@@ -1,5 +1,5 @@
1
1
  module Google
2
2
  module Book
3
- VERSION = '0.3.2'
3
+ VERSION = '0.3.3'
4
4
  end
5
5
  end
@@ -148,6 +148,10 @@ module Google
148
148
 
149
149
  entry.publisher.should eql 'Publisher University'
150
150
  end
151
+
152
+ it "should return nil if there is no publisher" do
153
+ entry.publisher.should be_nil
154
+ end
151
155
  end
152
156
 
153
157
  describe "#title" do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: google-book
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.2
5
+ version: 0.3.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Paper Cavalier