Class: Avmtrf1::Forponto::Session

Inherits:
Object
  • Object
show all
Includes:
DayRegisters, Interval, Login
Defined in:
lib/avmtrf1/forponto/session.rb,
lib/avmtrf1/forponto/session/login.rb,
lib/avmtrf1/forponto/session/interval.rb,
lib/avmtrf1/forponto/session/day_registers.rb

Defined Under Namespace

Modules: DayRegisters, Interval, Login

Constant Summary

Constants included from DayRegisters

DayRegisters::MARCACOES_DO_DIA_VALUE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Login

#login

Methods included from Interval

#interval_data

Methods included from DayRegisters

#day_registers_data

Constructor Details

#initialize(root_url, matricula, codigo) ⇒ Session

Returns a new instance of Session.


16
17
18
19
20
21
22
23
# File 'lib/avmtrf1/forponto/session.rb', line 16

def initialize(root_url, matricula, codigo)
  @root_url = root_url
  @matricula = matricula
  @codigo = codigo
  @sub = ::Aranha::Selenium::Session.new(
    user_agent: 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko'
  )
end

Instance Attribute Details

#codigoObject (readonly)

Returns the value of attribute codigo.


14
15
16
# File 'lib/avmtrf1/forponto/session.rb', line 14

def codigo
  @codigo
end

#matriculaObject (readonly)

Returns the value of attribute matricula.


14
15
16
# File 'lib/avmtrf1/forponto/session.rb', line 14

def matricula
  @matricula
end

#root_urlObject (readonly)

Returns the value of attribute root_url.


14
15
16
# File 'lib/avmtrf1/forponto/session.rb', line 14

def root_url
  @root_url
end

#subObject (readonly)

Returns the value of attribute sub.


14
15
16
# File 'lib/avmtrf1/forponto/session.rb', line 14

def sub
  @sub
end

Instance Method Details

#parser_data(parser_class, source_code) ⇒ Object


25
26
27
28
29
# File 'lib/avmtrf1/forponto/session.rb', line 25

def parser_data(parser_class, source_code)
  tempfile = '/tmp/forponto.html'
  ::File.write(tempfile, source_code)
  parser_class.new("file://#{tempfile}").data
end