Class: MailchimpAPI::CollectionParsers::Base

Inherits:
ActiveResource::Collection
  • Object
show all
Defined in:
lib/mailchimp_api/collection_parsers/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response = {}) ⇒ Base

Returns a new instance of Base.



7
8
9
10
11
12
# 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

Instance Attribute Details

Returns the value of attribute links.



5
6
7
# File 'lib/mailchimp_api/collection_parsers/base.rb', line 5

def links
  @links
end

#total_itemsObject

Returns the value of attribute total_items.



5
6
7
# File 'lib/mailchimp_api/collection_parsers/base.rb', line 5

def total_items
  @total_items
end