Class: Stratagem::Crawler::SiteModel
- Includes:
- HtmlUtils
- Defined in:
- lib/stratagem/crawler/site_model.rb
Constant Summary
Constants included from HtmlUtils
HtmlUtils::INPUT_BUTTON, HtmlUtils::INPUT_RADIO, HtmlUtils::INPUT_TEXT, HtmlUtils::INPUT_TOGGLE
Instance Attribute Summary collapse
-
#authentication ⇒ Object
Returns the value of attribute authentication.
-
#edges ⇒ Object
readonly
Returns the value of attribute edges.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#pages ⇒ Object
readonly
Returns the value of attribute pages.
Instance Method Summary collapse
- #add(route, controller, request, response, invocations = [], model_changes = {}, &block) ⇒ Object
- #add_edge(from, to, type) ⇒ Object
- #export ⇒ Object
-
#initialize(name) ⇒ SiteModel
constructor
A new instance of SiteModel.
- #pages_for(id) ⇒ Object
Methods included from HtmlUtils
#find_login_form, #parse_forms
Constructor Details
#initialize(name) ⇒ SiteModel
Returns a new instance of SiteModel.
8 9 10 11 12 |
# File 'lib/stratagem/crawler/site_model.rb', line 8 def initialize(name) @name = name @pages = [] @edges = [] end |
Instance Attribute Details
#authentication ⇒ Object
Returns the value of attribute authentication.
6 7 8 |
# File 'lib/stratagem/crawler/site_model.rb', line 6 def authentication @authentication end |
#edges ⇒ Object (readonly)
Returns the value of attribute edges.
5 6 7 |
# File 'lib/stratagem/crawler/site_model.rb', line 5 def edges @edges end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/stratagem/crawler/site_model.rb', line 5 def name @name end |
#pages ⇒ Object (readonly)
Returns the value of attribute pages.
5 6 7 |
# File 'lib/stratagem/crawler/site_model.rb', line 5 def pages @pages end |
Instance Method Details
#add(route, controller, request, response, invocations = [], model_changes = {}, &block) ⇒ Object
32 33 34 35 36 |
# File 'lib/stratagem/crawler/site_model.rb', line 32 def add(route, controller, request, response, invocations=[], model_changes={}, &block) page = Page.new(self, controller, request, response, invocations, model_changes, &block) self.pages << page page end |
#add_edge(from, to, type) ⇒ Object
28 29 30 |
# File 'lib/stratagem/crawler/site_model.rb', line 28 def add_edge(from,to,type) self.edges << Edge.new(from,to,type) end |
#export ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/stratagem/crawler/site_model.rb', line 14 def export { :name => name, :pages => @pages.map {|page| page.export }, :edges => @edges.map {|edge| edge.export }, :authentication => authentication.nil? ? nil : { :success => authentication.success, :login_page_external_id => authentication.login_page.object_id, :response_page_external_id => authentication.response_page.object_id, :ssl => authentication.ssl }, } end |