Sha256: 2672ecd61d6b50ee785de386c9bb93c8855eda1d3a1cc2852b49b6c9b86dd1f9

Contents?: true

Size: 844 Bytes

Versions: 7

Compression:

Stored size: 844 Bytes

Contents

# https://github.com/ActiveCampaign/postmark-gem/blob/main/lib/postmark/api_client.rb

module Effective
  class PostmarkApi
    attr_accessor :client

    def initialize(api_token:)
      raise('expected an api token') unless api_token.present?
      @client = ::Postmark::ApiClient.new(api_token)
    end

    # EffectivePostmark.api.reactivate(email)
    def reactivate(user)
      raise('expected an effective_postmark_user') unless user.class.try(:effective_postmark_user?)

      # Emails to reactivate
      emails = [user.email, user.try(:alternate_email).presence].compact

      # There are multiple streams. outbound / broadcast / inbound
      begin
        client.delete_suppressions(:outbound, emails)
        client.delete_suppressions(:broadcast, emails)
        true
      rescue => e
        false
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
effective_postmark-0.3.1 app/models/effective/postmark_api.rb
effective_postmark-0.3.0 app/models/effective/postmark_api.rb
effective_postmark-0.2.0 app/models/effective/postmark_api.rb
effective_postmark-0.1.3 app/models/effective/postmark_api.rb
effective_postmark-0.1.2 app/models/effective/postmark_api.rb
effective_postmark-0.1.1 app/models/effective/postmark_api.rb
effective_postmark-0.1.0 app/models/effective/postmark_api.rb