Class: Mailroute::Domain
- Inherits:
-
Base
- Object
- ActiveResource::Base
- Base
- Mailroute::Domain
show all
- Defined in:
- lib/mailroute/models/domain.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
bulk_create, delete, has_admins, has_many, has_one, headers, #initialize, instantiate_collection, instantiate_collection_without_meta, list, #load, meta, #reload, #to_json, total_count
included
Class Method Details
.get(id_or_name) ⇒ Object
44
45
46
47
48
49
50
51
52
53
|
# 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
|
.get_by_id ⇒ Object
42
|
# File 'lib/mailroute/models/domain.rb', line 42
alias_method :get_by_id, :get
|
Instance Method Details
#add_to_blacklist(address) ⇒ Object
22
23
24
|
# File 'lib/mailroute/models/domain.rb', line 22
def add_to_blacklist(address)
create_wblist(:wb => 'b', :email => address)
end
|
#add_to_whitelist(address) ⇒ Object
26
27
28
|
# File 'lib/mailroute/models/domain.rb', line 26
def add_to_whitelist(address)
create_wblist(:wb => 'w', :email => address)
end
|
#blacklist ⇒ Object
14
15
16
|
# File 'lib/mailroute/models/domain.rb', line 14
def blacklist
WBList.filter(:domain => id, :wb => 'b').map(&:email)
end
|
#bulk_create_email_account(localparts) ⇒ Object
35
36
37
38
39
|
# 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.).tap do |response|
ap response
end
end
|
#move_to_customer(another_customer) ⇒ Object
30
31
32
33
|
# File 'lib/mailroute/models/domain.rb', line 30
def move_to_customer(another_customer)
self.customer = another_customer
self.save!
end
|
#whitelist ⇒ Object
18
19
20
|
# File 'lib/mailroute/models/domain.rb', line 18
def whitelist
WBList.filter(:domain => id, :wb => 'w').map(&:email)
end
|