class Sunnyside::EditService

Attributes

services[R]

Public Class Methods

new(services) click to toggle source
# File lib/sunnyside/cash_receipts/cash_receipt.rb, line 231
def initialize(services)
  @services = services.all
end

Public Instance Methods

adjust() click to toggle source
# File lib/sunnyside/cash_receipts/cash_receipt.rb, line 239
def adjust
  print "Type in the Service(s) ID # to change the amount: "
  ids     = gets.chomp.split
  ids.each do |id|
    print "You selected #{id} - Type in the adjusted amount: "
    amt    = gets.chomp
    print "And now type in the denial reason: "
    reason = gets.chomp
    adjust_service(id, amt, reason)
  end
end
adjust_service(id, amt, reason) click to toggle source
# File lib/sunnyside/cash_receipts/cash_receipt.rb, line 251
def adjust_service(id, amt, reason)
  Service[id].update(paid: amt, denial_reason: reason)
end
show_all() click to toggle source
# File lib/sunnyside/cash_receipts/cash_receipt.rb, line 235
def show_all
  services.each { |svc| puts "ID: #{svc.id} #{svc.dos} #{svc.service_code} #{svc.paid}" }
end