class Mailroute::Domain

Public Class Methods

get(id_or_name) click to toggle source
# File lib/mailroute/models/domain.rb, line 44
def get(id_or_name)
  case id_or_name
  when String
    filter(:name => id_or_name).first
  when Integer
    get_by_id(id_or_name)
  else
    raise 'Unknown argument type'
  end
end
Also aliased as: get_by_id
get_by_id(id_or_name)
Alias for: get

Public Instance Methods

add_to_blacklist(address) click to toggle source
# File lib/mailroute/models/domain.rb, line 22
def add_to_blacklist(address)
  create_wblist(:wb => 'b', :email => address)
end
add_to_whitelist(address) click to toggle source
# File lib/mailroute/models/domain.rb, line 26
def add_to_whitelist(address)
  create_wblist(:wb => 'w', :email => address)
end
blacklist() click to toggle source
# File lib/mailroute/models/domain.rb, line 14
def blacklist
  WBList.filter(:domain => id, :wb => 'b').map(&:email)
end
bulk_create_email_account(localparts) click to toggle source
# File lib/mailroute/models/domain.rb, line 35
def bulk_create_email_account(localparts)
  connection.post(element_path + 'email_accounts/mass_add/', localparts.to_json, self.class.headers).tap do |response|
    ap response
  end
end
move_to_customer(another_customer) click to toggle source
# File lib/mailroute/models/domain.rb, line 30
def move_to_customer(another_customer)
  self.customer = another_customer
  self.save!
end
whitelist() click to toggle source
# File lib/mailroute/models/domain.rb, line 18
def whitelist
  WBList.filter(:domain => id, :wb => 'w').map(&:email)
end