Sha256: 0ecc948a52bd3188507c9561fe3131ce5b5a38c5d56c6c6b8e66a5ad4e2fa8be

Contents?: true

Size: 653 Bytes

Versions: 2

Compression:

Stored size: 653 Bytes

Contents

module ARBookFinder
  class CollectionProcessor
    include Capybara::DSL
    
    COLLECTIONS_URL = "#{ARBookFinder::BASE_URL}/collections.aspx"
    
    def initialize(collections)
      @collections = collections
    end
    
    def process
      unless current_url.downcase == COLLECTIONS_URL
        visit(COLLECTIONS_URL)
      end
      navigate_collection(@collections)
    end
    
    private
    def navigate_collection(collection)
      collection.each do |key, value|
        click_on(key)
        if value.kind_of?(Hash)
          navigate_collection(value)
        else
          click_on(value)
        end  
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ar_book_finder-1.1.1 lib/ar_book_finder/collection_processor.rb
ar_book_finder-1.1.0 lib/ar_book_finder/collection_processor.rb