ehbrs_ruby_utils 0.28.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 242dda28e0e3dab83a2b68d030273e0335b54f45a070980bcd7de340fdb53f1e
4
- data.tar.gz: 76442e6655256f61039a009e53b241023e01b2e592bb42227d113ab81105430d
3
+ metadata.gz: 4d3d030552c8f65af3c5c12d12466e7c0b79b17aaa1d15e2b6b34401178a4db6
4
+ data.tar.gz: '05393346d1434c2ddfe1fbfdd0287cdbc324fbded63eaf69db3f910d27ae6397'
5
5
  SHA512:
6
- metadata.gz: 3dc4de45f3322ab74030397d7440c3d6fe226d6f7d15ac93fec21846f6281975855344432c60a909ae8a01e222afb206dffc0ad91ee63f2a683b1749b053e93a
7
- data.tar.gz: 0df77e54c42753a50ff8fab054e18dd5ae27593036cbb6cefca2aea45d1e21fe012a34163f2660b4c120618360525d0f46174c63d397faa556eb97e0eab4a9ed
6
+ metadata.gz: 71849968b06015398fddacfa93e9751c2088426c1a09cb9f83ec67e49e657b11488e3d9b776e8326547ff19f5b18285070ad63817fe2ea382016b2c5ad75bba0
7
+ data.tar.gz: e70b99ec32cffb0ab62f43fe7695bb8dc58795bcdaa385a66494025f5dcdf4445a8f86808fa43e9677526fd30d24291a90acdde806898563e55240c5403e69af
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'ehbrs_ruby_utils/bga/session'
4
4
  require 'ehbrs_ruby_utils/executables'
5
+ require 'ehbrs_ruby_utils/mudslide/message'
5
6
  require 'eac_ruby_utils/core_ext'
6
7
 
7
8
  module EhbrsRubyUtils
@@ -10,6 +11,13 @@ module EhbrsRubyUtils
10
11
  include ::Singleton
11
12
  acts_as_abstract :bga_usernam, :bga_password, :whatsapp_recipient
12
13
 
14
+ # @param table [EhbrsRubyUtils::Bga::Table]
15
+ # @return [void]
16
+ def bga_table_notify(table)
17
+ formatter = ::EhbrsRubyUtils::Bga::TableWhatsappFormatter.new(table)
18
+ whatsapp_send(formatter.to_s, formatter.image_local_path)
19
+ end
20
+
13
21
  def on_bga_logged_session(&block)
14
22
  bga_session = new_bga_session
15
23
  begin
@@ -29,11 +37,8 @@ module EhbrsRubyUtils
29
37
  # @param image_path [Pathname]
30
38
  # @return [void]
31
39
  def whatsapp_send(message, image_path = nil)
32
- if image_path.present?
33
- mudslide_run('send-image', '--caption', message, whatsapp_recipient, image_path)
34
- else
35
- mudslide_run('send', whatsapp_recipient, message)
36
- end
40
+ ::EhbrsRubyUtils::Mudslide::Message.new.text(message).image_path(image_path)
41
+ .recipient(whatsapp_recipient).deliver
37
42
  end
38
43
 
39
44
  private
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'ehbrs_ruby_utils/executables'
5
+
6
+ module EhbrsRubyUtils
7
+ module Mudslide
8
+ class Message
9
+ acts_as_immutable
10
+ immutable_accessor :image_path, :recipient, :text
11
+
12
+ def deliver
13
+ raise 'No recipient set' if recipient.blank?
14
+
15
+ if image_path.present?
16
+ deliver_image
17
+ elsif text.present?
18
+ deliver_text
19
+ else
20
+ deliver
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ # @return [void]
27
+ def deliver_image
28
+ args = ['send-image']
29
+ text.if_present { |_v| args += ['--caption', text] }
30
+ mudslide_run(*args, recipient, image_path)
31
+ end
32
+
33
+ # @return [void]
34
+ def deliver_text
35
+ mudslide_run('send', recipient, text)
36
+ end
37
+
38
+ # @return [void]
39
+ def mudslide_run(*args)
40
+ ::EhbrsRubyUtils::Executables.mudslide.command(*args).system!
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbrsRubyUtils
6
+ module Mudslide
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EhbrsRubyUtils
4
- VERSION = '0.28.0'
4
+ VERSION = '0.29.0'
5
5
  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.28.0
4
+ version: 0.29.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-06-11 00:00:00.000000000 Z
11
+ date: 2023-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha
@@ -113,6 +113,9 @@ dependencies:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0.9'
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: 0.9.1
116
119
  type: :runtime
117
120
  prerelease: false
118
121
  version_requirements: !ruby/object:Gem::Requirement
@@ -120,6 +123,9 @@ dependencies:
120
123
  - - "~>"
121
124
  - !ruby/object:Gem::Version
122
125
  version: '0.9'
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: 0.9.1
123
129
  - !ruby/object:Gem::Dependency
124
130
  name: eac_ruby_utils
125
131
  requirement: !ruby/object:Gem::Requirement
