ehbrs_ruby_utils 0.12.1 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ehbrs_ruby_utils/fs/selected.rb +11 -1
- data/lib/ehbrs_ruby_utils/music/lyrics_book.rb +1 -1
- data/lib/ehbrs_ruby_utils/version.rb +1 -1
- data/lib/ehbrs_ruby_utils/videos/convert_job.rb +2 -1
- data/lib/ehbrs_ruby_utils/videos/stream.rb +4 -0
- data/lib/ehbrs_ruby_utils/web_utils/instance/finances/bills/consume/file.rb +73 -0
- data/lib/ehbrs_ruby_utils/web_utils/instance/finances/bills/consume.rb +28 -0
- data/lib/ehbrs_ruby_utils/web_utils/instance/finances/bills.rb +38 -0
- data/lib/ehbrs_ruby_utils/web_utils/instance/finances.rb +22 -0
- data/lib/ehbrs_ruby_utils/web_utils/instance.rb +7 -1
- data/spec/lib/ehbrs_ruby_utils/videos/stream_spec.rb +1 -1
- data/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_attachment.target.yaml +1 -0
- data/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_audio.target.yaml +1 -0
- data/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_subtitle.target.yaml +1 -0
- data/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_video.target.yaml +1 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1b4304692f05e5e54ceb820c286af557d625f2c387c88b413f79cadf23a6da2
|
4
|
+
data.tar.gz: a09d3e1bd870a882c541b161cdba964de47454cac366f5dcbc1ba905246d2d7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a205eed1a3e4659a457f57ad3f0b6965fc02e5a2105fe6dbac1adc9ac714798ba1db424024d34d1ba15cd9b04a367c853765bbdcbcdaa8714289e6c8035be1c1
|
7
|
+
data.tar.gz: f8dbde785c72cfb1641881de9d193079bbec210f9c77f33710519ada3fc8775f29a49eb7634efe295a4b20af8ef06fdbb40323989dffb5740b1897720779ab57
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_fs/traverser'
|
3
4
|
require 'eac_ruby_utils/core_ext'
|
4
5
|
|
5
6
|
module EhbrsRubyUtils
|
@@ -28,7 +29,16 @@ module EhbrsRubyUtils
|
|
28
29
|
|
29
30
|
# @return [Pathname]
|
30
31
|
def found_uncached
|
31
|
-
|
32
|
+
r = []
|
33
|
+
ft = ::EacFs::Traverser.new(
|
34
|
+
recursive: true,
|
35
|
+
hidden_directories: true,
|
36
|
+
check_file: lambda do |file|
|
37
|
+
r << file.parent if file.basename.to_path == filename.to_s
|
38
|
+
end
|
39
|
+
)
|
40
|
+
ft.check_path(root_path)
|
41
|
+
r.sort
|
32
42
|
end
|
33
43
|
end
|
34
44
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/instances/base'
|
4
|
+
require 'avm/result'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module EhbrsRubyUtils
|
8
|
+
module WebUtils
|
9
|
+
class Instance < ::Avm::Instances::Base
|
10
|
+
class Finances
|
11
|
+
class Bills
|
12
|
+
class Consume
|
13
|
+
class File
|
14
|
+
enable_speaker
|
15
|
+
enable_simple_cache
|
16
|
+
common_constructor(:bills, :path) { perform }
|
17
|
+
delegate :instance, to: :bills
|
18
|
+
|
19
|
+
protected
|
20
|
+
|
21
|
+
def perform
|
22
|
+
infov 'Relative path', relative_path
|
23
|
+
process_response
|
24
|
+
end
|
25
|
+
|
26
|
+
def relative_path
|
27
|
+
path.relative_path_from(bills.pending_directory.to_path)
|
28
|
+
end
|
29
|
+
|
30
|
+
def process_response
|
31
|
+
if response_status_result.success?
|
32
|
+
move_to_registered
|
33
|
+
else
|
34
|
+
warn(" * Retornou com status de erro:\n\n#{response.body}")
|
35
|
+
end
|
36
|
+
infov ' * Response status', response_status_result.label
|
37
|
+
end
|
38
|
+
|
39
|
+
def move_to_registered
|
40
|
+
::FileUtils.mkdir_p(::File.dirname(target_path))
|
41
|
+
::File.rename(path, target_path)
|
42
|
+
end
|
43
|
+
|
44
|
+
def target_path
|
45
|
+
::File.join(bills.registered_directory, relative_path)
|
46
|
+
end
|
47
|
+
|
48
|
+
def response_uncached
|
49
|
+
bills.instance.http_request(
|
50
|
+
'/finances/file_imports',
|
51
|
+
method: :post,
|
52
|
+
body: {
|
53
|
+
'record[file]' => ::File.new(path)
|
54
|
+
},
|
55
|
+
header: {
|
56
|
+
'Accept' => 'application/json'
|
57
|
+
}
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
def response_status_result
|
62
|
+
::Avm::Result.success_or_error(
|
63
|
+
response.status.to_s.match?(/\A2\d{2}\z/),
|
64
|
+
response.status
|
65
|
+
)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/instances/base'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module EhbrsRubyUtils
|
7
|
+
module WebUtils
|
8
|
+
class Instance < ::Avm::Instances::Base
|
9
|
+
class Finances
|
10
|
+
class Bills
|
11
|
+
class Consume
|
12
|
+
require_sub __FILE__
|
13
|
+
common_constructor(:bills)
|
14
|
+
delegate :instance, :pending_directory, :registered_directory, to: :bills
|
15
|
+
|
16
|
+
def perform
|
17
|
+
bills.pending_directory.glob('**/*').each do |path|
|
18
|
+
next unless path.file?
|
19
|
+
|
20
|
+
::EhbrsRubyUtils::WebUtils::Instance::Finances::Bills::Consume::File.new(self, path)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/instances/base'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module EhbrsRubyUtils
|
7
|
+
module WebUtils
|
8
|
+
class Instance < ::Avm::Instances::Base
|
9
|
+
class Finances
|
10
|
+
class Bills
|
11
|
+
require_sub __FILE__
|
12
|
+
common_constructor :finances
|
13
|
+
delegate :instance, to: :finances
|
14
|
+
|
15
|
+
# @return [Pathname]
|
16
|
+
def bills_directory(suffix)
|
17
|
+
instance.read_entry('finances.bills.directory').to_pathname.join(suffix)
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [EhbrsRubyUtils::WebUtils::Instance::Finances::Bills::Consume]
|
21
|
+
def consume
|
22
|
+
::EhbrsRubyUtils::WebUtils::Instance::Finances::Bills::Consume.new(self)
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [Pathname]
|
26
|
+
def pending_directory
|
27
|
+
bills_directory('pending')
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [Pathname]
|
31
|
+
def registered_directory
|
32
|
+
bills_directory('registered')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/instances/base'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module EhbrsRubyUtils
|
7
|
+
module WebUtils
|
8
|
+
class Instance < ::Avm::Instances::Base
|
9
|
+
class Finances
|
10
|
+
require_sub __FILE__
|
11
|
+
enable_simple_cache
|
12
|
+
common_constructor :instance
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def bills_uncached
|
17
|
+
::EhbrsRubyUtils::WebUtils::Instance::Finances::Bills.new(self)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -7,8 +7,14 @@ require 'httpclient'
|
|
7
7
|
module EhbrsRubyUtils
|
8
8
|
module WebUtils
|
9
9
|
class Instance < ::Avm::Instances::Base
|
10
|
+
require_sub __FILE__
|
11
|
+
|
12
|
+
def finances
|
13
|
+
@finances ||= ::EhbrsRubyUtils::WebUtils::Instance::Finances.new(self)
|
14
|
+
end
|
15
|
+
|
10
16
|
def root_url
|
11
|
-
read_entry(
|
17
|
+
read_entry(::Avm::Instances::EntryKeys::WEB_URL)
|
12
18
|
end
|
13
19
|
|
14
20
|
def resource_url(resource_url_suffix)
|
@@ -7,7 +7,7 @@ RSpec.describe ::EhbrsRubyUtils::Videos::Stream do
|
|
7
7
|
|
8
8
|
def source_data(source_file)
|
9
9
|
instance = described_class.new(::YAML.load_file(source_file))
|
10
|
-
%w[codec_name codec_long_name codec_type index language title]
|
10
|
+
%w[codec_name codec_long_name codec_type index language language_with_title title]
|
11
11
|
.map { |k| [k.to_sym, instance.send(k)] }.sort.to_h
|
12
12
|
end
|
13
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ehbrs_ruby_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo H. Bogoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -188,6 +188,10 @@ files:
|
|
188
188
|
- lib/ehbrs_ruby_utils/videos/stream.rb
|
189
189
|
- lib/ehbrs_ruby_utils/web_utils.rb
|
190
190
|
- lib/ehbrs_ruby_utils/web_utils/instance.rb
|
191
|
+
- lib/ehbrs_ruby_utils/web_utils/instance/finances.rb
|
192
|
+
- lib/ehbrs_ruby_utils/web_utils/instance/finances/bills.rb
|
193
|
+
- lib/ehbrs_ruby_utils/web_utils/instance/finances/bills/consume.rb
|
194
|
+
- lib/ehbrs_ruby_utils/web_utils/instance/finances/bills/consume/file.rb
|
191
195
|
- lib/ehbrs_ruby_utils/web_utils/videos.rb
|
192
196
|
- lib/ehbrs_ruby_utils/web_utils/videos/file.rb
|
193
197
|
- lib/ehbrs_ruby_utils/web_utils/videos/file/rename.rb
|