module ClientForPoslynx::FakePosTerminal::ConsoleUserInterface::ContentFormatter

Public Instance Methods

buttons(button_labels) click to toggle source
# File lib/client_for_poslynx/fake_pos_terminal/console_user_interface/content_formatter.rb, line 19
def buttons(button_labels)
  button_strings = button_labels.map { |label| "[ #{label} ]" }
  tot_button_space = button_strings.map(&:length).inject{ |m, length| m + length }
  tot_marginal_space = 68 - tot_button_space
  padding_size = tot_marginal_space / ( button_strings.length * 2 )
  padding = ' ' * padding_size
  button_strings.map! { |string| padding + string + padding }
  ( button_strings * '' ).center( 68 )
end
card_swipe_request(request_data) click to toggle source
# File lib/client_for_poslynx/fake_pos_terminal/console_user_interface/content_formatter.rb, line 61
def card_swipe_request(request_data)
  total       = request_data.amount
  transaction = 'PURCHASE'
  lines = []
  lines << "Please swipe your card"
  lines << "Total: " + format_usd( total ) if total
  lines << "Transaction: " + transaction
  multiline_message( lines )
end
multiline_message(text_lines) click to toggle source
# File lib/client_for_poslynx/fake_pos_terminal/console_user_interface/content_formatter.rb, line 14
def multiline_message(text_lines)
  centered_lines = text_lines.map { |text| text.center(68) }
  "\n" << centered_lines * "\n" << "\n\n"
end
payment_confirmation(amount) click to toggle source
# File lib/client_for_poslynx/fake_pos_terminal/console_user_interface/content_formatter.rb, line 54
def payment_confirmation(amount)
  lines = []
  lines << "TOTAL AMOUNT"
  lines << format_usd( amount )
  multiline_message(lines)
end
signature_entry_box() click to toggle source
# File lib/client_for_poslynx/fake_pos_terminal/console_user_interface/content_formatter.rb, line 41
        def signature_entry_box
'

      Sign here...
     -----------------------------------------------------------
    |                                                           |
    |                                                           |
    |                                                           |
     -----------------------------------------------------------

'
        end
welcome_with_idle_prompt(prompt) click to toggle source
# File lib/client_for_poslynx/fake_pos_terminal/console_user_interface/content_formatter.rb, line 29
        def welcome_with_idle_prompt(prompt)
'
                        ___       _    _            ___
             |   |   | |    |    / \  / \  |     | |
             |   |   | |    |   |    |   | |\   /| |    
             |   |   | |--  |   |    |   | | \ / | |--
             |  / \  | |    |   |    |   | |  |  | |    
              \/   \/  |___ |___ \_/  \_/  |  |  | |___

' + "  (#{prompt})\n"
        end