Class: EhbrsRubyUtils::Gjt1::Manager

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/ehbrs_ruby_utils/gjt1/manager.rb

Instance Method Summary collapse

Instance Method Details

#bga_game_statistics_notify(game_statistics) ⇒ void

This method returns an undefined value.

Parameters:



28
29
30
31
32
# File 'lib/ehbrs_ruby_utils/gjt1/manager.rb', line 28

def bga_game_statistics_notify(game_statistics)
  whatsapp_formatter_send(
    ::EhbrsRubyUtils::Bga::GameStatistics::WhatsappFormatter, game_statistics
  )
end

#new_bga_sessionEhbrsRubyUtils::Bga::Session

Returns Cria uma nova sessão BGA.

Returns:



45
46
47
# File 'lib/ehbrs_ruby_utils/gjt1/manager.rb', line 45

def new_bga_session
  ::EhbrsRubyUtils::Bga::Session.new(bga_username, bga_password)
end

#on_bga_logged_session(&block) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/ehbrs_ruby_utils/gjt1/manager.rb', line 34

def on_bga_logged_session(&block)
  bga_session = new_bga_session
  begin
    bga_session.on_logged { block.call(bga_session) }
  ensure
    bga_session.close
    bga_session = nil
  end
end

#whatsapp_send(message, image_path = nil) ⇒ void

This method returns an undefined value.

Parameters:

  • message (String)
  • image_path (Pathname) (defaults to: nil)


52
53
54
55
# File 'lib/ehbrs_ruby_utils/gjt1/manager.rb', line 52

def whatsapp_send(message, image_path = nil)
  ::EhbrsRubyUtils::Mudslide::Message.new.text(message).image_path(image_path)
    .recipient(whatsapp_recipient).deliver
end