aws-ses 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ 0.4.0:
2
+ * This version may have some small incompatibilities due to adding support for MessageId. Check that the result still matches what you previously expected.
3
+ * Added MessageId support in responses
4
+ * Improved resulting data from many responses
5
+ * Added tests and documentation for quota and statistics
6
+ * Added Rails 2.3.x support ( I HOPE!!! )
7
+
1
8
  0.3.2:
2
9
  * Removed unused extensions that were conflicting with S3
3
10
 
data/README.erb CHANGED
@@ -16,11 +16,13 @@
16
16
 
17
17
  == Rails
18
18
 
19
- This gem is compatible with Rails >= 3.0.0
19
+ This gem is compatible with Rails >= 3.0.0 and Rails 2.3.x
20
20
 
21
21
  To use, first add the gem to your Gemfile:
22
22
 
23
- gem "aws-ses", "~> 0.3.1", :require => 'aws/ses'
23
+ gem "aws-ses", "~> 0.4.0", :require => 'aws/ses'
24
+
25
+ == For Rails 3.x
24
26
 
25
27
  Then, add your Amazon credentials and extend ActionMailer in `config/initializers/amazon_ses.rb`:
26
28
 
@@ -32,6 +34,15 @@ Then set the delivery method in `config/environments/*rb` as appropriate:
32
34
 
33
35
  config.action_mailer.delivery_method = :ses
34
36
 
37
+ == For Rails 2.3.x
38
+
39
+ Then set the delivery method in `config/environments/*rb` as appropriate:
40
+
41
+ config.after_initialize do
42
+ ActionMailer::Base.delivery_method = :amazon_ses
43
+ ActionMailer::Base.custom_amazon_ses_mailer = AWS::SES::Base.new(:secret_access_key => 'abc', :access_key_id => '123')
44
+ end
45
+
35
46
  == Source
36
47
 
37
48
  Available at: https://github.com/drewblas/aws-ses
@@ -53,3 +64,9 @@ Copyright (c) 2011 Drew Blas. See LICENSE for further details.
53
64
  == Thanks
54
65
 
55
66
  Special thanks to Marcel Molina Jr. for his creation of AWS::S3 which I used portions of to get things working.
67
+
68
+ === Other Contributors:
69
+
70
+ * croaky
71
+ * nathanbertram
72
+ * sshaw
@@ -62,18 +62,65 @@ You can access these methods as follows:
62
62
 
63
63
  == Info
64
64
 
65
- Adds functionality for the statistics and info functionality
65
+ Adds functionality for the statistics and info send quota data that Amazon SES makes available
66
66
 
67
- You can call 'quota' or 'statistics'
67
+ You can access these methods as follows:
68
+
69
+ ses = AWS::SES::Base.new( ... connection info ... )
70
+
71
+ == Get the quota information
72
+ response = ses.quota
73
+ # How many e-mails you've sent in the last 24 hours
74
+ response.send_last_24_hours
75
+ # How many e-mails you're allowed to send in 24 hours
76
+ response.max_24_hour_send
77
+ # How many e-mails you can send per second
78
+ response.max_send_rate
79
+
80
+ == Get detailed send statistics
81
+ The result is a list of data points, representing the last two weeks of sending activity.
82
+ Each data point in the list contains statistics for a 15-minute interval.
83
+ GetSendStatisticsResponse#data_points is an array where each element is a hash with give string keys:
84
+
85
+ * +Bounces+
86
+ * +DeliveryAttempts+
87
+ * +Rejects+
88
+ * +Complaints+
89
+ * +Timestamp+
90
+
91
+ response = ses.statistics
92
+ response.data_points # =>
93
+ [{"Bounces"=>"0",
94
+ "Timestamp"=>"2011-01-26T16:30:00Z",
95
+ "DeliveryAttempts"=>"1",
96
+ "Rejects"=>"0",
97
+ "Complaints"=>"0"},
98
+ {"Bounces"=>"0",
99
+ "Timestamp"=>"2011-02-09T14:45:00Z",
100
+ "DeliveryAttempts"=>"3",
101
+ "Rejects"=>"0",
102
+ "Complaints"=>"0"},
103
+ {"Bounces"=>"0",
104
+ "Timestamp"=>"2011-01-31T15:30:00Z",
105
+ "DeliveryAttempts"=>"3",
106
+ "Rejects"=>"0",
107
+ "Complaints"=>"0"},
108
+ {"Bounces"=>"0",
109
+ "Timestamp"=>"2011-01-31T16:00:00Z",
110
+ "DeliveryAttempts"=>"3",
111
+ "Rejects"=>"0",
112
+ "Complaints"=>"0"}]
68
113
 
