npr_best_books 0.1.2 → 0.1.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.
- checksums.yaml +4 -4
- data/exe/{npr_best_books → npr-best-books} +0 -0
- data/lib/npr_best_books/cli.rb +11 -9
- data/lib/npr_best_books/scraper.rb +1 -1
- data/lib/npr_best_books/version.rb +1 -1
- data/npr_best_books.gemspec +1 -1
- metadata +3 -7
- data/exe/console +0 -14
- data/exe/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7299d108f857348afe8e7ec6947905dd0f53a35c
|
4
|
+
data.tar.gz: 6ad60dc0077c208e8ae0e036f90a71a55a0f84a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c01e23c8675aa1257484c69d78355ad5e6a19d2703b1d29c6683274549754d88255a847f7051b548a8a2a6e3c9d52fa9b56202168e44407912dcf7382c531e34
|
7
|
+
data.tar.gz: 9493906b68392f4ec1aee6d6a7d101b5d7d7cd8d3315373c64fd6eda580ef807897c0b6eeaee250632c17bebfe4cdc4f573271d589c61747b76d308d45fcc9c3
|
File without changes
|
data/lib/npr_best_books/cli.rb
CHANGED
@@ -19,12 +19,12 @@ class NPRBestBooks::CLI
|
|
19
19
|
|
20
20
|
def list_books
|
21
21
|
if @list
|
22
|
-
puts "#{@year}'s Science Fiction & Fantasy recommendations:"
|
22
|
+
puts "\r#{@year}'s Science Fiction & Fantasy recommendations:"
|
23
23
|
@list = NPRBestBooks::List.science_fiction_and_fantasy
|
24
24
|
puts "Total #{@year} NPR Science Fiction & Fantasy recommendations: #{@list.count} books"
|
25
25
|
else
|
26
26
|
NPRBestBooks::List.latest
|
27
|
-
puts "#{@year}'s Science Fiction & Fantasy recommendations:"
|
27
|
+
puts "\r#{@year}'s Science Fiction & Fantasy recommendations:"
|
28
28
|
@list = NPRBestBooks::List.science_fiction_and_fantasy
|
29
29
|
puts "Total #{@year} NPR Science Fiction & Fantasy recommendations: #{@list.count} books"
|
30
30
|
end
|
@@ -37,7 +37,7 @@ class NPRBestBooks::CLI
|
|
37
37
|
input = ""
|
38
38
|
while input != "exit"
|
39
39
|
input = gets.strip.downcase
|
40
|
-
|
40
|
+
|
41
41
|
if input.to_i >= 1 && input.to_i <= @list.count
|
42
42
|
@current_book_id = input.to_i
|
43
43
|
current_book_array_id = @current_book_id - 1
|
@@ -54,10 +54,11 @@ class NPRBestBooks::CLI
|
|
54
54
|
puts "=> " + "ISBN: #{@list[current_book_array_id].isbn}, ISBN-13 #{@list[current_book_array_id].isbn13}"
|
55
55
|
puts "=> " + "Average Amazon Customer Reviews:"
|
56
56
|
begin
|
57
|
+
print " " + "Loading Amazon Ratings..."
|
57
58
|
NPRBestBooks::Book.lookup_amazonreviews(@list[current_book_array_id])
|
58
|
-
puts " " + "#{@list[current_book_array_id].amazonratings} (#{@list[current_book_array_id].amazonreviews} Reviews)"
|
59
|
+
puts "\r " + "#{@list[current_book_array_id].amazonratings} (#{@list[current_book_array_id].amazonreviews} Reviews)"
|
59
60
|
rescue OpenURI::HTTPError => error
|
60
|
-
puts " " + "Data currently unavailable (#{error}). Try again later."
|
61
|
+
puts "\r " + "Data currently unavailable (#{error}). Try again later."
|
61
62
|
end
|
62
63
|
puts "================================================================================"
|
63
64
|
sub_menu
|
@@ -107,13 +108,14 @@ class NPRBestBooks::CLI
|
|
107
108
|
puts "=> " + "ISBN: #{@list[current_book_array_id].isbn}, ISBN-13 #{@list[current_book_array_id].isbn13}"
|
108
109
|
puts "=> " + "Average Amazon Customer Reviews:"
|
109
110
|
begin
|
111
|
+
print " " + "Loading Amazon Ratings..."
|
110
112
|
NPRBestBooks::Book.lookup_amazonreviews(@list[current_book_array_id])
|
111
|
-
puts " " + "#{@list[current_book_array_id].amazonratings} (#{@list[current_book_array_id].amazonreviews} Reviews)"
|
113
|
+
puts "\r " + "#{@list[current_book_array_id].amazonratings} (#{@list[current_book_array_id].amazonreviews} Reviews)"
|
112
114
|
rescue OpenURI::HTTPError => error
|
113
|
-
puts " " + "Data currently unavailable (#{error}). Try again later."
|
115
|
+
puts "\r " + "Data currently unavailable (#{error}). Try again later."
|
114
116
|
end
|
115
117
|
puts "================================================================================"
|
116
|
-
sub_menu
|
118
|
+
sub_menu
|
117
119
|
else
|
118
120
|
puts "Invalid command, please try again. Error on: '#{input}'."
|
119
121
|
puts "'list' to show book list again, 'exit' to end program."
|
@@ -134,4 +136,4 @@ class NPRBestBooks::CLI
|
|
134
136
|
exit
|
135
137
|
end
|
136
138
|
|
137
|
-
end
|
139
|
+
end
|
data/npr_best_books.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
18
|
spec.bindir = "exe"
|
19
|
-
spec.executables = spec.files.grep(%r{^
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.12"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: npr_best_books
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- beingy
|
@@ -85,9 +85,7 @@ description: A Simple CLI Gem to list NPR Book Concierge website's 2015 book rec
|
|
85
85
|
email:
|
86
86
|
- beingy@gmail.com
|
87
87
|
executables:
|
88
|
-
-
|
89
|
-
- npr_best_books
|
90
|
-
- setup
|
88
|
+
- npr-best-books
|
91
89
|
extensions: []
|
92
90
|
extra_rdoc_files: []
|
93
91
|
files:
|
@@ -103,9 +101,7 @@ files:
|
|
103
101
|
- bin/console
|
104
102
|
- bin/npr_best_books
|
105
103
|
- bin/setup
|
106
|
-
- exe/
|
107
|
-
- exe/npr_best_books
|
108
|
-
- exe/setup
|
104
|
+
- exe/npr-best-books
|
109
105
|
- lib/npr_best_books.rb
|
110
106
|
- lib/npr_best_books/book.rb
|
111
107
|
- lib/npr_best_books/cli.rb
|
data/exe/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "npr_best_books"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|