Sha256: 15cfb915a085fdadda8f26dcdc27dae8ee2dc26ee117ba4e58645fb5b4dbddf2

Contents?: true

Size: 638 Bytes

Versions: 3

Compression:

Stored size: 638 Bytes

Contents

class Libri::Books
    attr_accessor :award, :url

    def self.scrape_award(award)
        html = award[:url]
        books_page = Nokogiri::HTML(open(html))

        books_array = []
        books = {}

        books_page.css("div.product-shelf-info").take(20).each { |book|
            books = {
                :title => book.css("div.product-shelf-title").text.strip,
                :author => book.css("div.product-shelf-author").text.strip,
                :url => "https://www.barnesandnoble.com" + book.css("a").attribute("href").value
            } 

            books_array << books
        }
        books_array
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
libri-0.2.1 lib/libri/books.rb
libri-0.1.1 lib/libri/books.rb
libri-0.1.0 lib/libri/books.rb