Search code examples
ruby-on-railsmailchimpgibbon

Stack Level Too Deep: retrieving an ID of a List - Gibbon / MailChimp / Rails


What is the proper way to retrieve an id of a list from MailChimp using Gibbon API Wrapper?

Say I want to do something like:

list = gibbon.lists.list(filters: "Foo")
gibbon.lists(list.id).members.create(....)

list.id returns stack level too deep because of the nested attributes inside the gibbon.listcall. What is the correct way to call list.id in Gibbon?


Solution

  • Ended up storing list_id as an environment variable.

    This gives me the ability to limit the amount of MailChimp API queries as List Ids are now being stored locally.

    I also created additional lists for testing user subscription in different environments (e.g. staging). Using the same code base I'm simply replacing the list ENV value for different environments.