Sha256: b613785359d1b7c9f74ad871e57ab3cea869798e584e57c954d1726af0b11a6e

Contents?: true

Size: 870 Bytes

Versions: 1

Compression:

Stored size: 870 Bytes

Contents

class DelayedSubscriberDelete < Struct.new(:store_code, :user, :list)
  def perform
    if list.nil? || !user
      subscriber_id = -1
    else
      begin
        token= Spree::BrontoConfiguration.account[store_code]['token']
        if user.is_a? String
          email=user
        else
          email=user.email
        end
        unless email.empty?
        communication = BrontoIntegration::Communication.new(token)
        communication.remove_from_list(list.title,email)
        end
      rescue => exception
        #raise exception
      end
    end

    unless user.is_a? String    # update  exact_target_lists
      begin
        list_del=user.bronto_lists.select{|l| l.id== list.id}
        if list_del.length>0
          user.bronto_lists.delete(list_del)
        end
        user.save!
      rescue
        #raise exception
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_bronto-3.0.0 lib/delayed_subscriber_delete.rb