Class: ARBookFinder::Scraper
- Inherits:
-
Object
- Object
- ARBookFinder::Scraper
- Defined in:
- lib/ar_book_finder/scraper.rb
Instance Method Summary collapse
- #collection(collection, page = 1) ⇒ Object
-
#initialize(user_type) ⇒ Scraper
constructor
A new instance of Scraper.
- #search(query, page = 1) ⇒ Object
Constructor Details
#initialize(user_type) ⇒ Scraper
Returns a new instance of Scraper.
3 4 5 |
# File 'lib/ar_book_finder/scraper.rb', line 3 def initialize(user_type) UserTypeProcessor.new(user_type).process end |
Instance Method Details
#collection(collection, page = 1) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/ar_book_finder/scraper.rb', line 16 def collection(collection, page = 1) CollectionProcessor.new(collection).process results = SearchResultsParser.new(Capybara.page.html, true).parse if page > 1 results = paginate(page, true) end results end |
#search(query, page = 1) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/ar_book_finder/scraper.rb', line 7 def search(query, page = 1) QuickSearchProcessor.new(query).process results = SearchResultsParser.new(Capybara.page.html).parse if page > 1 results = paginate(page, false) end results end |