class Sunnyside::ExpiringAuth
Attributes
auth[R]
client[R]
client_id[R]
end_date[R]
file[R]
line[R]
service_id[R]
start_date[R]
Public Class Methods
new(file, client, line)
click to toggle source
# File lib/sunnyside/expiring_auth.rb, line 34 def initialize(file, client, line) @file = file @client = client.strip @service_id, @client_id, @auth, @start_date, @end_date = line if Authorization.where(auth: auth, client: client.strip).count == 0 process end end
Public Instance Methods
begin_date()
click to toggle source
# File lib/sunnyside/expiring_auth.rb, line 59 def begin_date if start_date.nil? Date.new else Date.strptime(start_date, '%m/%d/%y') end end
final_date()
click to toggle source
# File lib/sunnyside/expiring_auth.rb, line 67 def final_date if end_date.nil? Date.new else Date.strptime(end_date, '%m/%d/%y') end end
invoice()
click to toggle source
# File lib/sunnyside/expiring_auth.rb, line 51 def invoice Invoice.where(service_number: client_id) || Invoice.where(service_number: service_id) end
process()
click to toggle source
# File lib/sunnyside/expiring_auth.rb, line 55 def process Authorization.insert(auth: auth, provider: provider, client: client, start_date: begin_date, end_date: final_date, client_number: client_id, service_number: service_id) end
provider()
click to toggle source
# File lib/sunnyside/expiring_auth.rb, line 43 def provider if invoice.count > 0 invoice.all.last.provider else nil end end