Class: Ifin24::Commands::AddExpense

Inherits:
Base
  • Object
show all
Includes:
Models
Defined in:
lib/ifin24/commands/add_expense.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Helpers::Printer

#print_list

Methods included from Helpers::Menu

#console_menu

Constructor Details

This class inherits a constructor from Ifin24::Commands::Base

Instance Method Details

#executeObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ifin24/commands/add_expense.rb', line 6

def execute
  entry = get_entry

  console_menu('Powrót do głównego menu') do |menu|
    menu.choice("Nazwa: #{entry.title}") { get_title_for(entry) }
    menu.choice("Data: #{entry.date}") { get_date_for(entry) }
    menu.choice("Konto: #{entry..name}") { (entry) }
    menu.choice("Kategoria: #{entry.category_full_name}") { get_category_for(entry) }
    menu.choice("Kwota: #{entry.amount}") { get_amount_for(entry) }
    menu.choice("Tagi: #{entry.tags}") { get_tags_for(entry) }
    menu.choice("Opis: #{entry.note}") { get_note_for(entry) }

    menu.choice("Wyślij") do
      puts "Wysyłanie danych..."
      @client.send_entry(entry)
      throw :exit
    end
  end
end