@@ -269,6 +275,8 @@ files:
269
275
  - lib/ehbrs_ruby_utils/fs/selected/build_file.rb
270
276
  - lib/ehbrs_ruby_utils/gjt1.rb
271
277
  - lib/ehbrs_ruby_utils/gjt1/manager.rb
278
+ - lib/ehbrs_ruby_utils/mudslide.rb
279
+ - lib/ehbrs_ruby_utils/mudslide/message.rb
272
280
  - lib/ehbrs_ruby_utils/music.rb
273
281
  - lib/ehbrs_ruby_utils/music/lyrics_book.rb
274
282
  - lib/ehbrs_ruby_utils/music/lyrics_book/album.rb
@@ -398,50 +406,50 @@ signing_key:
398
406
  specification_version: 4
399
407
  summary: Utilities for EHB/RS's Ruby projects.
400
408
  test_files:
401
- - spec/rubocop_check_spec.rb
409
+ - spec/spec_helper.rb
410
+ - spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec.rb
411
+ - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_attachment.target.yaml
412
+ - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_subtitle.target.yaml
413
+ - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_attachment.source.yaml
414
+ - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_video.source.yaml
415
+ - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_subtitle.source.yaml
416
+ - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_video.target.yaml
417
+ - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_audio.target.yaml
418
+ - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_audio.source.yaml
419
+ - spec/lib/ehbrs_ruby_utils/videos/resolution_spec.rb
420
+ - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec.rb
421
+ - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/title_spec.rb
422
+ - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/counterpart_s01e01.target.yaml
423
+ - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/wire-season-1-page-1.target.yaml
424
+ - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/counterpart_s01e01.source.html
425
+ - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/wire-season-1-page-1.source.html
426
+ - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/title_spec_files/countepart.source.html
427
+ - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/title_spec_files/countepart.target.yaml
428
+ - spec/lib/ehbrs_ruby_utils/videos/stream_spec.rb
402
429
  - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_308782287.target.yaml
403
- - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_356513708.target.yaml
404
- - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_302873643.target.yaml
405
430
  - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_368448439.target.yaml
406
- - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_368448439.source.html
407
- - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_357408039.source.html
408
431
  - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_356513708.source.html
432
+ - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_357408039.source.html
433
+ - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_356513708.target.yaml
434
+ - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_373747455.target.yaml
435
+ - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_302873643.target.yaml
409
436
  - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_373747455.source.html
410
- - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_373602409.source.html
411
- - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_373602409.target.yaml
412
437
  - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_302873643.source.html
413
- - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_357408039.target.yaml
438
+ - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_373602409.target.yaml
414
439
  - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_308782287.source.html
415
- - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_373747455.target.yaml
416
- - spec/lib/ehbrs_ruby_utils/bga/parsers/game_stats_spec_files/2.target.yaml
417
- - spec/lib/ehbrs_ruby_utils/bga/parsers/game_stats_spec_files/2.source.html
440
+ - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_368448439.source.html
441
+ - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_373602409.source.html
442
+ - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_357408039.target.yaml
418
443
  - spec/lib/ehbrs_ruby_utils/bga/parsers/game_stats_spec_files/1.source.html
444
+ - spec/lib/ehbrs_ruby_utils/bga/parsers/game_stats_spec_files/2.target.yaml
419
445
  - spec/lib/ehbrs_ruby_utils/bga/parsers/game_stats_spec_files/1.target.yaml
446
+ - spec/lib/ehbrs_ruby_utils/bga/parsers/game_stats_spec_files/2.source.html
420
447
  - spec/lib/ehbrs_ruby_utils/bga/parsers/game_stats_spec.rb
421
448
  - spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec.rb
422
- - spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec.rb
423
- - spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/minimum.target.yaml
424
- - spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/ehbrs_music1.source.yaml
425
449
  - spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/minimum.source.yaml
450
+ - spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/minimum.target.yaml
426
451
  - spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/ehbrs_music1.target.yaml
427
- - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/title_spec_files/countepart.target.yaml
428
- - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/title_spec_files/countepart.source.html
429
- - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/title_spec.rb
430
- - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec.rb
431
- - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/counterpart_s01e01.source.html
432
- - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/wire-season-1-page-1.target.yaml
433
- - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/wire-season-1-page-1.source.html
434
- - spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/counterpart_s01e01.target.yaml
435
- - spec/lib/ehbrs_ruby_utils/videos/stream_spec.rb
436
- - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_audio.target.yaml
437
- - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_video.target.yaml
438
- - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_attachment.target.yaml
439
- - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_subtitle.target.yaml
440
- - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_audio.source.yaml
441
- - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_attachment.source.yaml
442
- - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_subtitle.source.yaml
443
- - spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_video.source.yaml
444
- - spec/lib/ehbrs_ruby_utils/videos/resolution_spec.rb
445
- - spec/spec_helper.rb
452
+ - spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/ehbrs_music1.source.yaml
453
+ - spec/rubocop_check_spec.rb
446
454
  - ".rubocop.yml"
447
455
  - ".rspec"