18F/identity-idp

View on GitHub
app/services/push_notification/identifier_recycled_event.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

module PushNotification
  class IdentifierRecycledEvent
    EVENT_TYPE = 'https://schemas.openid.net/secevent/risc/event-type/identifier-recycled'

    attr_reader :user, :email

    def initialize(user:, email:)
      @user = user
      @email = email
    end

    def event_type
      EVENT_TYPE
    end

    def payload(*)
      {
        subject: {
          subject_type: 'email',
          email: email,
        },
      }
    end

    def ==(other)
      self.class == other.class && user == other.user && email == other.email
    end
  end
end