Class: MailchimpAPI::Member
- Extended by:
- Support::Countable
- Includes:
- Support::PatchUpdate
- Defined in:
- lib/mailchimp_api/resources/member.rb
Instance Method Summary collapse
-
#notes(params = {}) ⇒ Object
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:.
-
#permanent_delete ⇒ Object
Delete all personally identifiable information related to a list member, and remove them from a list.
-
#tags(params = {}) ⇒ Object
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:.
-
#update_tags(tags) ⇒ Object
Tags should be provided as an array of the form [‘tag1’, status: ‘active’, ‘tag2’, status: ‘inactive’].
Methods included from Support::Countable
Methods inherited from Base
activate_session, exists?, headers, reset_session, #to_h
Instance Method Details
#notes(params = {}) ⇒ Object
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:
Using a has_many, there is no way to include the ‘list_id`, so we just create our own notes method.
19 20 21 |
# File 'lib/mailchimp_api/resources/member.rb', line 19 def notes(params = {}) @notes ||= MailchimpAPI::Note.find(:all, params: { member_id: id }.deep_merge().deep_merge(params)) end |
#permanent_delete ⇒ Object
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
36 37 38 39 40 41 42 |
# File 'lib/mailchimp_api/resources/member.rb', line 36 def permanent_delete run_callbacks :destroy do path = element_path() + '/actions/delete-permanent' connection.post path, nil, self.class.headers end end |
#tags(params = {}) ⇒ Object
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:
Using a has_many, there is no way to include the ‘list_id`, so we just create our own tags method.
29 30 31 |
# File 'lib/mailchimp_api/resources/member.rb', line 29 def (params = {}) @tags ||= MailchimpAPI::Tag.find(:all, params: { member_id: id }.deep_merge().deep_merge(params)) end |
#update_tags(tags) ⇒ Object
Tags should be provided as an array of the form [‘tag1’, status: ‘active’, ‘tag2’, status: ‘inactive’]
45 46 47 48 49 50 |
# File 'lib/mailchimp_api/resources/member.rb', line 45 def () path = element_path() + '/tags' body = { tags: }.to_json connection.post path, body, self.class.headers end |