gisbn 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +24 -0
- data/.travis.yml +15 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +106 -0
- data/Rakefile +6 -0
- data/gisbn.gemspec +27 -0
- data/lib/gisbn.rb +284 -0
- data/lib/gisbn/version.rb +3 -0
- data/spec/gisbn_spec.rb +17 -0
- data/spec/spec_helper.rb +5 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 513f21bca505a34739c299586d3d6f387f7c5b42
|
4
|
+
data.tar.gz: 6213468089ada8589e382e00ad962eb3e73aa6f7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c9672931fc8b09dc9eb391838a27be30f02e4095766d7fcf184389ecf84f6d3f77c8f37bde47537972fc9e94c071b1abb16b040b2621b5ab1f99da865ac9d54d
|
7
|
+
data.tar.gz: 70884f43bde477cb0dd8f4c784310cae57020fc87f1e3fcaf61ffa370bcd1f5481647d64a40b3a00bd856bb8e41e3c2a74df2151cd28b633349d69ce3d499423
|
data/.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
.idea
|
24
|
+
.rvmrc
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Eftakhairul Islam
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
# gisbn
|
2
|
+
|
3
|
+
It fetches book's information by ISBN number based on Google Book API.
|
4
|
+
|
5
|
+
- Easy to get all information by ISBN
|
6
|
+
- Structure data
|
7
|
+
|
8
|
+
You don't have to call manually Google API with ISBN number. This gem will do everything for you.
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
### Version
|
13
|
+
0.0.1
|
14
|
+
|
15
|
+
|
16
|
+
### Installation
|
17
|
+
|
18
|
+
You need Gulp installed globally:
|
19
|
+
|
20
|
+
```sh
|
21
|
+
gem install gisbn
|
22
|
+
```
|
23
|
+
Or, if you're using this in a project with Bundler:
|
24
|
+
|
25
|
+
```sh
|
26
|
+
gem 'gisbn'
|
27
|
+
```
|
28
|
+
|
29
|
+
## Examples
|
30
|
+
book = Gisbn::Book.new "0262033844"
|
31
|
+
|
32
|
+
book.title
|
33
|
+
#=> "Introduction to Algorithms"
|
34
|
+
|
35
|
+
book.description
|
36
|
+
#=> "A new edition of the essential text and professional reference, with substantial newmaterial on such topics as vEB trees, multithreaded algorithms, dynamic programming, and edge-baseflow."
|
37
|
+
|
38
|
+
book.publisher
|
39
|
+
#=> "MIT Press"
|
40
|
+
|
41
|
+
book.published_date
|
42
|
+
#=> <Date: 2001-02-03 ...>
|
43
|
+
|
44
|
+
book.isbn_10
|
45
|
+
#=> 0262033844
|
46
|
+
|
47
|
+
book.isbn_13
|
48
|
+
#=> 9780262033848
|
49
|
+
|
50
|
+
book.thumbnail
|
51
|
+
#=> http://books.google.com/books/content?id=i-bUBQAAQBAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api
|
52
|
+
|
53
|
+
book.preview
|
54
|
+
#=> http://books.google.ca/books?id=i-bUBQAAQBAJ&printsec=frontcover&dq=isbn:0262033844&hl=&cd=1&source=gbs_api
|
55
|
+
|
56
|
+
|
57
|
+
book.gisbn.isbn = 9780321573513
|
58
|
+
book.fetch.title => "Algorithms"
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
## Methods
|
63
|
+
title >> Returns Book's title as string
|
64
|
+
description >> Returns the description of book as string
|
65
|
+
isbn(isbn_number) >> Set new isbn
|
66
|
+
fetch >> Call to Google Book API and process book information on provided ISBN
|
67
|
+
authors >> Return authors' name as comma separated as string
|
68
|
+
authors_as_array >> Return authors' name as ruby array. If no book is associated with ISBN number,
|
69
|
+
then it return empty array
|
70
|
+
publisher >> Return publisher name as string
|
71
|
+
isbn_10 >> Return 10 digit ISBN numbers as string
|
72
|
+
isbn_13 >> Return 13 digit ISBN numbers as string
|
73
|
+
categories >> Return category names as comma separated as string
|
74
|
+
categories_as_array >> Return category names as ruby array. If no book is associated with ISBN number,
|
75
|
+
then it return empty array
|
76
|
+
thumbnail_small >> Return the link of small thumnail
|
77
|
+
thumbnail >> Return the link of standard thumnail
|
78
|
+
preview_link >> Return the link for previewing the book
|
79
|
+
page_count >> Return page count as integer
|
80
|
+
published_date >> Return the published date as Ruby object
|
81
|
+
|
82
|
+
|
83
|
+
### Development
|
84
|
+
|
85
|
+
Want to contribute? Great!
|
86
|
+
|
87
|
+
1. Fork it ( https://github.com/eftakhairul/gisbn/fork )
|
88
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
89
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
90
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
91
|
+
5. Create a new Pull Request
|
92
|
+
|
93
|
+
|
94
|
+
Author
|
95
|
+
-----------
|
96
|
+
[Eftakhairul Islam] - eftakhairul [at] gmail [dot] com
|
97
|
+
[Eftakhairul Islam]:http://eftakhairul.com/
|
98
|
+
|
99
|
+
|
100
|
+
License
|
101
|
+
----
|
102
|
+
MIT
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
data/Rakefile
ADDED
data/gisbn.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gisbn/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "gisbn"
|
8
|
+
spec.version = Gisbn::VERSION
|
9
|
+
spec.authors = ["Eftakhairul Islam"]
|
10
|
+
spec.email = ["eftakhairul@gmail.com"]
|
11
|
+
spec.summary = %q{Book information from ISBN by Google Book API.}
|
12
|
+
spec.description = %q{It fetches book's information by ISBN number based on Google Book API.}
|
13
|
+
spec.homepage = "https://github.com/eftakhairul/gisbn"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
|
24
|
+
##dependency for testing automation
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
spec.add_development_dependency "rspec-nc"
|
27
|
+
end
|
data/lib/gisbn.rb
ADDED
@@ -0,0 +1,284 @@
|
|
1
|
+
#require all files
|
2
|
+
require "gisbn/version"
|
3
|
+
require 'rubygems'
|
4
|
+
require 'net/http'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
|
8
|
+
module Gisbn
|
9
|
+
|
10
|
+
class Book
|
11
|
+
|
12
|
+
attr_reader :result, :isbn
|
13
|
+
|
14
|
+
private
|
15
|
+
attr_accessor :key, :country
|
16
|
+
|
17
|
+
BASE_URL = 'https://www.googleapis.com/books/v1/volumes?q=isbn:'
|
18
|
+
|
19
|
+
public
|
20
|
+
# Initialize a new Book object by ISBN (either ten or thirteen digits ISBN number)
|
21
|
+
#
|
22
|
+
# At Interactive Ruby Shell...
|
23
|
+
# require 'gisbn'
|
24
|
+
# book = Gisbn::Book.new "0262033844"
|
25
|
+
#
|
26
|
+
# book.title #=> "Introduction to Algorithms"
|
27
|
+
#
|
28
|
+
def initialize(isbn = nil,
|
29
|
+
key = 'AIzaSyDKepjfaVBRcgsnPALw5s2UNyfOk-1FHUU',
|
30
|
+
country = 'ca')
|
31
|
+
|
32
|
+
|
33
|
+
@isbn = isbn.strip! || isbn
|
34
|
+
@key = key
|
35
|
+
@country = country
|
36
|
+
|
37
|
+
fetch
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
# Fetch book info from Google API
|
42
|
+
#
|
43
|
+
# Example:
|
44
|
+
# >> gisbn.fetch
|
45
|
+
# => #<Gisbn::Book:0x007fc08525e688 @isbn="0262033844", @result={"kind"=>"books#volumes", "totalItems"=>1, "items"=>[{"kind"=>"books#volume",
|
46
|
+
# "id"=>"i-bUBQAAQBAJ", "etag"=>"a0y8TyrBWu0", "selfLink"=>"https://www.googleapis.com/books/v1/volumes/i-bUBQAAQBAJ",
|
47
|
+
# "volumeInfo"=>{"title"=>"Introduction to Algorithms", "authors"=>["Thomas H. Cormen"], "publisher"=>"MIT Press", "publishedDate"=>"2009-07-31",
|
48
|
+
# "description"=>"A new edition of the essential text and professional reference, with substantial newmaterial on such topics as vEB trees,
|
49
|
+
# multithreaded algorithms, dynamic programming, and edge-baseflow.", "industryIdentifiers"=>[{"type"=>"ISBN_13", "identifier"=>"9780262033848"},
|
50
|
+
# {"type"=>"ISBN_10", "identifier"=>"0262033844"}], "readingModes"=>{"text"=>false, "image"=>true}, "pageCount"=>1292, "printType"=>"BOOK",
|
51
|
+
# "categories"=>["Computers"], "averageRating"=>4.0, "ratingsCount"=>16, "contentVersion"=>"preview-1.0.0",
|
52
|
+
# "imageLinks"=>{"smallThumbnail"=>"http://books.google.com/books/content?id=i-bUBQAAQBAJ&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api",
|
53
|
+
# "thumbnail"=>"http://books.google.com/books/content?id=i-bUBQAAQBAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api"}, "language"=>"en",
|
54
|
+
# "previewLink"=>"http://books.google.ca/books?id=i-bUBQAAQBAJ&printsec=frontcover&dq=isbn:0262033844&hl=&cd=1&source=gbs_api",
|
55
|
+
# "infoLink"=>"http://books.google.ca/books?id=i-bUBQAAQBAJ&dq=isbn:0262033844&hl=&source=gbs_api", "canonicalVolumeLink"=>"http://books.google.ca/books/about/Introduction_to_Algorithms.html?hl=&id=i-bUBQAAQBAJ"},
|
56
|
+
# "saleInfo"=>{"country"=>"CA", "saleability"=>"NOT_FOR_SALE", "isEbook"=>false}, "accessInfo"=>{"country"=>"CA", "viewability"=>"PARTIAL",
|
57
|
+
# "embeddable"=>true, "publicDomain"=>false, "textToSpeechPermission"=>"ALLOWED", "epub"=>{"isAvailable"=>false}, "pdf"=>{"isAvailable"=>false},
|
58
|
+
# "webReaderLink"=>"http://books.google.ca/books/reader?id=i-bUBQAAQBAJ&hl=&printsec=frontcover&output=reader&source=gbs_api",
|
59
|
+
# "accessViewStatus"=>"SAMPLE", "quoteSharingAllowed"=>false}, "searchInfo"=>{"textSnippet"=>"A new edition of the essential text
|
60
|
+
# and professional reference, with substantial newmaterial on such topics as vEB trees, multithreaded algorithms, dynamic programming, and
|
61
|
+
# edge-baseflow."}}]}
|
62
|
+
#
|
63
|
+
# Return
|
64
|
+
# JSON
|
65
|
+
def fetch
|
66
|
+
response = Net::HTTP.get_response(URI.parse(BASE_URL + "#{@isbn}&key=#{@key}&country=#{@country}")).body
|
67
|
+
@result = JSON.parse(response)
|
68
|
+
@result = nil if @result["totalItems"] == 0
|
69
|
+
end
|
70
|
+
|
71
|
+
# Set ISBN for new request
|
72
|
+
#
|
73
|
+
# Example:
|
74
|
+
# >> gisbn.isbn = 0262033844
|
75
|
+
#
|
76
|
+
# Return
|
77
|
+
# Gisbn
|
78
|
+
def isbn(isbn)
|
79
|
+
isbn.strip! || isbn
|
80
|
+
end
|
81
|
+
|
82
|
+
# Description of the book
|
83
|
+
#
|
84
|
+
# Example:
|
85
|
+
# >> gisbn.description
|
86
|
+
# => "A new edition of the essential text and professional reference, with substantial newmaterial on such topics as vEB trees,
|
87
|
+
# multithreaded algorithms, dynamic programming, and edge-baseflow."
|
88
|
+
#
|
89
|
+
# Return:
|
90
|
+
# String
|
91
|
+
def description
|
92
|
+
return nil if @result.nil?
|
93
|
+
@result["items"][0]["description"]
|
94
|
+
end
|
95
|
+
|
96
|
+
# Title of the book
|
97
|
+
# Example:
|
98
|
+
# >> gisbn.title
|
99
|
+
# => "Introduction to Algorithms"
|
100
|
+
#
|
101
|
+
# Return:
|
102
|
+
# String
|
103
|
+
def title
|
104
|
+
return nil if @result.nil?
|
105
|
+
@result["items"][0]["volumeInfo"]["title"]
|
106
|
+
end
|
107
|
+
|
108
|
+
# It returns all authors' name as comma separated string
|
109
|
+
#
|
110
|
+
# Example:
|
111
|
+
# >> gisbn.authors
|
112
|
+
# => "harles E. Leiserson, Clifford Stein, Ronald Rivest,Thomas H. Cormen"
|
113
|
+
#
|
114
|
+
# Return:
|
115
|
+
# String
|
116
|
+
def authors
|
117
|
+
return nil if @result.nil?
|
118
|
+
@result["items"][0]["volumeInfo"]["authors"].join(", ")
|
119
|
+
end
|
120
|
+
|
121
|
+
# It returns all authors' name as array
|
122
|
+
#
|
123
|
+
# Example:
|
124
|
+
# >> gisbn.authors_as_array
|
125
|
+
# => ["harles E. Leiserson", "Clifford Stein", "Ronald Rivest", "Thomas H. Cormen"]
|
126
|
+
#
|
127
|
+
# Return:
|
128
|
+
# array
|
129
|
+
def authors_as_array
|
130
|
+
return Array.new if @result.nil?
|
131
|
+
@result["items"][0]["volumeInfo"]["authors"]
|
132
|
+
end
|
133
|
+
|
134
|
+
# It returns publisher name
|
135
|
+
#
|
136
|
+
# Example:
|
137
|
+
# >> gisbn.publisher
|
138
|
+
# => "MIT Press"
|
139
|
+
#
|
140
|
+
# Return:
|
141
|
+
# String
|
142
|
+
def publisher
|
143
|
+
return nil if @result.nil?
|
144
|
+
@result["items"][0]["volumeInfo"]["publisher"]
|
145
|
+
end
|
146
|
+
|
147
|
+
|
148
|
+
# It returns the ten digit ISBN number of book
|
149
|
+
#
|
150
|
+
# Example:
|
151
|
+
# >> gisbn.isbn_10
|
152
|
+
# => "0262033844"
|
153
|
+
#
|
154
|
+
# Return:
|
155
|
+
# the ten digit numbers
|
156
|
+
def isbn_10
|
157
|
+
return nil if @result.nil?
|
158
|
+
|
159
|
+
isbn_array = @result["items"][0]["volumeInfo"]["industryIdentifiers"]
|
160
|
+
|
161
|
+
isbn_array.each do |isbn|
|
162
|
+
if isbn["type"] == "ISBN_13"
|
163
|
+
return isbn["identifier"]
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
|
169
|
+
# It returns the thirteen digit ISBN number of book
|
170
|
+
#
|
171
|
+
# Example:
|
172
|
+
# >> gisbn.isbn_13
|
173
|
+
# => "9780262033848"
|
174
|
+
#
|
175
|
+
# Return:
|
176
|
+
# the thirteen digit number
|
177
|
+
def isbn_13
|
178
|
+
return nil if @result.nil?
|
179
|
+
|
180
|
+
isbn_array = @result["items"][0]["volumeInfo"]["industryIdentifiers"]
|
181
|
+
|
182
|
+
isbn_array.each do |isbn|
|
183
|
+
if isbn["type"] == "ISBN_13"
|
184
|
+
return isbn["identifier"]
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
# It returns categories of book
|
190
|
+
#
|
191
|
+
# Example:
|
192
|
+
# >> gisbn.categories
|
193
|
+
# => "Computers"
|
194
|
+
#
|
195
|
+
# Return:
|
196
|
+
# String
|
197
|
+
def categories
|
198
|
+
return nil if @result.nil?
|
199
|
+
@result["items"][0]["volumeInfo"]["categories"].join(", ")
|
200
|
+
end
|
201
|
+
|
202
|
+
|
203
|
+
# It returns categories of book as array
|
204
|
+
#
|
205
|
+
# Example:
|
206
|
+
# >> gisbn.categories
|
207
|
+
# => ["Computers"]
|
208
|
+
#
|
209
|
+
# Return:
|
210
|
+
# array
|
211
|
+
def categories_as_array
|
212
|
+
return Array.new if @result.nil?
|
213
|
+
@result["items"][0]["volumeInfo"]["categories"]
|
214
|
+
end
|
215
|
+
|
216
|
+
|
217
|
+
# It returns the link of small size thumbnail of book
|
218
|
+
#
|
219
|
+
# Example:
|
220
|
+
# >> gisbn.small_thumbnail
|
221
|
+
# => "http://books.google.com/books/content?id=i-bUBQAAQBAJ&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api"
|
222
|
+
#
|
223
|
+
# Return:
|
224
|
+
# String
|
225
|
+
def thumbnail_small
|
226
|
+
return nil if @result.nil?
|
227
|
+
@result["items"][0]["volumeInfo"]["imageLinks"]["smallThumbnail"]
|
228
|
+
end
|
229
|
+
|
230
|
+
|
231
|
+
# It returns the link of thumbnail of book
|
232
|
+
#
|
233
|
+
# Example:
|
234
|
+
# >> gisbn.thumbnail
|
235
|
+
# => "http://books.google.com/books/content?id=i-bUBQAAQBAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api"
|
236
|
+
#
|
237
|
+
# Return:
|
238
|
+
# String
|
239
|
+
def thumbnail
|
240
|
+
return nil if @result.nil?
|
241
|
+
@result["items"][0]["volumeInfo"]["imageLinks"]["thumbnail"]
|
242
|
+
end
|
243
|
+
|
244
|
+
# It returns the preview link of book
|
245
|
+
#
|
246
|
+
# Example:
|
247
|
+
# >> gisbn.preview_link
|
248
|
+
# => "http://books.google.ca/books?id=i-bUBQAAQBAJ&printsec=frontcover&dq=isbn:0262033844&hl=&cd=1&source=gbs_api"
|
249
|
+
#
|
250
|
+
# Return:
|
251
|
+
# String
|
252
|
+
def preview_link
|
253
|
+
return nil if @result.nil?
|
254
|
+
@result["items"][0]["volumeInfo"]["previewLink"]
|
255
|
+
end
|
256
|
+
|
257
|
+
# It returns the count of page
|
258
|
+
#
|
259
|
+
# Example:
|
260
|
+
# >> gisbn.page_count
|
261
|
+
# => 1292
|
262
|
+
#
|
263
|
+
# Return:
|
264
|
+
# int
|
265
|
+
def page_count
|
266
|
+
return 0 if @result.nil?
|
267
|
+
@result["items"][0]["volumeInfo"]["pageCount"]
|
268
|
+
end
|
269
|
+
|
270
|
+
|
271
|
+
# It returns the published date
|
272
|
+
#
|
273
|
+
# Example:
|
274
|
+
# >> gisbn.published_date
|
275
|
+
# => #<Date: 2009-07-31 ((2455044j,0s,0n),+0s,2299161j)>
|
276
|
+
#
|
277
|
+
# Return:
|
278
|
+
# Date
|
279
|
+
def published_date
|
280
|
+
return nil if @result.nil?
|
281
|
+
Date.parse(@result["items"][0]["volumeInfo"]["publishedDate"])
|
282
|
+
end
|
283
|
+
end
|
284
|
+
end
|
data/spec/gisbn_spec.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "gisbn" do
|
4
|
+
subject { Gisbn::Book.new "0262033844" }
|
5
|
+
|
6
|
+
describe '#process' do
|
7
|
+
let(:output) { "Introduction to Algorithms" }
|
8
|
+
|
9
|
+
it 'book title' do
|
10
|
+
expect(output.downcase).to eq subject.title.downcase
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'book page count' do
|
14
|
+
expect(output).to eq subject.page_count
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gisbn
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eftakhairul Islam
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-nc
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: It fetches book's information by ISBN number based on Google Book API.
|
70
|
+
email:
|
71
|
+
- eftakhairul@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".travis.yml"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- gisbn.gemspec
|
83
|
+
- lib/gisbn.rb
|
84
|
+
- lib/gisbn/version.rb
|
85
|
+
- spec/gisbn_spec.rb
|
86
|
+
- spec/spec_helper.rb
|
87
|
+
homepage: https://github.com/eftakhairul/gisbn
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.4.3
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: Book information from ISBN by Google Book API.
|
111
|
+
test_files:
|
112
|
+
- spec/gisbn_spec.rb
|
113
|
+
- spec/spec_helper.rb
|