google-book 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm --create use 1.9.2@google-book
data/Gemfile CHANGED
@@ -1,8 +1,5 @@
1
1
  source 'http://rubygems.org'
2
2
  gemspec
3
3
 
4
- gem 'rspec', '~> 2.5.0'
5
- gem 'ruby-debug', :platform => :mri_18, :require => 'ruby-debug'
4
+ gem 'ruby-debug', :platform => :mri_18, :require => 'ruby-debug'
6
5
  gem 'ruby-debug19', :platform => :mri_19, :require => 'ruby-debug'
7
- gem 'vcr', '~> 1.7.0'
8
- gem 'webmock', '~> 1.6.2'
@@ -14,8 +14,11 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.rubyforge_project = 'google-book'
16
16
 
17
- s.add_dependency('bookland', '~> 1.0.0')
18
- s.add_dependency('httparty', '~> 0.7.4')
17
+ s.add_dependency('bookland', '~> 1.0')
18
+ s.add_dependency('httparty', '~> 0.7')
19
+ s.add_development_dependency('rspec', '~> 2.6')
20
+ s.add_development_dependency('vcr', '~> 1.10')
21
+ s.add_development_dependency('webmock', '~> 1.6')
19
22
 
20
23
  s.files = `git ls-files`.split("\n")
21
24
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -4,6 +4,8 @@ require 'google/book/cover'
4
4
  module Google
5
5
  module Book
6
6
  class Entry
7
+ attr_reader :hash
8
+
7
9
  def initialize(hash)
8
10
  @hash = hash
9
11
  end
@@ -54,6 +56,10 @@ module Google
54
56
  gsub(/Univ( |$)/) { "University#{$1}" }
55
57
  end
56
58
  end
59
+
60
+ def rating
61
+ @hash['gd:rating']['average'].to_f rescue nil
62
+ end
57
63
 
58
64
  def subjects
59
65
  @hash['dc:subject']
@@ -1,5 +1,5 @@
1
1
  module Google
2
2
  module Book
3
- VERSION = '0.3.3'
3
+ VERSION = '0.4.0'
4
4
  end
5
5
  end
@@ -154,6 +154,19 @@ module Google
154
154
  end
155
155
  end
156
156
 
157
+ describe "#rating" do
158
+ it "should return a rating" do
159
+ entry.instance_variable_set(:@hash, {
160
+ 'gd:rating' => {
161
+ 'min' => '1',
162
+ 'max' => '5',
163
+ 'average' => '4.44'
164
+ }
165
+ })
166
+ entry.rating.should eql 4.44
167
+ end
168
+ end
169
+
157
170
  describe "#title" do
158
171
  it "should concatenate titles" do
159
172
  entry.instance_variable_set(:@hash, {
metadata CHANGED
@@ -1,8 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-book
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.3.3
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 4
8
+ - 0
9
+ version: 0.4.0
6
10
  platform: ruby
7
11
  authors:
8
12
  - Paper Cavalier
@@ -10,7 +14,7 @@ autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
16
 
13
- date: 2011-03-28 00:00:00 +01:00
17
+ date: 2011-06-10 00:00:00 +01:00
14
18
  default_executable:
15
19
  dependencies:
16
20
  - !ruby/object:Gem::Dependency
@@ -21,7 +25,10 @@ dependencies:
21
25
  requirements:
22
26
  - - ~>
23
27
  - !ruby/object:Gem::Version
24
- version: 1.0.0
28
+ segments:
29
+ - 1
30
+ - 0
31
+ version: "1.0"
25
32
  type: :runtime
26
33
  version_requirements: *id001
27
34
  - !ruby/object:Gem::Dependency
@@ -32,9 +39,54 @@ dependencies:
32
39
  requirements:
33
40
  - - ~>
34
41
  - !ruby/object:Gem::Version
35
- version: 0.7.4
42
+ segments:
43
+ - 0
44
+ - 7
45
+ version: "0.7"
36
46
  type: :runtime
37
47
  version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: rspec
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ segments:
57
+ - 2
58
+ - 6
59
+ version: "2.6"
60
+ type: :development
61
+ version_requirements: *id003
62
+ - !ruby/object:Gem::Dependency
63
+ name: vcr
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ~>
69
+ - !ruby/object:Gem::Version
70
+ segments:
71
+ - 1
72
+ - 10
73
+ version: "1.10"
74
+ type: :development
75
+ version_requirements: *id004
76
+ - !ruby/object:Gem::Dependency
77
+ name: webmock
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ~>
83
+ - !ruby/object:Gem::Version
84
+ segments:
85
+ - 1
86
+ - 6
87
+ version: "1.6"
88
+ type: :development
89
+ version_requirements: *id005
38
90
  description: Google Book is a Ruby wrapper to the Google Book Search Data API.
39
91
  email:
40
92
  - code@papercavalier.com
@@ -47,6 +99,7 @@ extra_rdoc_files: []
47
99
  files:
48
100
  - .gitignore
49
101
  - .rspec
102
+ - .rvmrc
50
103
  - Gemfile
51
104
  - LICENSE
52
105
  - README.md
@@ -77,17 +130,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
130
  requirements:
78
131
  - - ">="
79
132
  - !ruby/object:Gem::Version
133
+ segments:
134
+ - 0
80
135
  version: "0"
81
136
  required_rubygems_version: !ruby/object:Gem::Requirement
82
137
  none: false
83
138
  requirements:
84
139
  - - ">="
85
140
  - !ruby/object:Gem::Version
141
+ segments:
142
+ - 0
86
143
  version: "0"
87
144
  requirements: []
88
145
 
89
146
  rubyforge_project: google-book
90
- rubygems_version: 1.5.2
147
+ rubygems_version: 1.3.7
91
148
  signing_key:
92
149
  specification_version: 3
93
150
  summary: A Ruby wrapper to the Google Book Search Data API