Class: Effective::PostmarkApi
- Inherits:
-
Object
- Object
- Effective::PostmarkApi
- Defined in:
- app/models/effective/postmark_api.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(api_token:) ⇒ PostmarkApi
constructor
A new instance of PostmarkApi.
-
#reactivate(user) ⇒ Object
EffectivePostmark.api.reactivate(email).
Constructor Details
#initialize(api_token:) ⇒ PostmarkApi
Returns a new instance of PostmarkApi.
7 8 9 10 |
# File 'app/models/effective/postmark_api.rb', line 7 def initialize(api_token:) raise('expected an api token') unless api_token.present? @client = ::Postmark::ApiClient.new(api_token) end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
5 6 7 |
# File 'app/models/effective/postmark_api.rb', line 5 def client @client end |
Instance Method Details
#reactivate(user) ⇒ Object
EffectivePostmark.api.reactivate(email)
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/effective/postmark_api.rb', line 13 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 |