Class: ARBookFinder::PaginationProcessor

Inherits:
Object
  • Object
show all
Includes:
Capybara::DSL
Defined in:
lib/ar_book_finder/pagination_processor.rb

Constant Summary collapse

SEARCH_GOTO_FIELD =
'ctl00_ContentPlaceHolder1_ucSeachResults_txtPageToGoToTop'
SEARCH_SUBMIT_BUTTON =
'ctl00_ContentPlaceHolder1_ucSeachResults_btnGoToPageTop'
COLLECTION_GOTO_FIELD =
'ctl00_ContentPlaceHolder1_ucCollection_ucSeachResults_txtPageToGoToTop'
COLLECTION_SUBMIT_BUTTON =
'ctl00_ContentPlaceHolder1_ucCollection_ucSeachResults_btnGoToPageTop'

Instance Method Summary collapse

Constructor Details

#initialize(page, collection = false) ⇒ PaginationProcessor

Returns a new instance of PaginationProcessor.



11
12
13
14
# File 'lib/ar_book_finder/pagination_processor.rb', line 11

def initialize(page, collection = false)
  @page = page
  @field_const = collection ? :COLLECTION : :SEARCH
end

Instance Method Details

#processObject



16
17
18
19
# File 'lib/ar_book_finder/pagination_processor.rb', line 16

def process
  fill_in(self.class.const_get(:"#{@field_const}_GOTO_FIELD"), with: @page)
  click_button(self.class.const_get(:"#{@field_const}_SUBMIT_BUTTON"))
end