Skip to content

Instantly share code, notes, and snippets.

@igmarin
Last active Jan 4, 2016
Embed
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: user.email}, merge_vars: {FNAME: user.display_name, LNAME: user.display_name}, double_optin: false})
end
#batch = users.is_a?(Array) ? users.collect{ |u| {email: u.email} } : (users.kind_of?(User) ? [{ email: users.email }] : [{ email: users.to_s }])
#users
@gb.lists.static_segment_members_add({ id: @list_id, seg_id: segment["id"], batch: users})#if list_id and segment and batch
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment