Class: Ifin24::Console

Inherits:
Object
  • Object
show all
Includes:
Ifin24, Helpers::Menu
Defined in:
lib/ifin24/console.rb

Instance Method Summary collapse

Methods included from Helpers::Menu

#console_menu

Constructor Details

#initialize(client) ⇒ Console

Returns a new instance of Console.



7
8
9
# File 'lib/ifin24/console.rb', line 7

def initialize(client)
  @client = client
end

Instance Method Details

#add_expenseObject



22
23
24
# File 'lib/ifin24/console.rb', line 22

def add_expense
  execute_command(Commands::AddExpense)
end

#list_accountsObject



26
27
28
# File 'lib/ifin24/console.rb', line 26

def list_accounts
  execute_command(Commands::ListAccounts)
end

#list_entriesObject



30
31
32
# File 'lib/ifin24/console.rb', line 30

def list_entries
  execute_command(Commands::ListEntries)
end

#list_limitsObject



34
35
36
# File 'lib/ifin24/console.rb', line 34

def list_limits
  execute_command(Commands::ListLimits)
end


11
12
13
14
15
16
17
18
19
20
# File 'lib/ifin24/console.rb', line 11

def main_menu
  console_menu('Koniec') do |menu|
    menu.header = "Menu główne"

    menu.choice("Dodaj wydatek") { add_expense }
    menu.choice("Lista kont") { list_accounts }
    menu.choice("Lista ostatnich transakcji") { list_entries }
    menu.choice("Kontrola wydatków") { list_limits }
  end
end