View difference between Paste ID: SQn3iaim and iFhBpMBX
SHOW: | | - or go back to the newest paste.
1
require 'rubygems'
2
require 'json'
3
4
custom_fields = [ 
5
  { :Key => 'memstatus', :Value => "{account_status}"},
6
  { :Key => 'memtype', :Value => "{user.member_type}"},
7
  { :Key => 'memsincedate', :Value => "{member_since.to_date}"},
8
  { :Key => 'memrenewaldate', :Value => "{user.account.renewal_date.to_date}"},
9
  { :Key => 'usertype', :Value => "{user_type}"},
10
  #{ :Key => 'neighborhood group', :Value => "#{neighborhood_groups.join('||')}", :DataType => 'Multi-Options'},
11
  #{ :Key => 'social group', :Value => "social_groups.join('||')", :DataType => 'Multi-Options'}
12
]
13
14
neighborhood_groups = %w[ a b c ]
15
neighborhood_groups.each {|value| custom_fields << {:Key => 'neighborhood group', :Value => "#{value}"}}
16
17
social_groups = %w[ 1 2 3 ]
18
social_groups.each {|value| custom_fields << {:Key => 'social group', :Value => "#{value}"}}
19
20
subscribers = [{ :EmailAddress => "{user.email}", :Name => "{user.last_name}, {user.first_name}", :CustomFields => custom_fields }]
21
22
puts JSON.generate(subscribers)