Class: BillTrap::Client

Inherits:
Sequel::Model
  • Object
show all
Extended by:
Helpers
Defined in:
lib/billtrap/models.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

format_date, format_money, is_i?

Class Method Details

.get(c) ⇒ Object

Retrieve client If numeric, assumes it’s an ID If string, returns first match c == surname Returns nil otherwise / if no match was found



16
17
18
19
20
21
22
23
24
# File 'lib/billtrap/models.rb', line 16

def self.get c
  if is_i? c
    Client[c]
  elsif c.is_a? String
    Client.find(:surname => c)
  else
    nil
  end
end

Instance Method Details

#nameObject



27
28
29
# File 'lib/billtrap/models.rb', line 27

def name
  "#{firstname} #{surname}"
end