13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/ses_proxy/models/verified_sender.rb', line 13
def self.update_identities(client)
print "Update verified identities... "
resp = client.list_identities
identities = resp.data[:identities]
resp = client.get_identity_verification_attributes :identities => identities
VerifiedSender.delete_all
_resp = {:emails => [], :domains => []}.with_indifferent_access
resp[:verification_attributes].each do |identity, attributes|
_type = identity.match('@') ? 'email' : 'domain'
next unless attributes[:verification_status].eql? "Success"
_resp[_type.pluralize] << VerifiedSender.create({:ses_identity => identity, :type => _type, :created_at => Time.now, :updated_at => Time.now})
end
_resp
puts "OK"
end
|