Class: Avmtrf1::Tools::Runner::Forponto

Inherits:
Object
  • Object
show all
Defined in:
lib/avmtrf1/tools/runner/forponto.rb,
lib/avmtrf1/tools/runner/forponto/saldo.rb,
lib/avmtrf1/tools/runner/forponto/espelho.rb,
lib/avmtrf1/tools/runner/forponto/resumos.rb,
lib/avmtrf1/tools/runner/forponto/marcacoes.rb

Defined Under Namespace

Classes: Espelho, Marcacoes, Resumos, Saldo

Constant Summary collapse

DEFAULT_VALUES =
{
  url: 'http://pontoeletronico.trf1.jus.br/forponto/fptoweb.exe'
}.freeze

Instance Method Summary collapse

Instance Method Details

#attr_value(name, read_options = {}) ⇒ Object



35
36
37
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 35

def attr_value(name, read_options = {})
  value_by_option(name) || value_by_default(name) || value_by_entry(name, read_options)
end

#codigoObject



63
64
65
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 63

def codigo
  attr_value(__method__, noecho: true)
end

#matriculaObject



59
60
61
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 59

def matricula
  attr_value(__method__)
end

#runObject



25
26
27
28
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 25

def run
  start_banner
  run_with_subcommand
end

#start_bannerObject



30
31
32
33
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 30

def start_banner
  infov 'URL', user.url
  infov 'MatrĂ­cula', user.matricula
end

#urlObject



55
56
57
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 55

def url
  attr_value(__method__)
end

#user_uncachedObject



51
52
53
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 51

def user_uncached
  ::Avmtrf1::Forponto::User.new(url, matricula, codigo)
end

#value_by_default(name) ⇒ Object



43
44
45
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 43

def value_by_default(name)
  DEFAULT_VALUES[name.to_sym]
end

#value_by_entry(name, read_options) ⇒ Object



47
48
49
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 47

def value_by_entry(name, read_options)
  ::EacConfig::Node.context.current.entry("trf1.forponto.#{name}", read_options).value
end

#value_by_option(name) ⇒ Object



39
40
41
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 39

def value_by_option(name)
  parsed.fetch(name)
end