class MailchimpAPI::CollectionParsers::Base

Attributes

total_items[RW]

Public Class Methods

new(response = {}) click to toggle source
# File lib/mailchimp_api/collection_parsers/base.rb, line 7
def initialize(response = {})
  @links        = instantiate_links response.delete '_links'
  @total_items  = response.delete 'total_items'

  @elements = response[element_key] || []
end

Protected Instance Methods

element_key() click to toggle source
# File lib/mailchimp_api/collection_parsers/base.rb, line 16
def element_key
  self.class.name.demodulize.underscore.pluralize
end