Sha256: 159fe1b7f23d9a9a6a192710c5a835a8e5558e26d122bd31bce33977a0c3dfa5

Contents?: true

Size: 455 Bytes

Versions: 5

Compression:

Stored size: 455 Bytes

Contents

module AmazonAuth
  module SessionExtension

    def doc
      Nokogiri.HTML(session.html)
    end

    def links_for(selector, options = {})
      wait_for_selector(selector, options)
      doc.css(selector).map{|e| e['href'] }
    end

    def wait_for_selector(selector, options = {})
      options.fetch(:wait_time, 3).times do
        if session.first(selector)
          break
        else
          sleep(1)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
amazon_auth-0.3.3 lib/amazon_auth/extensions/session_extension.rb
amazon_auth-0.3.2 lib/amazon_auth/extensions/session_extension.rb
amazon_auth-0.3.1 lib/amazon_auth/extensions/session_extension.rb
amazon_auth-0.3.0 lib/amazon_auth/extensions/session_extension.rb
amazon_auth-0.2.1 lib/amazon_auth/extensions/session_extension.rb