libri 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 442cfcbbae40605ea64f8c70d335456ec514f594ef30291e9967bf048b8809e1
4
- data.tar.gz: 8454365900c686f5e5362f17fe9547c9e9ac7f6b2e86ccef955e5dfdcd95ab52
3
+ metadata.gz: c8a17764f20b0acdd8efd6d489ec96761c6a6bf0f8ae5ee8910294d4d2e57b02
4
+ data.tar.gz: a3781d8417dc86c32664488128bdc22834aa7beaa0312f6c6fd17511cb68ef51
5
5
  SHA512:
6
- metadata.gz: 2cfb3dce4c83c51271f0e8cc820ae9780b7c42792f5313f49808bc0157c17096e6ef70113d81aecb4099fbbadfedb8be0d58bf80ed4afc5b649438b312ae32bf
7
- data.tar.gz: fdbff3d2478b97bbd61343a546615778d019ca05c0a77e081a7bff77746cefa4b2b6e66e63ef21d1a0c291edaf1f622c068d9a6991a2633e2fae2d409476df4b
6
+ metadata.gz: 83202af63f6dbe9be508f18ca160535414ba913b7789f1d379626d6346ef49e6346b8f5f3362af9fb05531b9be60d5c977f12a4894a49045ec0a3d7ab4973755
7
+ data.tar.gz: df40f7a748b0323b842bbb4fb041d33d42961f391620b03f553cd3927626b826066ee0473bac5a7d01704fabfee075d4af4b8de63e04f6ded1953058c8ae3746
data/.DS_Store CHANGED
Binary file
Binary file
@@ -15,17 +15,9 @@ class Libri::Book
15
15
  self.new(book_info_hash)
16
16
  }
17
17
  end
18
-
19
- def add_book_info(book_info_hash)
20
- book_info_hash.each { |key, val|
21
- send "#{key}=", val
22
- }
23
- self
24
- end
25
18
 
26
- def self.all
19
+ def self.all
27
20
  @@all
28
- end
29
-
21
+ end
30
22
 
31
23
  end
@@ -31,7 +31,7 @@ class Libri::CLI
31
31
  def call
32
32
  puts STRING
33
33
  puts SPACE
34
- puts "Welcome to Libri, a chamber full of literary wonders.".blue
34
+ puts "Welcome to Libri. I'm the Raven, your guide in this chamber full of literary wonders.".blue
35
35
  puts "Below are some of the most prized literary awards of our time.".blue
36
36
  puts "Come freely. This will take a few moments..".blue
37
37
  puts LINE
@@ -6,9 +6,6 @@ class Scraper
6
6
  html = "https://www.barnesandnoble.com/b/books/awards/_/N-29Z8q8Z1d6q"
7
7
  awards_page = Nokogiri::HTML(open(html))
8
8
 
9
- # awards.name = awards_page.css("ul#sidebar-section-0 li a").text
10
- # awards.url = awards_page.css("ul#sidebar-section-0 li a").attribute("href").value
11
-
12
9
  awards_array = []
13
10
  awards = {}
14
11
 
@@ -38,7 +35,8 @@ class Scraper
38
35
 
39
36
  books_array << books
40
37
  }
41
- books_array
38
+
39
+ books_array.uniq
42
40
  end
43
41
 
44
42
  def self.scrape_book(book)
@@ -52,7 +50,7 @@ class Scraper
52
50
  :title_by_author => info_section.css("div#productInfoOverview div.mb-m").text,
53
51
  :blurbs_and_plot => info_section.css("div#productInfoOverview p").map(&:text).join("\n").strip,
54
52
  :about_author => info_section.css("div#MeetTheAuthor div.text--medium").text.strip,
55
- :excerpt => info_section.xpath("//div[@class='read-an-excerpt']/p[not(@class) and position()<7]").map(&:text).join("\n"),
53
+ :excerpt => info_section.xpath("//div[@class='read-an-excerpt']/p[not(@class) and position()<5]").map(&:text).join("\n"),
56
54
  # :related_books => book_page.css("div.product-shelf-info").each { |book|
57
55
  # related_books_hash = {
58
56
  # :title => book.css("div.product-shelf-title").text.strip,
@@ -64,7 +62,7 @@ class Scraper
64
62
  :url => book[:url]
65
63
  }
66
64
 
67
- # book_info_hash.delete_if { |key, val| val.to_s.strip.empty? }
65
+ book_info_hash.delete_if { |key, val| val.to_s.strip.empty? }
68
66
 
69
67
  end
70
68
 
@@ -1,3 +1,3 @@
1
1
  module Libri
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - jouissances
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-26 00:00:00.000000000 Z
11
+ date: 2018-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -127,6 +127,7 @@ files:
127
127
  - lib/libri/quote.rb
128
128
  - lib/libri/scraper.rb
129
129
  - lib/libri/version.rb
130
+ - libri-0.2.2.gem
130
131
  - libri.gemspec
131
132
  - spec.md
132
133
  homepage: https://rubygems.org