class MailchimpAPI::Segment

Public Instance Methods

members(params = {}) click to toggle source

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:

github.com/rails/activeresource/blob/4accda8bc03ceae0ad626f8cec0b4751e89a58ad/lib/active_resource/associations.rb#L151

Using a has_many, there is no way to include the `list_id`, so we just create our own members method.

# File lib/mailchimp_api/resources/segment.rb, line 19
def members(params = {})
  @members ||= MailchimpAPI::SegmentMember.find(:all, params: { segment_id: id }.deep_merge(prefix_options).deep_merge(params))
end