Class: Kaui::AccountEmail

Inherits:
KillBillClient::Model::AccountEmailAttributes
  • Object
show all
Defined in:
app/models/kaui/account_email.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find_all_sorted_by_account_id(account_id, audit = 'NONE', options = {}) ⇒ Object



5
6
7
8
# File 'app/models/kaui/account_email.rb', line 5

def self.(, audit = 'NONE', options = {})
  emails = Kaui::Account.new(account_id:).emails(audit, options)
  emails.map { |email| Kaui::AccountEmail.new(email.to_hash) }.sort
end

Instance Method Details

#<=>(other) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'app/models/kaui/account_email.rb', line 20

def <=>(other)
  if other.nil?
    -1
  elsif other.email.nil?
    email.nil? ? 0 : 1
  else
    email.to_s <=> other.email.to_s
  end
end

#create(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object



10
11
12
13
# File 'app/models/kaui/account_email.rb', line 10

def create(user = nil, reason = nil, comment = nil, options = {})
   = Kaui::Account.new(account_id:)
  .add_email(email, user, reason, comment, options)
end

#destroy(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object



15
16
17
18
# File 'app/models/kaui/account_email.rb', line 15

def destroy(user = nil, reason = nil, comment = nil, options = {})
   = Kaui::Account.new(account_id:)
  .remove_email(email, user, reason, comment, options)
end