Module: MailchimpAPI::Audience::Segments::APIs
- Includes:
- Pagination::ListEachItemHelper
- Defined in:
- lib/mailchimp-api/resources/audience/segments.rb
Overview
Module with endpoints for Segments APIs
Instance Method Summary collapse
-
#batch_add_or_remove_members(list_id, segment_id, query: nil, body: nil, headers: nil) ⇒ Response
Batch add or remove members from a static segment.
-
#create(list_id, query: nil, body: nil, headers: nil) ⇒ Response
Create a new segment.
-
#delete(list_id, segment_id, query: nil, body: nil, headers: nil) ⇒ Response
Delete a segment.
-
#each(list_id, query: nil, body: nil, headers: nil) {|Hash| ... } ⇒ Object
Iterate through all segments for a list.
-
#list(list_id, query: nil, body: nil, headers: nil) ⇒ Response
List segments for a specific list.
-
#show(list_id, segment_id, query: nil, body: nil, headers: nil) ⇒ Response
Show details for a specific segment.
-
#update(list_id, segment_id, query: nil, body: nil, headers: nil) ⇒ Response
Update a segment.
Instance Method Details
#batch_add_or_remove_members(list_id, segment_id, query: nil, body: nil, headers: nil) ⇒ Response
Batch add or remove members from a static segment
101 102 103 104 |
# File 'lib/mailchimp-api/resources/audience/segments.rb', line 101 def batch_add_or_remove_members(list_id, segment_id, query: nil, body: nil, headers: nil) path = "/lists/#{list_id}/segments/#{segment_id}" client.post(path, query: query, body: body, headers: headers) end |
#create(list_id, query: nil, body: nil, headers: nil) ⇒ Response
Create a new segment
38 39 40 41 |
# File 'lib/mailchimp-api/resources/audience/segments.rb', line 38 def create(list_id, query: nil, body: nil, headers: nil) path = "/lists/#{list_id}/segments" client.post(path, query: query, body: body, headers: headers) end |
#delete(list_id, segment_id, query: nil, body: nil, headers: nil) ⇒ Response
Delete a segment
82 83 84 85 |
# File 'lib/mailchimp-api/resources/audience/segments.rb', line 82 def delete(list_id, segment_id, query: nil, body: nil, headers: nil) path = "/lists/#{list_id}/segments/#{segment_id}" client.delete(path, query: query, body: body, headers: headers) end |
#each(list_id, query: nil, body: nil, headers: nil) {|Hash| ... } ⇒ Object
Iterate through all segments for a list
116 117 118 |
# File 'lib/mailchimp-api/resources/audience/segments.rb', line 116 def each(list_id, query: nil, body: nil, headers: nil, &block) list_each_item(:segments, list_id, query: query, body: body, headers: headers, &block) end |
#list(list_id, query: nil, body: nil, headers: nil) ⇒ Response
List segments for a specific list
20 21 22 23 |
# File 'lib/mailchimp-api/resources/audience/segments.rb', line 20 def list(list_id, query: nil, body: nil, headers: nil) path = "/lists/#{list_id}/segments" client.get(path, query: query, body: body, headers: headers) end |
#show(list_id, segment_id, query: nil, body: nil, headers: nil) ⇒ Response
Show details for a specific segment
52 53 54 55 |
# File 'lib/mailchimp-api/resources/audience/segments.rb', line 52 def show(list_id, segment_id, query: nil, body: nil, headers: nil) path = "/lists/#{list_id}/segments/#{segment_id}" client.get(path, query: query, body: body, headers: headers) end |
#update(list_id, segment_id, query: nil, body: nil, headers: nil) ⇒ Response
Update a segment
68 69 70 71 |
# File 'lib/mailchimp-api/resources/audience/segments.rb', line 68 def update(list_id, segment_id, query: nil, body: nil, headers: nil) path = "/lists/#{list_id}/segments/#{segment_id}" client.patch(path, query: query, body: body, headers: headers) end |