Module: Laposta::Client::Lists

Included in:
Laposta::Client
Defined in:
lib/laposta/client/lists.rb

Instance Method Summary collapse

Instance Method Details

#create_list!(params = {}) ⇒ Object

Allowed attributes: Name Type Description


name string A name for the list in question remarks string (optional) Potential remarks subscribe_notification_email string (optional) Email address to which a notification will be sent upon a subscription unsubscribe_notification_email string (optional) Email address to which a notification will be sent upon the cancelling of a subscription




25
26
27
28
29
30
31
# File 'lib/laposta/client/lists.rb', line 25

def create_list!(params = {})
  cleaned = params.permit(:name,
                          :remark,
                          :subscribe_notification_email,
                          :unsubscribe_notification_email)
  create("list", cleaned)
end

#delete_list!(list_id) ⇒ Object

Name Type Description


list_id string The ID of the list




59
60
61
# File 'lib/laposta/client/lists.rb', line 59

def delete_list!(list_id)
  delete("list/#{list_id}")
end

#get_list(list_id) ⇒ Object

Parameters Name Type Description


list_id string The list’s ID




13
14
15
# File 'lib/laposta/client/lists.rb', line 13

def get_list(list_id)
  get("list/#{list_id}")
end

#lists(params = {}) ⇒ Object



4
5
6
# File 'lib/laposta/client/lists.rb', line 4

def lists(params = {})
  list("list", params)
end

#purge_list!(list_id) ⇒ Object

Name Type Description


list_id string The ID of the list




67
68
69
# File 'lib/laposta/client/lists.rb', line 67

def purge_list!(list_id)
  delete("list/#{list_id}/members")
end

#update_list!(list_id, params = {}) ⇒ Object

Parameters Name Type Description


list_id string The ID of the list that has to be modified


Allowed attributes: Name Type Description


name string (optional) A name for the list in question remarks string (optional) Potential remarks subscribe_notification_email string (optional) Email address to which a notification will be sent upon a subscription unsubscribe_notification_email string (optional) Email address to which a notification will be sent upon the cancelling of a subscription




47
48
49
50
51
52
53
# File 'lib/laposta/client/lists.rb', line 47

def update_list!(list_id, params = {})
  cleaned = params.permit(:name,
                          :remark,
                          :subscribe_notification_email,
                          :unsubscribe_notification_email)
  update("list/#{list_id}", cleaned)
end