mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 07:52:04 +02:00
Restructure bounced mails view
This commit is contained in:
parent
140df0acf7
commit
6af37a787d
2 changed files with 55 additions and 28 deletions
|
@ -1,2 +1,24 @@
|
|||
class BouncedMailAddress < ApplicationRecord
|
||||
validates :email, presence: true
|
||||
validates :bounce_reason, presence: true
|
||||
|
||||
def diagnostic
|
||||
response_json['diagnosticCode']
|
||||
end
|
||||
|
||||
def action
|
||||
response_json['action']
|
||||
end
|
||||
|
||||
def status
|
||||
response_json['status']
|
||||
end
|
||||
|
||||
def self.record(json)
|
||||
bounced_records = json['bounce']['bouncedRecipients']
|
||||
bounced_records.each do |record|
|
||||
bounce_record = BouncedMailAddress.new(email: record['emailAddress'], response_json: record)
|
||||
bounce_record.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue