ehbrs_ruby_utils 0.19.0 → 0.20.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: 5b5a4ff5b36fa6184fe024c0dd3c31514b03656e9f31fc8f9d680bc0d71a46f6
4
- data.tar.gz: 168d749fb34a32df6e65e31ffca81ded6123b7b96e79e74b60d2d7f749800fd6
3
+ metadata.gz: dd6cda8266cb8a597f2a1c3847fca05b4002a9d387feae26339a1e9d808191d6
4
+ data.tar.gz: b69eab41353b59a452dbb4a44a23e54fc9c34458902d4e48e1d1dc423a1e63c0
5
5
  SHA512:
6
- metadata.gz: 86ede6154dc60b53a6fc4b871782be51e9f88e8abefd4ed82f0d8237e8e71935ac69b62406d00cee10c05090051e04deca3106ca3a57f2ec372bc8c97bfe3d84
7
- data.tar.gz: 47bf252d71924e6f385ff8b9d99013475ddeda2e9975c49a913abcfcd84ad109ade0beff12e13781b80151c127d453ee33891891533e786d98f9726384e51ca6
6
+ metadata.gz: ced46b8aa2ebecd983986c3f6ff6e386aeeb0e3741457933a8da7d24cc945bc743a75695aea753aff086a7fe536608edd0631b1f538ae62d4b05b13409de1ae1
7
+ data.tar.gz: '0673885d858f19ed325b95708c749e7b25cf20c0ac3f9b2e2a78cafb151c48b696f7ac1aa4534c9f81ac591b3e68714489f41f40982884bfb1ea39396fce96a7'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EhbrsRubyUtils
4
- VERSION = '0.19.0'
4
+ VERSION = '0.20.0'
5
5
  end
@@ -1,14 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_rest/api'
3
4
  require 'eac_ruby_utils/core_ext'
4
5
  require 'avm/instances/base'
5
- require 'httpclient'
6
6
 
7
7
  module EhbrsRubyUtils
8
8
  module WebUtils
9
9
  class Instance < ::Avm::Instances::Base
10
10
  require_sub __FILE__
11
11
 
12
+ # @return [EacRest::Api]
13
+ def api
14
+ ::EacRest::Api.new(root_url, read_entry(:admin_username), read_entry(:admin_password))
15
+ end
16
+
12
17
  def finances
13
18
  @finances ||= ::EhbrsRubyUtils::WebUtils::Instance::Finances.new(self)
14
19
  end
@@ -17,21 +22,26 @@ module EhbrsRubyUtils
17
22
  read_entry(::Avm::Instances::EntryKeys::WEB_URL)
18
23
  end
19
24
 
20
- def resource_url(resource_url_suffix)
21
- root_url + '/' + resource_url_suffix.gsub(%r{\A/+}, '')
22
- end
23
-
25
+ # @param resource_url_suffix [String]
26
+ # @param options [Hash]
27
+ # @return [EacRest::Response]
24
28
  def http_request(resource_url_suffix, options = {})
25
- method = options.delete(:method) || 'get'
26
- url = resource_url(resource_url_suffix)
27
- http_client.request(method, url, options)
29
+ options = http_request_options(options)
30
+ r = api.request(resource_url_suffix).verb(options.verb).headers(options.headers)
31
+ .body_data(options.body_data).response
32
+ ::Struct.new(:status, :body).new(r.status, r.body_str)
28
33
  end
29
34
 
30
- def http_client_uncached
31
- client = HTTPClient.new
32
- client.force_basic_auth = true
33
- client.set_basic_auth(root_url, read_entry(:admin_username), read_entry(:admin_password))
34
- client
35
+ private
36
+
37
+ # @return [::Struct.new(:verb, :body_data, :headers)]
38
+ def http_request_options(options)
39
+ options = options.to_options_consumer
40
+ verb = options.consume(:method, :get).to_sym
41
+ body_data = options.consume(:body)
42
+ headers = options.consume(:header)
43
+ options.validate
44
+ ::Struct.new(:verb, :body_data, :headers).new(verb, body_data, headers)
35
45
  end
36
46
  end
37
47
  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.19.0
4
+ version: 0.20.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: 2023-01-26 00:00:00.000000000 Z
11
+ date: 2023-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha
@@ -16,34 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.18'
19
+ version: '0.19'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.18'
26
+ version: '0.19'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: aranha-parsers
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.14'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 0.14.4
33
+ version: '0.15'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - "~>"
42
39
  - !ruby/object:Gem::Version
43
- version: '0.14'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 0.14.4
40
+ version: '0.15'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: avm
49
43
  requirement: !ruby/object:Gem::Requirement
@@ -78,14 +72,14 @@ dependencies:
78
72
  requirements:
79
73
  - - "~>"
80
74
  - !ruby/object:Gem::Version
81
- version: '0.111'
75
+ version: '0.112'
82
76
  type: :runtime
83
77
  prerelease: false
84
78
  version_requirements: !ruby/object:Gem::Requirement
85
79
  requirements:
86
80
  - - "~>"
87
81
  - !ruby/object:Gem::Version
88
- version: '0.111'
82
+ version: '0.112'
89
83
  - !ruby/object:Gem::Dependency
90
84
  name: eac_templates
91
85
  requirement: !ruby/object:Gem::Requirement
@@ -304,30 +298,30 @@ signing_key:
304
298
  specification_version: 4
305
299
  summary: Utilities for EHB/RS's Ruby projects.
306
300
  test_files:
307
- - spec/spec_helper.rb
301
+ - spec/rubocop_check_spec.rb
308
302
  - spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec.rb
303
+ - spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/minimum.target.yaml
304
+ - spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/ehbrs_music1.source.yaml
305
+ - spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/minimum.source.yaml
306
+ - spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/ehbrs_music1.target.yaml
307
+ - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/title_spec_files/countepart.target.yaml
308
+ - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/title_spec_files/countepart.source.html
309
+ - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/title_spec.rb
310
+ - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec.rb
311
+ - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/counterpart_s01e01.source.html
312
+ - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/wire-season-1-page-1.target.yaml
313
+ - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/wire-season-1-page-1.source.html
314
+ - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/counterpart_s01e01.target.yaml
315
+ - spec/lib/ehbrs_ruby_utils/videos/stream_spec.rb
316
+ - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_audio.target.yaml
317
+ - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_video.target.yaml
309
318
  - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_attachment.target.yaml
310
319
  - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_subtitle.target.yaml
320
+ - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_audio.source.yaml
311
321
  - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_attachment.source.yaml
312
- - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_video.source.yaml
313
322
  - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_subtitle.source.yaml
314
- - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_video.target.yaml
315
- - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_audio.target.yaml
316
- - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_audio.source.yaml
323
+ - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_video.source.yaml
317
324
  - spec/lib/ehbrs_ruby_utils/videos/resolution_spec.rb
318
- - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec.rb
319
- - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/title_spec.rb
320
- - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/counterpart_s01e01.target.yaml
321
- - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/wire-season-1-page-1.target.yaml
322
- - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/counterpart_s01e01.source.html
323
- - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/wire-season-1-page-1.source.html
324
- - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/title_spec_files/countepart.source.html
325
- - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/title_spec_files/countepart.target.yaml
326
- - spec/lib/ehbrs_ruby_utils/videos/stream_spec.rb
327
- - spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/minimum.source.yaml
328
- - spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/minimum.target.yaml
329
- - spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/ehbrs_music1.target.yaml
330
- - spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/ehbrs_music1.source.yaml
331
- - spec/rubocop_check_spec.rb
325
+ - spec/spec_helper.rb
332
326
  - ".rubocop.yml"
333
327
  - ".rspec"