Class: Rubill::Customer

Inherits:
Base
  • Object
show all
Defined in:
lib/rubill/entities/customer.rb

Instance Attribute Summary

Attributes inherited from Base

#remote_record

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], #[]=, active, all, create, delete, #delete, find, find_by_name, #id, #initialize, #save, update, where

Constructor Details

This class inherits a constructor from Rubill::Base

Class Method Details

.find_by_account_number(account_number) ⇒ Object

The Bill.com API does not currently support searching by email or account number. Be careful as ::find_by_account_number will load all active Customers into memory



13
14
15
# File 'lib/rubill/entities/customer.rb', line 13

def self.()
  active.find { |customer| customer[:accNumber] == .to_s }
end

.find_by_email(email) ⇒ Object

The Bill.com API does not currently support searching by email or account number. Be careful as ::find_by_email will load all active Customers into memory



6
7
8
# File 'lib/rubill/entities/customer.rb', line 6

def self.find_by_email(email)
  active.find { |customer| customer[:email] == email }
end

Instance Method Details

#contactsObject



17
18
19
# File 'lib/rubill/entities/customer.rb', line 17

def contacts
  CustomerContact.active_by_customer(id)
end