Class: Kaui::AccountEmail
- Inherits:
-
KillBillClient::Model::AccountEmailAttributes
- Object
- KillBillClient::Model::AccountEmailAttributes
- Kaui::AccountEmail
- Defined in:
- app/models/kaui/account_email.rb
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #create(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
- #destroy(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
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.find_all_sorted_by_account_id(account_id, audit = 'NONE', = {}) emails = Kaui::Account.new(account_id: account_id).emails(audit, ) 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, = {}) account = Kaui::Account.new(account_id: account_id) account.add_email(email, user, reason, comment, ) 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, = {}) account = Kaui::Account.new(account_id: account_id) account.remove_email(email, user, reason, comment, ) end |