From db434c68ca84d494ed414a903c2e883ecb482f63 Mon Sep 17 00:00:00 2001 From: Postmodern Date: Mon, 1 Jul 2013 12:18:42 -0700 Subject: [PATCH] Added Fog::AWS::SES.verify_domain_identity. * http://docs.aws.amazon.com/ses/latest/APIReference/API_VerifyDomainIdentity.html * Added Fog::Parsers::AWS::SES::VerifyDomainIdentity. --- .../aws/parsers/ses/verify_domain_identity.rb | 26 ++++++++++++++++ .../requests/ses/verify_domain_identity.rb | 30 +++++++++++++++++++ lib/fog/aws/ses.rb | 1 + .../ses/verified_domain_identity_tests.rb | 16 ++++++++++ 4 files changed, 73 insertions(+) create mode 100644 lib/fog/aws/parsers/ses/verify_domain_identity.rb create mode 100644 lib/fog/aws/requests/ses/verify_domain_identity.rb create mode 100644 tests/aws/requests/ses/verified_domain_identity_tests.rb 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