69
114
 
70
115
  == Rails
71
116
 
72
- This gem is compatible with Rails >= 3.0.0
117
+ This gem is compatible with Rails >= 3.0.0 and Rails 2.3.x
73
118
 
74
119
  To use, first add the gem to your Gemfile:
75
120
 
76
121
  gem "aws-ses", "~> 0.3.1", :require => 'aws/ses'
122
+
123
+ == For Rails 3.x
77
124
 
78
125
  Then, add your Amazon credentials and extend ActionMailer in `config/initializers/amazon_ses.rb`:
79
126
 
@@ -85,6 +132,15 @@ Then set the delivery method in `config/environments/*rb` as appropriate:
85
132
 
86
133
  config.action_mailer.delivery_method = :ses
87
134
 
135
+ == For Rails 2.3.x
136
+
137
+ Then set the delivery method in `config/environments/*rb` as appropriate:
138
+
139
+ config.after_initialize do
140
+ ActionMailer::Base.delivery_method = :amazon_ses
141
+ ActionMailer::Base.custom_amazon_ses_mailer = AWS::SES::Base.new(:secret_access_key => 'abc', :access_key_id => '123')
142
+ end
143
+
88
144
  == Source
89
145
 
90
146
  Available at: https://github.com/drewblas/aws-ses
@@ -106,3 +162,9 @@ Copyright (c) 2011 Drew Blas. See LICENSE for further details.
106
162
  == Thanks
107
163
 
108
164
  Special thanks to Marcel Molina Jr. for his creation of AWS::S3 which I used portions of to get things working.
165
+
166
+ === Other Contributors:
167
+
168
+ * croaky
169
+ * nathanbertram
170
+ * sshaw
data/TODO CHANGED
@@ -1 +1,3 @@
1
1
  * Use a better XML parser (and be consistent)
2
+ * Rename Base to something else (probably Mailer): Nothing else actually inherits from Base, so that is a very poor naming convention. I intend to change it in the future
3
+ * Integer responses should probably be cast to ints instead of left as strings
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.4.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{aws-ses}
8
- s.version = "0.3.2"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Drew Blas", "Marcel Molina Jr."]
12
- s.date = %q{2011-02-03}
12
+ s.date = %q{2011-02-09}
13
13
  s.description = %q{Client library for Amazon's Simple Email Service's REST API}
