Class: Iterable::Lists
Overview
Interact with /lists API endpoints
Instance Attribute Summary
Attributes inherited from ApiResource
#conf
Instance Method Summary
collapse
Methods inherited from ApiResource
#default_config, default_config, #initialize
Instance Method Details
#all ⇒ Object
23
24
25
|
# File 'lib/iterable/lists.rb', line 23
def all
Iterable.request(conf, '/lists').get
end
|
#create(name) ⇒ Object
35
36
37
|
# File 'lib/iterable/lists.rb', line 35
def create(name)
Iterable.request(conf, '/lists').post(name: name)
end
|
#delete(list_id) ⇒ Object
47
48
49
|
# File 'lib/iterable/lists.rb', line 47
def delete(list_id)
Iterable.request(conf, "/lists/#{list_id}").delete
end
|
#subscribe(list_id, subscribers = []) ⇒ Object
81
82
83
84
85
86
87
|
# File 'lib/iterable/lists.rb', line 81
def subscribe(list_id, subscribers = [])
attrs = {
listId: list_id,
subscribers: subscribers
}
Iterable.request(conf, '/lists/subscribe').post(attrs)
end
|
#unsubscribe(list_id, subscribers = []) ⇒ Object
107
108
109
110
111
112
113
|
# File 'lib/iterable/lists.rb', line 107
def unsubscribe(list_id, subscribers = [])
attrs = {
listId: list_id,
subscribers: subscribers
}
Iterable.request(conf, '/lists/unsubscribe').post(attrs)
end
|
#users(list_id) ⇒ Object
59
60
61
|
# File 'lib/iterable/lists.rb', line 59
def users(list_id)
Iterable.request(conf, '/lists/getUsers', listId: list_id).get
end
|