avmtrf1-tools 0.26.0 → 0.27.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fc536ae35fea31a81dcf588d028a691b22ef255652395556e9d5df4b18f9a86
4
- data.tar.gz: fe45a68ece7117513a30b34c9f52b842339a916b4f5d7c2aa4ab6632b4ee0762
3
+ metadata.gz: 10d3b52fd72e610bdf5a2024f9c470515fb80ba2c561ee9c0034de160dbce8ba
4
+ data.tar.gz: 1bd4ba694ce3fb8882eef48c67decddf0e3cf3e06047034206af840b95f0fdd5
5
5
  SHA512:
6
- metadata.gz: 3bc133b27c48f0926c2b7afbc096313e5658f58a04bae3b32f9d9e9f1798a0463ecae8fcfab9f3a6a489f48a6675cfae2878a4f242798cbfcafcff0c283f4a61
7
- data.tar.gz: 790921a5e68cc1731ddbe2f79569a983543b2d4f3db2a96e2a2d643004610f2aa90bc030bcd24a15bfa9bb66983afeb5f389676f17bb0bb5493aea1f841c7bb2
6
+ metadata.gz: bb87800657023bd8db9b1b2ed1934ad3ba963fa6d8a529ed5ce552667a34563f84096f1e03f903be7ed633affa9a7a4ffdc31eaf75ebd9a693cd3b75f93ba983
7
+ data.tar.gz: 199c3a3168c1746edfca9156c5b9550ecb52d6e7502aaa204ab6d1c5a1759521e77f055ff079583449acd4182bbb2012490e97b168f331f3720f2abb57253a7a
@@ -6,8 +6,12 @@ require 'avmtrf1/ad_user'
6
6
  module Avmtrf1
7
7
  class << self
8
8
  def default_esosti
9
- @default_esosti ||= ::Avmtrf1::Esosti::Instance.new(
10
- 'https://esosti.trf1.jus.br',
9
+ @default_esosti ||= trf1_esosti('https://esosti.trf1.jus.br')
10
+ end
11
+
12
+ def trf1_esosti(url)
13
+ ::Avmtrf1::Esosti::Instance.new(
14
+ url,
11
15
  "#{::Avmtrf1.ad_user.username}@#{::Avmtrf1.ad_user.domain.downcase}.gov.br",
12
16
  ::Avmtrf1.ad_user.password
13
17
  )
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/console/speaker'
5
- require 'eac_ruby_utils/simple_cache'
4
+ require 'eac_ruby_utils/core_ext'
6
5
  require 'avmtrf1/default_esosti'
7
6
  require 'avmtrf1/ini'
8
7
  require 'avmtrf1/red/profile'
@@ -11,8 +10,8 @@ module Avmtrf1
11
10
  module Tools
12
11
  class Runner < ::EacRubyUtils::Console::DocoptRunner
13
12
  class Esosti < ::EacRubyUtils::Console::DocoptRunner
14
- include ::EacRubyUtils::Console::Speaker
15
- include ::EacRubyUtils::SimpleCache
13
+ enable_console_speaker
14
+ enable_simple_cache
16
15
 
17
16
  DOC = <<~DOCOPT
18
17
  Utilidades para e-Sosti (Control Desk).
@@ -22,8 +21,9 @@ module Avmtrf1
22
21
  __PROGRAM__ -h | --help
23
22
 
24
23
  Options:
25
- -h --help Mostra esta ajuda.
26
- -u --user Usuário no e-Sosti.
24
+ -h --help Mostra esta ajuda.
25
+ -u --user Usuário no e-Sosti.
26
+ -U --url=<url> Utiliza o Control Desk em <url>.
27
27
  DOCOPT
28
28
 
29
29
  def run
@@ -34,12 +34,24 @@ module Avmtrf1
34
34
  end
35
35
  end
36
36
 
37
+ private
38
+
39
+ def esosti_instance_uncached
40
+ options.fetch('--url').if_present(::Avmtrf1.default_esosti) do |url|
41
+ ::Avmtrf1.trf1_esosti(url)
42
+ end
43
+ end
44
+
37
45
  def fetch
38
- infom "Recuperando informações de #{options.fetch('<solicitacao_id>')}..."
39
- issue = ::Avmtrf1.default_esosti.issue(options.fetch('<solicitacao_id>'))
40
- fatal_error("Issue não encontrado: #{options.fetch('<solicitacao_id>')}") unless issue
46
+ infom "Recuperando informações de #{solicitacao_id}..."
47
+ issue = esosti_instance.issue(solicitacao_id)
48
+ fatal_error("Issue não encontrado: #{solicitacao_id}") unless issue
41
49
  out issue.data.to_yaml
42
50
  end
51
+
52
+ def solicitacao_id
53
+ options.fetch('<solicitacao_id>')
54
+ end
43
55
  end
44
56
  end
45
57
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avmtrf1
4
4
  module Tools
5
- VERSION = '0.26.0'
5
+ VERSION = '0.27.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avmtrf1-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.0
4
+ version: 0.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo H. Bogoni
@@ -236,7 +236,6 @@ files:
236
236
  - lib/avmtrf1/esosti/entities.rb
237
237
  - lib/avmtrf1/esosti/entities/issue.rb
238
238
  - lib/avmtrf1/esosti/instance.rb
239
- - lib/avmtrf1/esosti/parsers/solicitacao/main.rb
240
239
  - lib/avmtrf1/esosti/session.rb
241
240
  - lib/avmtrf1/esosti/session/action_base.rb
242
241
  - lib/avmtrf1/esosti/session/atividades.rb
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_support/core_ext/object' # To-to: declare in gem "aranha"
4
- require 'active_support/core_ext/string' # To-to: declare in gem "aranha"
5
- require 'aranha/parsers/html/item'
6
- require 'nokogiri' # To-to: declare in gem "aranha"
7
-
8
- module Avmtrf1
9
- module Esosti
10
- module Parsers
11
- module Solicitacao
12
- class Main < ::Aranha::Parsers::Html::Item
13
- field :pessoa_afetada_email, :string,
14
- '//input[@type="text" and ' \
15
- 'following-sibling::img[contains(@aria-label, "Pessoa Afetada")]]/@value'
16
-
17
- def item_xpath; end
18
- end
19
- end
20
- end
21
- end
22
- end