Class: Stratagem::SiteCrawler
- Includes:
- Crawler::Session
- Defined in:
- lib/stratagem/site_crawler.rb
Constant Summary
Constants included from Crawler::RouteInvoker
Crawler::RouteInvoker::IGNORE_PARAMETERS
Constants included from Crawler::HtmlUtils
Crawler::HtmlUtils::INPUT_BUTTON, Crawler::HtmlUtils::INPUT_RADIO, Crawler::HtmlUtils::INPUT_TEXT, Crawler::HtmlUtils::INPUT_TOGGLE
Instance Attribute Summary collapse
-
#form ⇒ Object
Returns the value of attribute form.
-
#login_page ⇒ Object
Returns the value of attribute login_page.
-
#response_page ⇒ Object
Returns the value of attribute response_page.
-
#ssl ⇒ Object
Returns the value of attribute ssl.
-
#success ⇒ Object
Returns the value of attribute success.
Attributes included from Crawler::Session
Instance Method Summary collapse
- #export ⇒ Object
-
#initialize(application_model) ⇒ SiteCrawler
constructor
A new instance of SiteCrawler.
- #run ⇒ Object
Methods included from Crawler::Session
#app, #application_model, #crawl, #crawler_session, #log, #page_set, #parameter_types, #print, #redirect_proc, #session_controller, #site_model, #site_models
Methods included from Crawler::RouteInvoker
#call_route, #call_route!, #do_get, #do_post, #do_put, #visit
Methods included from Crawler::ParameterResolver
#resolve_id_with_convention, #resolve_parameter_types, #resolve_with_convention, #resolve_with_instrumentation
Methods included from Crawler::Authentication
#authenticate, #authentication, #find_login_form, #guess_login_model, #login, #logout, #populate_login_form, #reset_authentication, #user_model, #users
Methods included from Crawler::TraceUtils
#model_invocations_for_request
Methods included from Crawler::HtmlUtils
#find_login_form, #parse_forms
Constructor Details
#initialize(application_model) ⇒ SiteCrawler
Returns a new instance of SiteCrawler.
5 6 7 |
# File 'lib/stratagem/site_crawler.rb', line 5 def initialize(application_model) @application_model = application_model end |
Instance Attribute Details
#form ⇒ Object
Returns the value of attribute form.
43 44 45 |
# File 'lib/stratagem/site_crawler.rb', line 43 def form @form end |
#login_page ⇒ Object
Returns the value of attribute login_page.
43 44 45 |
# File 'lib/stratagem/site_crawler.rb', line 43 def login_page @login_page end |
#response_page ⇒ Object
Returns the value of attribute response_page.
43 44 45 |
# File 'lib/stratagem/site_crawler.rb', line 43 def response_page @response_page end |
#ssl ⇒ Object
Returns the value of attribute ssl.
43 44 45 |
# File 'lib/stratagem/site_crawler.rb', line 43 def ssl @ssl end |
#success ⇒ Object
Returns the value of attribute success.
43 44 45 |
# File 'lib/stratagem/site_crawler.rb', line 43 def success @success end |
Instance Method Details
#export ⇒ Object
36 37 38 39 40 41 |
# File 'lib/stratagem/site_crawler.rb', line 36 def export puts "\tmapping #{site_models.size} page sets" { :page_sets_attributes => site_models.map {|site_model| site_model.export } } end |
#run ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/stratagem/site_crawler.rb', line 9 def run crawler_session(@application_model) do log "crawling site" page_set(:unauthenticated) do |pages| crawl print end users.slice(0,10).each do |user| page_set("user_#{user.id}") do |pages| authenticate(user) do puts "authenticated with #{user.stratagem.mock_attributes.inspect}" crawl crawl([:put, :post]) end end end end self rescue Exception Stratagem.error($!) puts $! puts $!.backtrace end |