Class: Ifin24::Commands::ListLimits

Inherits:
Base
  • Object
show all
Defined in:
lib/ifin24/commands/list_limits.rb

Constant Summary collapse

LIMIT_BAR_SIZE =
64

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
25
26
# File 'lib/ifin24/commands/list_limits.rb', line 6

def execute
  curr_date = Date.today
  limits = @client.fetch_limits(curr_date)
  print_report(limits)

  console_menu('Powrót do głównego menu') do |menu|
    menu.choice("Poprzedni miesiąc") do
      curr_date = curr_date << 1

      limits = @client.fetch_limits(curr_date)
      print_report(limits)
    end

    menu.choice("Następny miesiąc") do
      curr_date = curr_date >> 1

      limits = @client.fetch_limits(curr_date)
      print_report(limits)
    end
  end
end