Class: Mailchimp::List::Members

Inherits:
Collection
  • Object
show all
Defined in:
lib/mailchimp_api_v3/member.rb

Constant Summary collapse

PATH_KEY =
DATA_KEY = 'members'.freeze
CHILD_CLASS =
Member

Constants included from Collection::Paging

Collection::Paging::DEFAULT_PAGE_SIZE

Instance Method Summary collapse

Methods inherited from Collection

#count, #find_by, #first_or_create, #initialize, #name_field, #path, #where

Methods included from Collection::Paging

#fetch_options, #find_each, #find_in_pages, #invalidate_current_page, #offset, #page, #page_array, #page_children, #page_size, #parse_options

Constructor Details

This class inherits a constructor from Mailchimp::Collection

Instance Method Details

#create(data) ⇒ Object



63
64
65
66
# File 'lib/mailchimp_api_v3/member.rb', line 63

def create(data)
  return super Mailchimp::List::Member.parse_name_from(data) if data.respond_to? :deep_stringify_keys
  raise Mailchimp::Exception::BadRequest, "Expecting a Hash, received a #{data.class}: #{data}"
end

#create_or_update(data) ⇒ Object



68
69
70
# File 'lib/mailchimp_api_v3/member.rb', line 68

def create_or_update(data)
  super Mailchimp::List::Member.add_id_to(data)
end