14
14
  s.email = %q{drew.blas@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
30
30
  "TODO",
31
31
  "VERSION",
32
32
  "aws-ses.gemspec",
33
+ "lib/aws/actionmailer/ses_extension.rb",
33
34
  "lib/aws/ses.rb",
34
35
  "lib/aws/ses/addresses.rb",
35
36
  "lib/aws/ses/base.rb",
@@ -38,10 +39,12 @@ Gem::Specification.new do |s|
38
39
  "lib/aws/ses/response.rb",
39
40
  "lib/aws/ses/send_email.rb",
40
41
  "lib/aws/ses/version.rb",
42
+ "test/address_test.rb",
41
43
  "test/base_test.rb",
42
44
  "test/extensions_test.rb",
43
45
  "test/fixtures.rb",
44
46
  "test/helper.rb",
47
+ "test/info_test.rb",
45
48
  "test/mocks/fake_response.rb",
46
49
  "test/response_test.rb",
47
50
  "test/send_email_test.rb"
@@ -52,10 +55,12 @@ Gem::Specification.new do |s|
52
55
  s.rubygems_version = %q{1.4.2}
53
56
  s.summary = %q{Client library for Amazon's Simple Email Service's REST API}
54
57
  s.test_files = [
58
+ "test/address_test.rb",
55
59
  "test/base_test.rb",
56
60
  "test/extensions_test.rb",
57
61
  "test/fixtures.rb",
58
62
  "test/helper.rb",
63
+ "test/info_test.rb",
59
64
  "test/mocks/fake_response.rb",
60
65
  "test/response_test.rb",
61
66
  "test/send_email_test.rb"
@@ -0,0 +1,19 @@
1
+ # A quick little extension to use this lib with with rails 2.3.X
2
+ # To use it, in your environment.rb or some_environment.rb you simply set
3
+ #
4
+ # config.after_initialize do
5
+ # ActionMailer::Base.delivery_method = :amazon_ses
6
+ # ActionMailer::Base.custom_amazon_ses_mailer = AWS::SES::Base.new(:secret_access_key => S3_CONFIG[:secret_access_key], :access_key_id => S3_CONFIG[:access_key_id])
7
+ # end
8
+
9
+ module ActionMailer
10
+ class Base
11
+ cattr_accessor :custom_amazon_ses_mailer
12
+
13
+ def perform_delivery_amazon_ses(mail)
14
+ raise 'AWS::SES::Base has not been intitialized.' unless @@custom_amazon_ses_mailer
15
+ @@custom_amazon_ses_mailer.deliver!(mail)
16
+ end
17
+
18
+ end
19
+ end
@@ -20,4 +20,9 @@ require 'ses/send_email'
20
20
  require 'ses/info'
21
21
  require 'ses/base'
22
22
  require 'ses/version'
23
- require 'ses/addresses'
23
+ require 'ses/addresses'
24
+
25
+ if defined?(Rails)
26
+ major, minor = Rails.version.split('.')
27
+ require 'actionmailer/ses_extension' if major == '2' && minor == '3'
28
+ end
@@ -47,12 +47,13 @@ module AWS
47
47
 
48
48
  class ListVerifiedEmailAddressesResponse < AWS::SES::Response
49
49
  def result
50
- if members = parsed['VerifiedEmailAddresses']
50
+ if members = parsed['ListVerifiedEmailAddressesResult']['VerifiedEmailAddresses']
51
51
  [members['member']].flatten
52
52
  else
53
53
  []
54
54
  end
55
55
  end
56
+ memoized :result
56
57
  end
57
58
 
58
59
  class VerifyEmailAddressResponse < AWS::SES::Response
@@ -127,8 +127,8 @@ module AWS #:nodoc:
127
127
  # allow us to have a one line call in each method which will do all of the work
128
128
  # in making the actual request to AWS.
129
129
  def request(action, params = {})
130
- # remove any keys that have nil or empty values
131
- params.reject! { |key, value| value.nil? or value.empty?}
130
+ # Use a copy so that we don't modify the caller's Hash, remove any keys that have nil or empty values
131
+ params = params.reject { |key, value| value.nil? or value.empty?}
132
132
 
133
133
  timestamp = Time.now.getutc
134
134
 
@@ -1,8 +1,54 @@
1
1
  module AWS
2
2
  module SES
3
- # Adds functionality for the statistics and info functionality
3
+ # Adds functionality for the statistics and info send quota data that Amazon SES makes available
4
4
  #
5
- # You can call 'quota' or 'statistics'
5
+ # You can access these methods as follows:
6
+ #
7
+ # ses = AWS::SES::Base.new( ... connection info ... )
8
+ #
9
+ # == Get the quota information
10
+ # response = ses.quota
11
+ # # How many e-mails you've sent in the last 24 hours
12
+ # response.send_last_24_hours
13
+ # # How many e-mails you're allowed to send in 24 hours
14
+ # response.max_24_hour_send
15
+ # # How many e-mails you can send per second
16
+ # response.max_send_rate
17
+ #
18
+ # == Get detailed send statistics
19
+ # The result is a list of data points, representing the last two weeks of sending activity.
20
+ # Each data point in the list contains statistics for a 15-minute interval.
21
+ # GetSendStatisticsResponse#data_points is an array where each element is a hash with give string keys:
22
+ #
23
+ # * +Bounces+
24
+ # * +DeliveryAttempts+
25
+ # * +Rejects+
26
+ # * +Complaints+
27
+ # * +Timestamp+
28
+ #
29
+ # response = ses.statistics
30
+ # response.data_points # =>
31
+ # [{"Bounces"=>"0",
32
+ # "Timestamp"=>"2011-01-26T16:30:00Z",
33
+ # "DeliveryAttempts"=>"1",
34
+ # "Rejects"=>"0",
35
+ # "Complaints"=>"0"},
36
+ # {"Bounces"=>"0",
37
+ # "Timestamp"=>"2011-02-09T14:45:00Z",
38
+ # "DeliveryAttempts"=>"3",
39
+ # "Rejects"=>"0",
40
+ # "Complaints"=>"0"},
41
+ # {"Bounces"=>"0",
42
+ # "Timestamp"=>"2011-01-31T15:30:00Z",
43
+ # "DeliveryAttempts"=>"3",
44
+ # "Rejects"=>"0",
45
+ # "Complaints"=>"0"},
46
+ # {"Bounces"=>"0",
47
+ # "Timestamp"=>"2011-01-31T16:00:00Z",
48
+ # "DeliveryAttempts"=>"3",
49
+ # "Rejects"=>"0",
50
+ # "Complaints"=>"0"}]
51
+
6
52
  module Info
7
53
  # Returns quota information provided by SES
8
54
  #
@@ -18,9 +64,37 @@ module AWS
18
64
  end
19
65
 
20
66
  class GetSendQuotaResponse < AWS::SES::Response
67
+ def result
68
+ parsed['GetSendQuotaResult']
69
+ end
70
+
71
+ def sent_last_24_hours
72
+ result['SentLast24Hours']
73
+ end
74
+
75
+ def max_24_hour_send
76
+ result['Max24HourSend']
77
+ end
78
+
79
+ def max_send_rate
80
+ result['MaxSendRate']
81
+ end
21
82
  end
22
83
 
23
84
  class GetSendStatisticsResponse < AWS::SES::Response
85
+ def result
86
+ if members = parsed['GetSendStatisticsResult']['SendDataPoints']
87
+ [members['member']].flatten
88
+ else
89
+ []
90
+ end
91
+ end
92
+
93
+ memoized :result
94
+
95
+ def data_points
96
+ result
97
+ end
24
98
  end
25
99
  end
26
100
  end
@@ -54,8 +54,7 @@ module AWS
54
54
  parse_options = { 'forcearray' => ['item', 'member'], 'suppressempty' => nil, 'keeproot' => false }
55
55
  # parse_options = { 'suppressempty' => nil, 'keeproot' => false }
56
56
 
57
- xml = XmlSimple.xml_in(body, parse_options)
58
- xml["#{@action}Result"] || xml
57
+ XmlSimple.xml_in(body, parse_options)
59
58
  end
60
59
  memoized :parsed
61
60
 
@@ -63,9 +62,13 @@ module AWS
63
62
  def result
64
63
  parsed
65
64
  end
65
+
66
+ def request_id
67
+ error? ? parsed['RequestId'] : parsed['ResponseMetadata']['RequestId']
68
+ end
66
69
 
67
70
  def inspect
68
- "#<%s:0x%s %s %s>" % [self.class, object_id, response.code, response.message]
71
+ "#<%s:0x%s %s %s %s>" % [self.class, object_id, request_id, response.code, response.message]
69
72
  end
70
73
  end # class Response
71
74
 
@@ -99,7 +102,7 @@ module AWS
99
102
  end
100
103
 
101
104
  def inspect
102
- "#<%s:0x%s %s '%s'>" % [self.class.name, object_id, code, message]
105
+ "#<%s:0x%s %s %s '%s'>" % [self.class.name, object_id, @response.request_id, code, message]
103
106
  end
104
107
  end
105
108
  end # module SES
@@ -103,11 +103,21 @@ module AWS
103
103
  end
104
104
  end
105
105
 
106
- class SendEmailResponse < AWS::SES::Response
106
+ class EmailResponse < AWS::SES::Response
107
+ def result
108
+ super["#{action}Result"]
109
+ end
107
110
 
111
+ def message_id
112
+ result['MessageId']
113
+ end
114
+ end
115
+
116
+ class SendEmailResponse < EmailResponse
117
+
108
118
  end
109
119
 
110
- class SendRawEmailResponse < AWS::SES::Response
120
+ class SendRawEmailResponse < EmailResponse
111
121
 
112
122
  end
113
123
  end
@@ -2,8 +2,8 @@ module AWS
2
2
  module SES
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = '0'
5
- MINOR = '3'
6
- TINY = '2'
5
+ MINOR = '4'
6
+ TINY = '0'
7
7
  BETA = Time.now.to_i.to_s
8
8
  end
9
9
 
@@ -0,0 +1,72 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class AddressTest < Test::Unit::TestCase
4
+ context 'verifying an address' do
5
+ setup do
6
+ @base = generate_base
7
+ end
8
+
9
+ should 'return the correct response on success' do
10
+ mock_connection(@base, :body => %{
11
+ <VerifyEmailAddressResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
12
+ <ResponseMetadata>
13
+ <RequestId>abc-123</RequestId>
14
+ </ResponseMetadata>
15
+ </VerifyEmailAddressResponse>
16
+ })
17
+
18
+ result = @base.addresses.verify('user1@example.com')
19
+ assert result.success?
20
+ assert_equal 'abc-123', result.request_id
21
+ end
22
+ end
23
+
24
+ context 'listing verified addressess' do
25
+ setup do
26
+ @base = generate_base
27
+ end
28
+
29
+ should 'return the correct response on success' do
30
+ mock_connection(@base, :body => %{
31
+ <ListVerifiedEmailAddressesResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
32
+ <ListVerifiedEmailAddressesResult>
33
+ <VerifiedEmailAddresses>
34
+ <member>user1@example.com</member>
35
+ </VerifiedEmailAddresses>
36
+ </ListVerifiedEmailAddressesResult>
37
+ <ResponseMetadata>
38
+ <RequestId>abc-123</RequestId>
39
+ </ResponseMetadata>
40
+ </ListVerifiedEmailAddressesResponse>
41
+ })
42
+
43
+ result = @base.addresses.list
44
+
45
+ assert result.success?
46
+ assert_equal 'abc-123', result.request_id
47
+ assert_equal %w{user1@example.com}, result.result
48
+ end
49
+ end
50
+
51
+
52
+ context 'deleting a verified addressess' do
53
+ setup do
54
+ @base = generate_base
55
+ end
56
+
57
+ should 'return the correct response on success' do
58
+ mock_connection(@base, :body => %{
59
+ <DeleteVerifiedEmailAddressResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
60
+ <ResponseMetadata>
61
+ <RequestId>abc-123</RequestId>
62
+ </ResponseMetadata>
63
+ </DeleteVerifiedEmailAddressResponse>
64
+ })
65
+
66
+ result = @base.addresses.delete('user1@example.com')
67
+
68
+ assert result.success?
69
+ assert_equal 'abc-123', result.request_id
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,108 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class InfoTest < Test::Unit::TestCase
4
+ context 'getting send quota' do
5
+ setup do
6
+ @base = generate_base
7
+ end
8
+
9
+ should 'return the correct response on success' do
10
+ mock_connection(@base, :body => %{
11
+ <GetSendQuotaResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
12
+ <GetSendQuotaResult>
13
+ <SentLast24Hours>0.0</SentLast24Hours>
14
+ <Max24HourSend>1000.0</Max24HourSend>
15
+ <MaxSendRate>1.0</MaxSendRate>
16
+ </GetSendQuotaResult>
17
+ <ResponseMetadata>
18
+ <RequestId>abc-123</RequestId>
19
+ </ResponseMetadata>
20
+ </GetSendQuotaResponse>
21
+ })
22
+
23
+ result = @base.quota
24
+ assert result.success?
25
+ assert_equal 'abc-123', result.request_id
26
+ assert_equal '0.0', result.sent_last_24_hours
27
+ assert_equal '1000.0', result.max_24_hour_send
28
+ assert_equal '1.0', result.max_send_rate
29
+ end
30
+ end
31
+
32
+ context 'getting send statistics' do
33
+ setup do
34
+ @base = generate_base
35
+ end
36
+
37
+ should 'return the correct response on success' do
38
+ mock_connection(@base, :body => %{
39
+ <GetSendStatisticsResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
40
+ <GetSendStatisticsResult>
41
+ <SendDataPoints>
42
+ <member>
43
+ <DeliveryAttempts>3</DeliveryAttempts>
44
+ <Timestamp>2011-01-31T15:31:00Z</Timestamp>
45
+ <Rejects>2</Rejects>
46
+ <Bounces>4</Bounces>
47
+ <Complaints>1</Complaints>
48
+ </member>
49
+ <member>
50
+ <DeliveryAttempts>3</DeliveryAttempts>
51
+ <Timestamp>2011-01-31T16:01:00Z</Timestamp>
52
+ <Rejects>0</Rejects>
53
+ <Bounces>0</Bounces>
54
+ <Complaints>0</Complaints>
55
+ </member>
56
+ <member>
57
+ <DeliveryAttempts>1</DeliveryAttempts>
58
+ <Timestamp>2011-01-26T16:31:00Z</Timestamp>
59
+ <Rejects>0</Rejects>
60
+ <Bounces>0</Bounces>
61
+ <Complaints>0</Complaints>
62
+ </member>
63
+ </SendDataPoints>
64
+ </GetSendStatisticsResult>
65
+ <ResponseMetadata>
66
+ <RequestId>abc-123</RequestId>
67
+ </ResponseMetadata>
68
+ </GetSendStatisticsResponse>
69
+ })
70
+
71
+ result = @base.statistics
72
+
73
+ assert result.success?
74
+ assert_equal 'abc-123', result.request_id
75
+
76
+ assert_equal 3, result.data_points.size
77
+
78
+ d = result.data_points.first
79
+
80
+ assert_equal '2', d['Rejects']
81
+ assert_equal '3', d['DeliveryAttempts']
82
+ assert_equal '4', d['Bounces']
83
+ assert_equal '1', d['Complaints']
84
+ end
85
+ end
86
+
87
+
88
+ context 'deleting a verified addressess' do
89
+ setup do
90
+ @base = generate_base
91
+ end
92
+
93
+ should 'return the correct response on success' do
94
+ mock_connection(@base, :body => %{
95
+ <DeleteVerifiedEmailAddressResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
96
+ <ResponseMetadata>
97
+ <RequestId>abc-123</RequestId>
98
+ </ResponseMetadata>
99
+ </DeleteVerifiedEmailAddressResponse>
100
+ })
101
+
102
+ result = @base.addresses.delete('user1@example.com')
103
+
104
+ assert result.success?
105
+ assert_equal 'abc-123', result.request_id
106
+ end
107
+ end
108
+ end
@@ -1,7 +1,7 @@
1
1
  require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  class SendEmailTest < Test::Unit::TestCase
4
- context "when sending email" do
4
+ context 'when sending email' do
5
5
  setup do
6
6
  @base = generate_base
7
7
  @basic_email = { :from => 'jon@example.com',
@@ -10,7 +10,7 @@ class SendEmailTest < Test::Unit::TestCase
10
10
  :text_body => 'Body1' }
11
11
  end
12
12
 
13
- context "adding to a hash" do
13
+ context 'adding to a hash' do
14
14
  should 'add array elements to the hash' do
15
15
  hash = {}
16
16
  ary = ['x', 'y']
@@ -28,41 +28,40 @@ class SendEmailTest < Test::Unit::TestCase
28
28
  end
29
29
  end
30
30
 
31
- should "send an e-mail" do
32
- mock_connection(@base)
33
-
34
- result = @base.send_email @basic_email
35
- assert result.success?
36
- end
37
-
38
- should 'send a raw e-mail with a mail object' do
39
- mock_connection(@base, {:body => %{
40
- <SendRawEmailRequest>
41
- <SendRawEmailResponse>
31
+ should 'send an e-mail' do
32
+ mock_connection(@base, :body => %{
33
+ <SendEmailResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
34
+ <SendEmailResult>
42
35
  <MessageId>abc-123</MessageId>
43
- </SendRawEmailResponse>
44
- </SendRawEmailRequest>
45
- }})
46
-
47
- mail = Mail.new @basic_email
48
-
49
- result = @base.send_raw_email(mail)
36
+ </SendEmailResult>
37
+ <ResponseMetadata>
38
+ <RequestId>xyz-123</RequestId>
39
+ </ResponseMetadata>
40
+ </SendEmailResponse>
41
+ })
50
42
 
43
+ result = @base.send_email @basic_email
51
44
  assert result.success?
45
+ assert_equal 'abc-123', result.message_id
46
+ assert_equal 'xyz-123', result.request_id
52
47
  end
53
48
 
54
49
  should 'send a raw e-mail with a hash object' do
55
- mock_connection(@base, {:body => %{
56
- <SendRawEmailRequest>
57
- <SendRawEmailResponse>
50
+ mock_connection(@base, :body => %{
51
+ <SendRawEmailResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
52
+ <SendRawEmailResult>
58
53
  <MessageId>abc-123</MessageId>
59
- </SendRawEmailResponse>
60
- </SendRawEmailRequest>
61
- }})
54
+ </SendRawEmailResult>
55
+ <ResponseMetadata>
56
+ <RequestId>xyz-123</RequestId>
57
+ </ResponseMetadata>
58
+ </SendRawEmailResponse>
59
+ })
62
60
 
63
61
  result = @base.send_raw_email(@basic_email)
64
-
65
62
  assert result.success?
63
+ assert_equal 'abc-123', result.message_id
64
+ assert_equal 'xyz-123', result.request_id
66
65
  end
67
66
  end
68
67
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-ses
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
9
- - 2
10
- version: 0.3.2
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Drew Blas
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-02-03 00:00:00 -06:00
19
+ date: 2011-02-09 00:00:00 -06:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -218,6 +218,7 @@ files:
218
218
  - TODO
219
219
  - VERSION
220
220
  - aws-ses.gemspec
221
+ - lib/aws/actionmailer/ses_extension.rb
221
222
  - lib/aws/ses.rb
222
223
  - lib/aws/ses/addresses.rb
223
224
  - lib/aws/ses/base.rb
@@ -226,10 +227,12 @@ files:
226
227
  - lib/aws/ses/response.rb
227
228
  - lib/aws/ses/send_email.rb
228
229
  - lib/aws/ses/version.rb
230
+ - test/address_test.rb
229
231
  - test/base_test.rb
230
232
  - test/extensions_test.rb
231
233
  - test/fixtures.rb
232
234
  - test/helper.rb
235
+ - test/info_test.rb
233
236
  - test/mocks/fake_response.rb
234
237
  - test/response_test.rb
235
238
  - test/send_email_test.rb
@@ -268,10 +271,12 @@ signing_key:
268
271
  specification_version: 3
269
272
  summary: Client library for Amazon's Simple Email Service's REST API
270
273
  test_files:
274
+ - test/address_test.rb
271
275
  - test/base_test.rb
272
276
  - test/extensions_test.rb
273
277
  - test/fixtures.rb
274
278
  - test/helper.rb
279
+ - test/info_test.rb
275
280
  - test/mocks/fake_response.rb
276
281
  - test/response_test.rb
277
282
  - test/send_email_test.rb