lib/postini/automated_batch_service.rb
# Modify a user extensively by providing any of the following keys
# in the changes hash
#
# :active => bool
# :address => string (change the email address)
# :approved_recipients => array (full or changes)
# :approved_senders => array (full or changes)
# :blocked_senders => array (full or changes)
# :filter_adult => string
# :filter_bulk => string
# :filter_getrich => string
# :filter_offers => string
# :filter_racial => string
# :initial_password => string
# :junkemail_filter => bool
# :lang_locale => string
# :message_limit => integer
# :message_limited => bool
# :notice_address => string
# :org => string
# :password => string
# :virus_notify => bool
# :virus_state => bool
# :weblocked => bool
# :wireless_state => string
#
# Notes on array parameters: Provide the full set of values, or an
# array of diffs (new entries prepended with a plus (+) and
# entries to be removed prepended with a hyphen (-).
#
# Notes on *all* parameters: I don't use all of these, nor will I
# ever, so please test them well and report any bugs to me.
Modify a user extensively by providing any of the following keys
in the changes hash



Notes on array parameters: Provide the full set of values, or an
array of diffs (new entries prepended with a plus (+) and
entries to be removed prepended with a hyphen (-).

Notes on *all* parameters: I don't use all of these, nor will I
ever, so please test them well and report any bugs to me.
Modify a user extensively by providing any of the following keys in the changes hash Notes on array parameters : Provide the full set of values or an array of diffs ( new entries prepended with a plus ( + ) and entries to be removed prepended with a hyphen ( - ) . Notes on * all * parameters : I don ' t use all of these nor will I ever so please test them well and report any bugs to me .
def modify_user( address, changes = {} )
      valid_changes = {}
      valid_changes[:orgid] = changes[:org] if changes.has_key?(:org)
      [ :active, :address, :filter_adult, :filter_bulk, :filter_getrich,
        :filter_offers, :filter_racial, :initial_password, :lang_locale,
        :notice_address, :password, :wireless_state, :message_limit
      ].each do |k|
        valid_changes[k] = changes[k] if changes.has_key?(k)
      end
      [ :active, :junkemail_filter, :message_limited, :virus_notify,
        :virus_state, :weblocked
      ].each do |k|
        if changes.has_key?(k)
          valid_changes[k] = ( changes[k] == true ? 'yes' : 'no' )
        end
      end
      [ :approved_senders, :approved_recipients, :blocked_senders ].each do |k|
        if changes.has_key?( k )
          valid_changes[k] = changes[k].join(', ')
        end
      end
      response = invoke("aut:modifyuser") do |message|
        build_auth!( message )
        message.add('userAddressOrId', address)
        message.add('userModifications') do |mods|
          valid_changes.each do |k,v|
            mods.add( k.to_s, v )
          end
        end
      end
      address = valid_changes[:address] || address
      display_user( address )
    end
def modify_user ( address , changes = { } ) valid_changes = { } valid_changes [ :orgid ] = changes [ :org ] if changes . has_key? ( :org ) [ :active , :address , :filter_adult , :filter_bulk , :filter_getrich , :filter_offers , :filter_racial , :initial_password , :lang_locale , :notice_address , :password , :wireless_state , :message_limit ] . each do | k | valid_changes [ k ] = changes [ k ] if changes . has_key? ( k ) end [ :active , :junkemail_filter , :message_limited , :virus_notify , :virus_state , :weblocked ] . each do | k | if changes . has_key? ( k ) valid_changes [ k ] = ( changes [ k ] == true ? 'yes' : 'no' ) end end [ :approved_senders , :approved_recipients , :blocked_senders ] . each do | k | if changes . has_key? ( k ) valid_changes [ k ] = changes [ k ] . join ( ', ' ) end end response = invoke ( "aut:modifyuser" ) do | message | build_auth! ( message ) message . add ( 'userAddressOrId' , address ) message . add ( 'userModifications' ) do | mods | valid_changes . each do | k , v | mods . add ( k . to_s , v ) end end end address = valid_changes [ :address ] || address display_user ( address ) end
Modify a user extensively by providing any of the following keys
in the changes hash
Modify a user extensively by providing any of the following keys in the changes hash
# Vanilla string copies # Booleans need some special handling # Join the arrays # pray
address
<not_specific>
changes
<not_specific>