Sha256: 5209d0f3641fdd1ab2794ab8abe3dd9fca43217db710847a807a6e087b0a6de4

Contents?: true

Size: 573 Bytes

Versions: 5

Compression:

Stored size: 573 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 or (time > opt_out.updated_at and !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

5 entries across 5 versions & 1 rubygems

Version Path
mailkick-0.1.1 lib/mailkick/service.rb
mailkick-0.1.0 lib/mailkick/service.rb
mailkick-0.0.6 lib/mailkick/service.rb
mailkick-0.0.5 lib/mailkick/service.rb
mailkick-0.0.4 lib/mailkick/service.rb