class MailchimpAPI::Member

Public Instance Methods

notes(params = {}) click to toggle source

The path to get notes is '/3.0/lists/:list_id/members/:member_id' 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 notes method.

# File lib/mailchimp_api/resources/member.rb, line 19
def notes(params = {})
  @notes ||= MailchimpAPI::Note.find(:all, params: { member_id: id }.deep_merge(prefix_options).deep_merge(params))
end
permanent_delete() click to toggle source

Delete all personally identifiable information related to a list member, and remove them from a list. This will make it impossible to re-import the list member

# File lib/mailchimp_api/resources/member.rb, line 36
def permanent_delete
  run_callbacks :destroy do
    path = element_path(prefix_options) + '/actions/delete-permanent'

    connection.post path, nil, self.class.headers
  end
end
tags(params = {}) click to toggle source

The path to get tags is '/3.0/lists/:list_id/members/:member_id' 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 tags method.

# File lib/mailchimp_api/resources/member.rb, line 29
def tags(params = {})
  @tags ||= MailchimpAPI::Tag.find(:all, params: { member_id: id }.deep_merge(prefix_options).deep_merge(params))
end
update_tags(tags) click to toggle source

Tags should be provided as an array of the form [{name: 'tag1', status: 'active'}, {name: 'tag2', status: 'inactive'}]

# File lib/mailchimp_api/resources/member.rb, line 45
def update_tags(tags)
  path = element_path(prefix_options) + '/tags'
  body = { tags: tags }.to_json

  connection.post path, body, self.class.headers
end