Skip to content

Instantly share code, notes, and snippets.

Last active Jan 4, 2016
What would you like to do?
def subscribe_to_segment(name, users, list_name = DEFAULT_LIST)
@list_id = find_list(list_name)
segment = find_segment(name, list_name, 'static')
users.each do |user|
@gb.lists.subscribe({id: @list_id, email: {email:}, merge_vars: {FNAME: user.display_name, LNAME: user.display_name}, double_optin: false})
#batch = users.is_a?(Array) ? users.collect{ |u| {email:} } : (users.kind_of?(User) ? [{ email: }] : [{ email: users.to_s }])
@gb.lists.static_segment_members_add({ id: @list_id, seg_id: segment["id"], batch: users})#if list_id and segment and batch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment