Module: MailchimpAPI::Audience::SegmentMembers::APIs
- Includes:
- Utils, Pagination::ListEachItemHelper
- Defined in:
- lib/mailchimp-api/resources/audience/segment_members.rb
Overview
Module with endpoints for SegmentMembers APIs
Instance Method Summary collapse
-
#create(list_id, segment_id, query: nil, body: nil, headers: nil) ⇒ Response
Add a member to a static segment.
-
#delete(list_id, segment_id, email, query: nil, body: nil, headers: nil) ⇒ Response
Remove a member from a static segment.
-
#each(list_id, segment_id, query: nil, body: nil, headers: nil) {|Hash| ... } ⇒ Object
Iterate through all members in a segment.
-
#list(list_id, segment_id, query: nil, body: nil, headers: nil) ⇒ Response
List members in a specific segment.
Instance Method Details
#create(list_id, segment_id, query: nil, body: nil, headers: nil) ⇒ Response
Add a member to a static segment
38 39 40 41 |
# File 'lib/mailchimp-api/resources/audience/segment_members.rb', line 38 def create(list_id, segment_id, query: nil, body: nil, headers: nil) path = "/lists/#{list_id}/segments/#{segment_id}/members" client.post(path, query: query, body: body, headers: headers) end |
#delete(list_id, segment_id, email, query: nil, body: nil, headers: nil) ⇒ Response
Remove a member from a static segment
53 54 55 56 |
# File 'lib/mailchimp-api/resources/audience/segment_members.rb', line 53 def delete(list_id, segment_id, email, query: nil, body: nil, headers: nil) path = "/lists/#{list_id}/segments/#{segment_id}/members/#{subscriber_hash(email)}" client.delete(path, query: query, body: body, headers: headers) end |
#each(list_id, segment_id, query: nil, body: nil, headers: nil) {|Hash| ... } ⇒ Object
Iterate through all members in a segment
69 70 71 |
# File 'lib/mailchimp-api/resources/audience/segment_members.rb', line 69 def each(list_id, segment_id, query: nil, body: nil, headers: nil, &block) list_each_item(:members, list_id, segment_id, query: query, body: body, headers: headers, &block) end |
#list(list_id, segment_id, query: nil, body: nil, headers: nil) ⇒ Response
List members in a specific segment
22 23 24 25 |
# File 'lib/mailchimp-api/resources/audience/segment_members.rb', line 22 def list(list_id, segment_id, query: nil, body: nil, headers: nil) path = "/lists/#{list_id}/segments/#{segment_id}/members" client.get(path, query: query, body: body, headers: headers) end |