Sha256: 7e7140c5bd8bf5fe4cbeeddc071000a804fd30285c7e72a0ea74503ee6ec106c

Contents?: true

Size: 947 Bytes

Versions: 1

Compression:

Stored size: 947 Bytes

Contents

# frozen_string_literal: true

module Kaui
  class AccountEmail < KillBillClient::Model::AccountEmailAttributes
    def self.find_all_sorted_by_account_id(account_id, audit = 'NONE', options = {})
      emails = Kaui::Account.new(account_id: account_id).emails(audit, options)
      emails.map { |email| Kaui::AccountEmail.new(email.to_hash) }.sort
    end

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kaui-2.2.1 app/models/kaui/account_email.rb