Class: Iterable::Lists
- Inherits:
-
ApiResource
- Object
- ApiResource
- Iterable::Lists
- Defined in:
- lib/iterable/lists.rb
Overview
Interact with /lists API endpoints
Instance Attribute Summary
Attributes inherited from ApiResource
Instance Method Summary collapse
-
#all ⇒ Iterable::Response
Get all lists.
-
#create(name) ⇒ Iterable::Response
Create a new list with a name.
-
#delete(list_id) ⇒ Iterable::Response
Delete an existing list given a list id.
-
#subscribe(list_id, subscribers = []) ⇒ Iterable::Response
Subscribe users to a list.
-
#unsubscribe(list_id, subscribers = []) ⇒ Iterable::Response
Subscribe users to a list.
-
#users(list_id) ⇒ Iterable::Response
Get users for a list.
Methods inherited from ApiResource
#default_config, default_config, #initialize
Constructor Details
This class inherits a constructor from Iterable::ApiResource
Instance Method Details
#all ⇒ Iterable::Response
Get all lists
20 21 22 |
# File 'lib/iterable/lists.rb', line 20 def all Iterable.request(conf, '/lists').get end |
#create(name) ⇒ Iterable::Response
Create a new list with a name
31 32 33 |
# File 'lib/iterable/lists.rb', line 31 def create(name) Iterable.request(conf, '/lists').post(name: name) end |
#delete(list_id) ⇒ Iterable::Response
Delete an existing list given a list id
42 43 44 |
# File 'lib/iterable/lists.rb', line 42 def delete(list_id) Iterable.request(conf, "/lists/#{list_id}").delete end |
#subscribe(list_id, subscribers = []) ⇒ Iterable::Response
Subscribe users to a list
65 66 67 68 69 70 71 |
# File 'lib/iterable/lists.rb', line 65 def subscribe(list_id, subscribers = []) attrs = { listId: list_id, subscribers: subscribers } Iterable.request(conf, '/lists/subscribe').post(attrs) end |
#unsubscribe(list_id, subscribers = []) ⇒ Iterable::Response
Subscribe users to a list
81 82 83 84 85 86 87 |
# File 'lib/iterable/lists.rb', line 81 def unsubscribe(list_id, subscribers = []) attrs = { listId: list_id, subscribers: subscribers } Iterable.request(conf, '/lists/unsubscribe').post(attrs) end |
#users(list_id) ⇒ Iterable::Response
Get users for a list
53 54 55 |
# File 'lib/iterable/lists.rb', line 53 def users(list_id) Iterable.request(conf, '/lists/getUsers', listId: list_id).get end |