Sha256: af63e36ca5fa2c1f8816777e5fd4fe03c13e9989ec14d3a20572bad262ce707e

Contents?: true

Size: 571 Bytes

Versions: 6

Compression:

Stored size: 571 Bytes

Contents

module Mailkick
  class Service
    def fetch_opt_outs
      opt_outs.each do |api_data|
        email = api_data[:email]
        time = api_data[:time]

        opt_out = Mailkick::OptOut.where(email: email).order("updated_at desc").first
        if !opt_out || (time > opt_out.updated_at && !opt_out.active)
          Mailkick.opt_out(
            email: email,
            user: Mailkick.user_method ? Mailkick.user_method.call(email) : nil,
            reason: api_data[:reason],
            time: time
          )
        end
      end

      true
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mailkick-0.4.3 lib/mailkick/service.rb
mailkick-0.4.2 lib/mailkick/service.rb
mailkick-0.4.1 lib/mailkick/service.rb
mailkick-0.4.0 lib/mailkick/service.rb
mailkick-0.3.1 lib/mailkick/service.rb
mailkick-0.3.0 lib/mailkick/service.rb