google_book 0.3.1 → 0.3.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +24 -19
  2. data/lib/google_book/book_item.rb +48 -0
  3. metadata +2 -2
data/README.md CHANGED
@@ -10,14 +10,14 @@
10
10
  <img src = "https://badge.fury.io/rb/google_book.png"/>
11
11
  </div>
12
12
 
13
- <h1>Google Book ApI Integration</h1><br/>
14
- <p>You can use it in your web application as well as desktop application to fetch google books</p>
13
+ <h1>Google Book Api Integration For Books and Magazines</h1><br/>
14
+ <p>You can use it in your web application as well as desktop application to fetch google books and magazines and also filter them.</p>
15
15
  <div>
16
16
  <h2>Installation</h2>
17
- <p>In Gemfile
17
+ <p>In Gemfile<br/>
18
18
  <code>gem 'google_book', git: 'git@github.com:rajcybage/google_book.git'</code><br/>
19
19
  <span><b>OR</b></span><br/>
20
- <code>gem 'google_book', '0.3.1'</code>
20
+ <code>gem 'google_book', '0.3.1.1'</code>
21
21
  </p>
22
22
  </div>
23
23
  <div>
@@ -65,14 +65,19 @@
65
65
  <code>b=GoogleBook::Book.new(:api_key => "YOUR_GOOOGLE_API_KEY")</code> <br/>
66
66
  <code> b.search("Name of the book you want to search",1)</code> <br/>
67
67
  <code>b.books #create the instance of all the books of your search</code><br/>
68
- <code>b.books.first.get_title #get the first book title</code><br/>
69
- <code>b.books.first.get_sub_title#get the first book sub title</code><br/>
70
- <code>b.books.first.authors #get the first book authors</code><br/>
71
- <code>b.books.first.publish_date #get the first book published date</code><br/>
72
- <code>b.books.first.preview_link #get the first book preview link</code><br/>
73
- <code>b.books.first.info_link #get the first book information</code><br/>
74
- <code>b.books.first.thumbnail_image #get the first book thumbnail image</code><br/>
75
- <code>b.books.first.small_thumbnail_link #get the first book thumbnail image</code><br/>
68
+ <code><b>b.books.first.get_title #get the first book title</b></code><br/>
69
+ <code><b>b.books.first.get_sub_title#get the first book sub title</b></code><br/>
70
+ <code><b>b.books.first.authors #get the first book authors</b></code><br/>
71
+ <code><b>b.books.first.text_snippet_description #get the first book text snippet description</b></code><br/>
72
+ <code><b>b.books.first.publish_date #get the first book published date</b></code><br/>
73
+ <code><b>b.books.first.publisher #get the first book publisher name</b></code><br/>
74
+ <code><b>b.books.first.rating #get the rating of the book</b></code><br/>
75
+ <code><b>b.books.first.total_rating #get the total rating count of the book</b></code><br/>
76
+ <code><b>b.books.first.version #get the version of the book</b></code><br/>
77
+ <code><b>b.books.first.preview_link #get the first book preview link</b></code><br/>
78
+ <code><b>b.books.first.info_link #get the first book information</b></code><br/>
79
+ <code><b>b.books.first.thumbnail_image #get the first book thumbnail image</b></code><br/>
80
+ <code><b>b.books.first.small_thumbnail_link #get the first book thumbnail image</b></code><br/>
76
81
  </div>
77
82
 
78
83
 
@@ -115,16 +120,16 @@
115
120
  </div>
116
121
 
117
122
  <div>
118
- <code>b=GoogleBook::Book.new(:api_key => "YOUR_GOOOGLE_API_KEY")</code><br/>
119
- <code>b.filter('ruby language', 1)#here one is <b>filter_type</b> as defined above</code><br/>
123
+ <code>filter_book=GoogleBook::Book.new(:api_key => "YOUR_GOOOGLE_API_KEY")</code><br/>
124
+ <code>filter_book.filter('ruby language', 1)#here one is <b>filter_type</b> as defined above</code><br/>
120
125
  <span>Now create all books instance as usual</span><br/>
121
- <code>b.books</code>
126
+ <code>filter_book.books</code>
122
127
  <span><b>If you select your filter as free ebook then it will be downloadable and buyable</b></span><br/>
123
128
 
124
- <code>b.books.first.downloadable?#check whther the book is downloadable</code><br/>
125
- <code>b.books.first.buyable?#check whether the book is buyable</code><br/>
126
- <code>b.books.first.buy_link</code><br/>
127
- <code>b.books.first.download_link</code>
129
+ <code>filter_book.books.first.downloadable?#check whther the book is downloadable</code><br/>
130
+ <code>filter_book.books.first.buyable?#check whether the book is buyable</code><br/>
131
+ <code>filter_book.books.first.buy_link</code><br/>
132
+ <code>filter_book.books.first.download_link</code>
128
133
 
129
134
  </div>
130
135
  </p>
@@ -8,50 +8,93 @@ class BookItem
8
8
  @item = item
9
9
  end
10
10
 
