Class: Avmtrf1::Tools::Runner::Forponto
- Inherits:
-
EacRubyUtils::Console::DocoptRunner
- Object
- EacRubyUtils::Console::DocoptRunner
- Avmtrf1::Tools::Runner::Forponto
show all
- Includes:
- EacRubyUtils::Console::Speaker, EacRubyUtils::SimpleCache
- 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
- DOC =
<<~DOCOPT
Operações para Forponto.
Usage:
__PROGRAM__ [options] __SUBCOMMANDS__
__PROGRAM__ -h | --help
Options:
-h --help Show this screen.
-u --url=<url> URL inicial.
-m --matricula=<matricula> Matrícula.
-c --codigo=<codigo> Código.
DOCOPT
Instance Method Summary
collapse
Instance Method Details
#attr_value(name, read_options = {}) ⇒ Object
45
46
47
|
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 45
def attr_value(name, read_options = {})
value_by_option(name) || value_by_default(name) || value_by_entry(name, read_options)
end
|
#codigo ⇒ Object
73
74
75
|
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 73
def codigo
attr_value(__method__, noecho: true)
end
|
#matricula ⇒ Object
69
70
71
|
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 69
def matricula
attr_value(__method__)
end
|
#run ⇒ Object
35
36
37
38
|
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 35
def run
start_banner
run_with_subcommand
end
|
#start_banner ⇒ Object
40
41
42
43
|
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 40
def start_banner
infov 'URL', user.url
infov 'Matrícula', user.matricula
end
|
#url ⇒ Object
65
66
67
|
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 65
def url
attr_value(__method__)
end
|
#user_uncached ⇒ Object
61
62
63
|
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 61
def user_uncached
::Avmtrf1::Forponto::User.new(url, matricula, codigo)
end
|
#value_by_default(name) ⇒ Object
53
54
55
|
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 53
def value_by_default(name)
DEFAULT_VALUES[name.to_sym]
end
|
#value_by_entry(name, read_options) ⇒ Object
57
58
59
|
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 57
def value_by_entry(name, read_options)
::Avmtrf1.configs.read_entry("trf1.forponto.#{name}", read_options)
end
|
#value_by_option(name) ⇒ Object
49
50
51
|
# File 'lib/avmtrf1/tools/runner/forponto.rb', line 49
def value_by_option(name)
options.fetch("--#{name}")
end
|