Class: MList::Manager::Database

Inherits:
Object
  • Object
show all
Includes:
MList::Manager
Defined in:
lib/mlist/manager/database.rb

Defined Under Namespace

Classes: List, Subscriber

Instance Method Summary collapse

Methods included from MList::Manager

#notifier

Instance Method Details

#create_list(address, attributes = {}) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/mlist/manager/database.rb', line 7

def create_list(address, attributes = {})
  attributes = {
    :address => address,
    :label   => address.match(/\A(.*?)@/)[1]
  }.merge(attributes)
  List.create!(attributes)
end

#lists(email) ⇒ Object



15
16
17
18
# File 'lib/mlist/manager/database.rb', line 15

def lists(email)
  lists = List.find_all_by_address(email.list_addresses)
  email.list_addresses.map { |a| lists.detect {|l| l.address == a} }.compact
end

#no_lists_found(email) ⇒ Object



20
21
22
# File 'lib/mlist/manager/database.rb', line 20

def no_lists_found(email)
  # TODO: Move to notifier
end