11
+ # get the title of the book
11
12
  def get_title
12
13
  @item[:item]["volumeInfo"]["title"]
13
14
  end
14
15
 
16
+ #get the sub title of the book
15
17
  def get_sub_title
16
18
  @item[:item]["volumeInfo"]["subtitle"]
17
19
  end
18
20
 
21
+ #the authors(s) of the book
19
22
  def authors
20
23
  @item[:item]["volumeInfo"]["authors"]
21
24
  end
22
25
 
26
+ #The published date of the book
23
27
  def publish_date
24
28
  @item[:item]["volumeInfo"]["publishedDate"]
25
29
  end
26
30
 
31
+ #The preview link
27
32
  def preview_link
28
33
  @item[:item]["volumeInfo"]["previewLink"]
29
34
  end
30
35
 
36
+ #Information link
31
37
  def info_link
32
38
  @item[:item]["volumeInfo"]["infoLink"]
33
39
  end
34
40
 
41
+ #canonical volume link
35
42
  def canonical_volume_link
36
43
  @item[:item]["volumeInfo"]["canonicalVolumeLink"]
37
44
  end
38
45
 
46
+ #thumbnail images
39
47
  def thubnail_image
40
48
  @item[:item]["volumeInfo"]["imageLinks"]["thumbnail"]
41
49
  end
42
50
 
51
+ #small thumbnail images
43
52
  def small_thumbnail_link
44
53
  @item[:item]["volumeInfo"]["imageLinks"]["smallThumbnail"]
45
54
  end
46
55
 
56
+ #total pages
47
57
  def pagecount
48
58
  @item[:item]["volumeInfo"]["pageCount"]
49
59
  end
50
60
 
61
+ #web reader link
51
62
  def web_reader_link
52
63
  @item[:item]["accessInfo"]["webReaderLink"]
53
64
  end
54
65
 
66
+ #text snippet description
67
+ def text_snippet_description
68
+ @item[:item]["searchInfo"]["textSnippet"] unless @item[:item]["searchInfo"].nil?
69
+ end
70
+
71
+ #The rating of the book
72
+ def rating
73
+ @item[:item]["volumeInfo"]["averageRating"]
74
+ end
75
+
76
+ #The version of the book
77
+ def version
78
+ @item[:item]["volumeInfo"]["contentVersion"]
79
+ end
80
+
81
+ #the total count of the rating
82
+ def total_rating
83
+ @item[:item]["volumeInfo"]["ratingsCount"]
84
+ end
85
+
86
+ #publisher
87
+ def publisher
88
+ @item[:item]["volumeInfo"]["publisher"]
89
+ end
90
+
91
+
92
+ #publish date
93
+ def publish_date to
94
+ @item[:item]["volumeInfo"]["publishedDate"]
95
+ end
96
+
97
+ #the buy link of the book
55
98
  def buy_link
56
99
  if buyable?
57
100
  @item[:item]["saleInfo"]["buyLink"]
@@ -60,6 +103,7 @@ class BookItem
60
103
  end
61
104
  end
62
105
 
106
+ #check whether it is magazine or not
63
107
  def magazine?
64
108
  if @item[:item]["volumeInfo"]["printType"].upcase == "MAGAZINE"
65
109
  true
@@ -68,10 +112,12 @@ class BookItem
68
112
  end
69
113
  end
70
114
 
115
+ #The price of the book
71
116
  def price
72
117
  @item[:item]["saleInfo"]["listPrice"]["amount"].to_s + ' ' + @item[:item]["saleInfo"]["listPrice"]["currencyCode"] unless @item[:item]["saleInfo"]["listPrice"].nil?
73
118
  end
74
119
 
120
+ #check whether the book is download able or not
75
121
  def downloadable?
76
122
  unless @item[:item]["accessInfo"]["pdf"].nil? || @item[:item]["accessInfo"]["pdf"]["downloadLink"].nil?
77
123
  true
@@ -80,6 +126,7 @@ class BookItem
80
126
  end
81
127
  end
82
128
 
129
+ #check whether the book is buy able or not
83
130
  def buyable?
84
131
  if @item[:item]["saleInfo"]["isEbook"] != true || @item[:item]["saleInfo"]["buyLink"].nil?
85
132
  false
@@ -88,6 +135,7 @@ class BookItem
88
135
  end
89
136
  end
90
137
 
138
+ #the download link of the book
91
139
  def download_link
92
140
  if downloadable?
93
141
  @item[:item]["accessInfo"]["pdf"]["downloadLink"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_book
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -50,6 +50,6 @@ rubyforge_project:
50
50
  rubygems_version: 1.8.24
51
51
  signing_key:
52
52
  specification_version: 3
53
- summary: Google Book API integration
53
+ summary: Google Book API integration for fetching the information for google books and magazines also filter them. You can eaisly get most of the elements for a particular book and magazine from the google book search. like :-(title,sub title,preview link,authors,publisher,publish date,buylink,downloadlink,version,...many more
54
54
  test_files: []
55
55
  has_rdoc: