nyt-bestsellers 0.0.1 → 0.0.2
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/lib/nytimes/cli.rb +23 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ada07f12703db76eac60fe562660c08c1e1af02d
|
4
|
+
data.tar.gz: 68d508bebc12879e83c6a499dead3c3a6dedb60f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e85bab7360689bc3a5e6de860632ba750e3883ee49abce441e8ca3ce70fdf11c7b67d37b63717d83957cacde5691660395eb2945e1ff5713449e07eec23ff71a
|
7
|
+
data.tar.gz: 5e4a13554a4c1cc1b1349593fb9a0b7a3acd55ca5d1d50d19e12a34db78a3f28f2dcc7676c76823908fa254e833659e97268c3b3463e23200cb7fcbffca9b72a
|
data/lib/nytimes/cli.rb
CHANGED
@@ -21,9 +21,9 @@ class NYTBestsellers::CLI
|
|
21
21
|
|
22
22
|
response = ""
|
23
23
|
while response != "exit"
|
24
|
-
puts "Select a category by number
|
24
|
+
puts "Select a category by number or type " + "'exit'".light_red + " to close the CLI."
|
25
25
|
response = gets.strip
|
26
|
-
if (1..
|
26
|
+
if (1..genre_count).to_a.include?(response.to_i)
|
27
27
|
genre_books(response.to_i)
|
28
28
|
elsif response == "exit"
|
29
29
|
puts "Goodbye!~".bold.red
|
@@ -33,6 +33,10 @@ class NYTBestsellers::CLI
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
def genre_count
|
37
|
+
NYTBestsellers::Genre.all.count
|
38
|
+
end
|
39
|
+
|
36
40
|
def display_genres
|
37
41
|
NYTBestsellers::Genre.all.each_with_index do |genre, index|
|
38
42
|
puts "#{index+1} - #{genre.name}"
|
@@ -57,18 +61,22 @@ class NYTBestsellers::CLI
|
|
57
61
|
puts ""
|
58
62
|
puts "(^refers to the current position on the bestseller's list)"
|
59
63
|
puts ""
|
60
|
-
puts "Select a book by rank number to get more info: " + "[back][exit]".light_red
|
61
|
-
puts ""
|
62
64
|
|
63
|
-
book_input =
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
elsif book_input == "exit"
|
69
|
-
puts "Goodbye!~".bold.red
|
65
|
+
book_input = ""
|
66
|
+
while book_input != "exit"
|
67
|
+
puts "Select a book by rank number to get more info."
|
68
|
+
puts "You may type" + " 'back'".light_red + " to return to the categories or " + "'exit'".light_red + " to close the CLI."
|
69
|
+
book_input = gets.strip
|
70
70
|
puts ""
|
71
|
-
|
71
|
+
if (1..genre.books.count).include?(book_input.to_i)
|
72
|
+
display_book_info(response, book_input)
|
73
|
+
elsif book_input == "back"
|
74
|
+
run
|
75
|
+
elsif book_input == "exit"
|
76
|
+
puts "Goodbye!~".bold.red
|
77
|
+
puts ""
|
78
|
+
exit
|
79
|
+
end
|
72
80
|
end
|
73
81
|
end
|
74
82
|
|
@@ -87,7 +95,7 @@ class NYTBestsellers::CLI
|
|
87
95
|
puts "---------Summary---------".bold
|
88
96
|
puts "#{book.summary}"
|
89
97
|
puts ""
|
90
|
-
puts "
|
98
|
+
puts "Type" + " 'back'".light_red + "," + " 'menu',".light_red + " or" + " 'exit'".light_red + "."
|
91
99
|
puts ""
|
92
100
|
|
93
101
|
input = gets.strip
|
@@ -101,6 +109,8 @@ class NYTBestsellers::CLI
|
|
101
109
|
elsif input == "menu"
|
102
110
|
run
|
103
111
|
puts ""
|
112
|
+
else
|
113
|
+
display_book_info(response, book_input)
|
104
114
|
end #second if
|
105
115
|
end #first if
|
106
116
|
end #each
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nyt-bestsellers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amy Back
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|