diff --git a/lib/fog/aws/parsers/ses/verify_domain_identity.rb b/lib/fog/aws/parsers/ses/verify_domain_identity.rb new file mode 100644 index 000000000..63ba4e2f0 --- /dev/null +++ b/lib/fog/aws/parsers/ses/verify_domain_identity.rb @@ -0,0 +1,26 @@ +module Fog + module Parsers + module AWS + module SES + + class VerifyDomainIdentity < Fog::Parsers::Base + + def reset + @response = { 'ResponseMetadata' => {} } + end + + def end_element(name) + case name + when 'VerificationToken' + @response[name] = value + when 'RequestId' + @response['ResponseMetadata'][name] = value + end + end + + end + + end + end + end +end diff --git a/lib/fog/aws/requests/ses/verify_domain_identity.rb b/lib/fog/aws/requests/ses/verify_domain_identity.rb new file mode 100644 index 000000000..e0ae06f42 --- /dev/null +++ b/lib/fog/aws/requests/ses/verify_domain_identity.rb @@ -0,0 +1,30 @@ +module Fog + module AWS + class SES + class Real + + require 'fog/aws/parsers/ses/verify_domain_identity' + + # Verifies a domain. This action returns a verification authorization + # token which must be added as a DNS TXT record to the domain. + # + # ==== Parameters + # * domain<~String> - The domain to be verified + # ==== Returns + # * response<~Excon::Response>: + # * body<~Hash>: + # * 'ResponseMetadata'<~Hash>: + # * 'VerificationToken'<~String> - Verification token + # * 'RequestId'<~String> - Id of request + def verify_domain(domain) + request({ + 'Action' => 'VerifyDomainIdentity', + 'Domain' => domain, + :parser => Fog::Parsers::AWS::SES::VerifyDomainIdentity.new + }) + end + + end + end + end +end diff --git a/lib/fog/aws/ses.rb b/lib/fog/aws/ses.rb index fbaa44382..3d03c4ea8 100644 --- a/lib/fog/aws/ses.rb +++ b/lib/fog/aws/ses.rb @@ -11,6 +11,7 @@ module Fog request_path 'fog/aws/requests/ses' request :delete_verified_email_address request :verify_email_address + request :verify_domain_identity request :get_send_quota request :get_send_statistics request :list_verified_email_addresses diff --git a/tests/aws/requests/ses/verified_domain_identity_tests.rb b/tests/aws/requests/ses/verified_domain_identity_tests.rb new file mode 100644 index 000000000..411f64299 --- /dev/null +++ b/tests/aws/requests/ses/verified_domain_identity_tests.rb @@ -0,0 +1,16 @@ +Shindo.tests('AWS::SES | verified email address requests', ['aws', 'ses']) do + + tests('success') do + + tests("#verify_domain_identity('example.com')").formats(AWS::SES::Formats::BASIC) do + pending if Fog.mocking? + Fog::AWS[:ses].verify_email_address('example.com').body + end + + end + + tests('failure') do + + end + +end