Sha256: 24752ac56f4516a080f3fafcb2ee79122ac9132ddee4e45da7f3e4ad62d0def7

Contents?: true

Size: 570 Bytes

Versions: 7

Compression:

Stored size: 570 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

7 entries across 7 versions & 1 rubygems

Version Path
mailkick-0.2.1 lib/mailkick/service.rb
mailkick-0.2.0 lib/mailkick/service.rb
mailkick-0.1.6 lib/mailkick/service.rb
mailkick-0.1.5 lib/mailkick/service.rb
mailkick-0.1.4 lib/mailkick/service.rb
mailkick-0.1.3 lib/mailkick/service.rb
mailkick-0.1.2 lib/mailkick/service.rb