Class: Markify::Scraper::Hbrs

Inherits:
Base
  • Object
show all
Defined in:
lib/markify/scraper/hbrs.rb

Overview

Copyright Daniel Meißner <[email protected]>, 2013

This file is part of Markify.

Markify is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Markify is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Markify. If not, see <www.gnu.org/licenses/>.

Instance Attribute Summary

Attributes inherited from Base

#marks

Instance Method Summary collapse

Methods inherited from Base

#scrape!

Constructor Details

#initialize(login_name, login_password) ⇒ Hbrs

Returns a new instance of Hbrs.



23
24
25
26
27
28
# File 'lib/markify/scraper/hbrs.rb', line 23

def initialize(, )
  super(,
        ,
        'https://dias.fh-bonn-rhein-sieg.de/d3/SISEgo.asp?UserAcc=Gast&DokID=DiasSWeb&ADias2Dction=Login'
  )
end

Instance Method Details

#test_loginObject



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/markify/scraper/hbrs.rb', line 30

def 
   = @agent.get(@data[:login_page])
  error_page = (@data[:login_name], @data[:login_password], )

  if error_page.search(".//*[@id='inhalt']/table/tbody/tr/td/form/center/table/tr[3]/td").text =~
      /Benutzername unbekannt oder falsches Kennwort eingegeben!/
    puts "Scraper: Username and password wrong."
  else
    puts "Scraper: Login works."
  end
end