Class: MailchimpAPI::Segment
- Extended by:
- MailchimpAPI::Support::Countable
- Includes:
- MailchimpAPI::Support::PatchUpdate
- Defined in:
- lib/mailchimp_api/resources/segment.rb
Instance Method Summary collapse
-
#members(params = {}) ⇒ Object
The path to get segment members is ‘/3.0/lists/:list_id/segments/:segment_id/members’ Unfortunately, ActiveResource does not support nested resources, only single parent resources:.
Methods included from MailchimpAPI::Support::Countable
Methods inherited from Base
activate_session, exists?, headers, reset_session, #to_h
Instance Method Details
#members(params = {}) ⇒ Object
The path to get segment members is ‘/3.0/lists/:list_id/segments/:segment_id/members’ Unfortunately, ActiveResource does not support nested resources, only single parent resources:
Using a has_many, there is no way to include the ‘list_id`, so we just create our own members method.
19 20 21 |
# File 'lib/mailchimp_api/resources/segment.rb', line 19 def members(params = {}) @members ||= MailchimpAPI::SegmentMember.find(:all, params: { segment_id: id }.deep_merge().deep_merge(params)) end |