Class: Timepad::Maillist

Inherits:
Base
  • Object
show all
Defined in:
lib/timepad/maillist.rb

Instance Method Summary collapse

Methods inherited from Base

#make_query, #make_uri, #request, #subscribers_to_hash

Constructor Details

#initialize(timepad_client) ⇒ Maillist

Returns a new instance of Maillist.



4
5
6
# File 'lib/timepad/maillist.rb', line 4

def initialize(timepad_client)
  @client = timepad_client
end

Instance Method Details

#add_items(maillist_id, subscribers) ⇒ Object

Add maillist subscribers

Parameters:

  • maillist_id (String)

    maillist id

  • subscribers (Array)


27
28
29
30
31
32
33
34
35
36
# File 'lib/timepad/maillist.rb', line 27

def add_items maillist_id, subscribers
  if subscribers.kind_of? Hash
    subscribers = [subscribers]
  end

  params = subscribers_to_hash(subscribers)
  params[:m_id] = maillist_id

  request 'add_items', params
end

#create(title, subscribers) ⇒ Object

Create maillist

Parameters:

  • title (String)

    maillist title

  • subscribers (Array)

    maillist initial subscribers



42
43
44
45
46
47
# File 'lib/timepad/maillist.rb', line 42

def create title, subscribers
  params = subscribers_to_hash(subscribers)
  params[:name] = title

  request 'create', params
end

#get(maillist_id) ⇒ Array

Get maillist subscribers

Parameters:

  • maillist_id (String)

    maillist id

Returns:

  • (Array)


19
20
21
# File 'lib/timepad/maillist.rb', line 19

def get maillist_id
  request 'get', :maillist => maillist_id
end

#get_listArray

Get all maillists

Returns:

  • (Array)


11
12
13
# File 'lib/timepad/maillist.rb', line 11

def get_list
  request 'getlist'
end