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
- #<=>(account_email) ⇒ 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
3 4 5 6 |
# File 'app/models/kaui/account_email.rb', line 3 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
#<=>(account_email) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'app/models/kaui/account_email.rb', line 18 def <=>(account_email) if account_email.nil? -1 elsif account_email.email.nil? email.nil? ? 0 : 1 else email.to_s <=> account_email.email.to_s end end |
#create(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
8 9 10 11 |
# File 'app/models/kaui/account_email.rb', line 8 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
13 14 15 16 |
# File 'app/models/kaui/account_email.rb', line 13 def destroy(user = nil, reason = nil, comment = nil, = {}) account = Kaui::Account.new(:account_id => account_id) account.remove_email(email, user, reason, comment, ) end |