axtro-aws-ses 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
@@ -0,0 +1,42 @@
1
+ 0.4.3:
2
+ * No more error from Rails 3.1 about incompatible gem versions
3
+ * Better error message
4
+ * No duplicate dependencies
5
+
6
+ 0.4.2:
7
+ * Added support for ReplyToAddresses, Destinations, and Source (pzb)
8
+ * Added custom User-Agent header (pzb)
9
+ * Widespread doc updates
10
+
11
+ 0.4.1:
12
+ * Removed many unneeded monkeypatch extensions
13
+ * Tests ( and gem ) run in 1.9.2
14
+
15
+ 0.4.0:
16
+ * This version may have some small incompatibilities due to adding support for MessageId. Check that the result still matches what you previously expected.
17
+ * Added MessageId support in responses
18
+ * Improved resulting data from many responses
19
+ * Added tests and documentation for quota and statistics
20
+ * Added Rails 2.3.x support ( I HOPE!!! )
21
+
22
+ 0.3.2:
23
+ * Removed unused extensions that were conflicting with S3
24
+
25
+ 0.3.1:
26
+ * Downgraded mail gem version required to enhance Rails 3.0.0 compatibility
27
+
28
+ 0.3.0:
29
+ * Added send_raw_email support
30
+ * Added support for Rails3
31
+ * Vastly improved error handling and got rid of a bunch of stuff that wasn't used
32
+
33
+ 0.2.0:
34
+ * Added info support
35
+ * Added send_email
36
+
37
+ 0.1.0:
38
+ - Initial creation that supports:
39
+
40
+ * addresses.list
41
+ * addresses.verify(email)
42
+ * addresses.delete(email)
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda-context", ">= 0"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.5.2"
12
+ gem "rcov", ">= 0"
13
+ gem 'flexmock', '~> 0.8.11'
14
+ end
15
+
16
+ gem 'xml-simple'
17
+ gem 'builder'
18
+ gem 'mime-types'
19
+ # gem 'mail', '> 2.2.5', :require => false
@@ -0,0 +1,28 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ builder (3.0.0)
5
+ flexmock (0.8.11)
6
+ git (1.2.5)
7
+ jeweler (1.5.2)
8
+ bundler (~> 1.0.0)
9
+ git (>= 1.2.5)
10
+ rake
11
+ mime-types (1.16)
12
+ rake (0.8.7)
13
+ rcov (0.9.9)
14
+ shoulda-context (1.0.0.beta1)
15
+ xml-simple (1.0.13)
16
+
17
+ PLATFORMS
18
+ ruby
19
+
20
+ DEPENDENCIES
21
+ builder
22
+ bundler (~> 1.0.0)
23
+ flexmock (~> 0.8.11)
24
+ jeweler (~> 1.5.2)
25
+ mime-types
26
+ rcov
27
+ shoulda-context
28
+ xml-simple
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+
2
+ Copyright (c) 2011 Drew V. Blas <drew.blas@gmail.com>
3
+ Copyright (c) 2006-2009 Marcel Molina Jr. <marcel@vernix.org>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in the
7
+ Software without restriction, including without limitation the rights to use,
8
+ copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
9
+ Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19
+ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,92 @@
1
+ = AWS::SES
2
+
3
+ <%= docs_for['AWS::SES'] %>
4
+
5
+ == Send E-mail
6
+
7
+ <%= docs_for ['AWS::SES::SendEmail'] %>
8
+
9
+ == Addresses
10
+
11
+ <%= docs_for['AWS::SES::Addresses'] %>
12
+
13
+ == Info
14
+
15
+ <%= docs_for['AWS::SES::Info'] %>
16
+
17
+ == Rails
18
+
19
+ This gem is compatible with Rails >= 3.0.0 and Rails 2.3.x
20
+
21
+ To use, first add the gem to your Gemfile:
22
+
23
+ gem "aws-ses", "~> 0.4.3", :require => 'aws/ses'
24
+
25
+ == For Rails 3.x
26
+
27
+ Then, add your Amazon credentials and extend ActionMailer in `config/initializers/amazon_ses.rb`:
28
+
29
+ ActionMailer::Base.add_delivery_method :ses, AWS::SES::Base,
30
+ :access_key_id => 'abc',
31
+ :secret_access_key => '123'
32
+
33
+ Then set the delivery method in `config/environments/*rb` as appropriate:
34
+
35
+ config.action_mailer.delivery_method = :ses
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
+
46
+ == Issues
47
+
48
+ === HTTP Segmentation fault
49
+
50
+ If you get this error:
51
+ net/http.rb:677: [BUG] Segmentation fault
52
+
53
+ It means that you are not running with SSL enabled in ruby. Re-compile ruby with ssl support or add this option to your environment:
54
+ RUBYOPT="-r openssl"
55
+
56
+ === Rejected sending
57
+
58
+ If you are receiving this message and you HAVE verified the [source] please <b>check to be sure you are not in sandbox mode!</b>
59
+ "Email address is not verified.MessageRejected (AWS::Error)"
60
+ If you have not been granted production access, you will have to <b>verify all recipients</b> as well.
61
+
62
+ http://docs.amazonwebservices.com/ses/2010-12-01/DeveloperGuide/index.html?InitialSetup.Customer.html
63
+
64
+ == Source
65
+
66
+ Available at: https://github.com/drewblas/aws-ses
67
+
68
+ == Contributing to aws-ses
69
+
70
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
71
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
72
+ * Fork the project
73
+ * Start a feature/bugfix branch
74
+ * Commit and push until you are happy with your contribution
75
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
76
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
77
+
78
+ == Copyright
79
+
80
+ Copyright (c) 2011 Drew Blas. See LICENSE for further details.
81
+
82
+ == Thanks
83
+
84
+ Special thanks to Marcel Molina Jr. for his creation of AWS::S3 which I used portions of to get things working.
85
+
86
+ === Other Contributors:
87
+
88
+ * croaky
89
+ * nathanbertram
90
+ * sshaw
91
+ * teeparham (documentation)
92
+ * pzb
@@ -0,0 +1,196 @@
1
+ = AWS::SES
2
+
3
+ AWS::SES is a Ruby library for Amazon's Simple Email Service's REST API (http://aws.amazon.com/ses).
4
+
5
+ == Getting started
6
+
7
+ To get started you need to require 'aws/ses':
8
+
9
+ % irb -rubygems
10
+ irb(main):001:0> require 'aws/ses'
11
+ # => true
12
+
13
+ Before you can do anything, you must establish a connection using Base.new. A basic connection would look something like this:
14
+
15
+ ses = AWS::SES::Base.new(
16
+ :access_key_id => 'abc',
17
+ :secret_access_key => '123'
18
+ )
19
+
20
+ The minimum connection options that you must specify are your access key id and your secret access key.
21
+
22
+
23
+ == Send E-mail
24
+
25
+ Adds functionality for send_email and send_raw_email
26
+ Use the following to send an e-mail:
27
+
28
+ ses = AWS::SES::Base.new( ... connection info ... )
29
+ ses.send_email :to => ['jon@example.com', 'dave@example.com'],
30
+ :source => '"Steve Smith" <steve@example.com>',
31
+ :subject => 'Subject Line'
32
+ :text_body => 'Internal text body'
33
+
34
+ By default, the email "from" display address is whatever is before the @.
35
+ To change the display from, use the format:
36
+
37
+ "Steve Smith" <steve@example.com>
38
+
39
+ You can also send Mail objects using send_raw_email:
40
+
41
+ m = Mail.new( :to => ..., :from => ... )
42
+ ses.send_raw_email(m)
43
+
44
+ send_raw_email will also take a hash and pass it through Mail.new automatically as well.
45
+
46
+
47
+
48
+ == Addresses
49
+
50
+ AWS::SES::Addresses provides for:
51
+ * Listing verified e-mail addresses
52
+ * Adding new e-mail addresses to verify
53
+ * Deleting verified e-mail addresses
54
+
55
+ You can access these methods as follows:
56
+
57
+ ses = AWS::SES::Base.new( ... connection info ... )
58
+
59
+ # Get a list of verified addresses
60
+ ses.addresses.list.result
61
+
62
+ # Add a new e-mail address to verify
63
+ ses.addresses.verify('jon@example.com')
64
+
65
+ # Delete an e-mail address
66
+ ses.addresses.delete('jon@example.com')
67
+
68
+
69
+ == Info
70
+
71
+ Adds functionality for the statistics and info send quota data that Amazon SES makes available
72
+
73
+ You can access these methods as follows:
74
+
75
+ ses = AWS::SES::Base.new( ... connection info ... )
76
+
77
+ == Get the quota information
78
+ response = ses.quota
79
+ # How many e-mails you've sent in the last 24 hours
80
+ response.sent_last_24_hours
81
+ # How many e-mails you're allowed to send in 24 hours
82
+ response.max_24_hour_send
83
+ # How many e-mails you can send per second
84
+ response.max_send_rate
85
+
86
+ == Get detailed send statistics
87
+ The result is a list of data points, representing the last two weeks of sending activity.
88
+ Each data point in the list contains statistics for a 15-minute interval.
89
+ GetSendStatisticsResponse#data_points is an array where each element is a hash with give string keys:
90
+
91
+ * +Bounces+
92
+ * +DeliveryAttempts+
93
+ * +Rejects+
94
+ * +Complaints+
95
+ * +Timestamp+
96
+
97
+ response = ses.statistics
98
+ response.data_points # =>
99
+ [{"Bounces"=>"0",
100
+ "Timestamp"=>"2011-01-26T16:30:00Z",
101
+ "DeliveryAttempts"=>"1",
102
+ "Rejects"=>"0",
103
+ "Complaints"=>"0"},
104
+ {"Bounces"=>"0",
105
+ "Timestamp"=>"2011-02-09T14:45:00Z",
106
+ "DeliveryAttempts"=>"3",
107
+ "Rejects"=>"0",
108
+ "Complaints"=>"0"},
109
+ {"Bounces"=>"0",
110
+ "Timestamp"=>"2011-01-31T15:30:00Z",
111
+ "DeliveryAttempts"=>"3",
112
+ "Rejects"=>"0",
113
+ "Complaints"=>"0"},
114
+ {"Bounces"=>"0",
115
+ "Timestamp"=>"2011-01-31T16:00:00Z",
116
+ "DeliveryAttempts"=>"3",
117
+ "Rejects"=>"0",
118
+ "Complaints"=>"0"}]
119
+
120
+
121
+ == Rails
122
+
123
+ This gem is compatible with Rails >= 3.0.0 and Rails 2.3.x
124
+
125
+ To use, first add the gem to your Gemfile:
126
+
127
+ gem "aws-ses", "~> 0.4.3", :require => 'aws/ses'
128
+
129
+ == For Rails 3.x
130
+
131
+ Then, add your Amazon credentials and extend ActionMailer in `config/initializers/amazon_ses.rb`:
132
+
133
+ ActionMailer::Base.add_delivery_method :ses, AWS::SES::Base,
134
+ :access_key_id => 'abc',
135
+ :secret_access_key => '123'
136
+
137
+ Then set the delivery method in `config/environments/*rb` as appropriate:
138
+
139
+ config.action_mailer.delivery_method = :ses
140
+
141
+ == For Rails 2.3.x
142
+
143
+ Then set the delivery method in `config/environments/*rb` as appropriate:
144
+
145
+ config.after_initialize do
146
+ ActionMailer::Base.delivery_method = :amazon_ses
147
+ ActionMailer::Base.custom_amazon_ses_mailer = AWS::SES::Base.new(:secret_access_key => 'abc', :access_key_id => '123')
148
+ end
149
+
150
+ == Issues
151
+
152
+ === HTTP Segmentation fault
153
+
154
+ If you get this error:
155
+ net/http.rb:677: [BUG] Segmentation fault
156
+
157
+ It means that you are not running with SSL enabled in ruby. Re-compile ruby with ssl support or add this option to your environment:
158
+ RUBYOPT="-r openssl"
159
+
160
+ === Rejected sending
161
+
162
+ If you are receiving this message and you HAVE verified the [source] please <b>check to be sure you are not in sandbox mode!</b>
163
+ "Email address is not verified.MessageRejected (AWS::Error)"
164
+ If you have not been granted production access, you will have to <b>verify all recipients</b> as well.
165
+
166
+ http://docs.amazonwebservices.com/ses/2010-12-01/DeveloperGuide/index.html?InitialSetup.Customer.html
167
+
168
+ == Source
169
+
170
+ Available at: https://github.com/drewblas/aws-ses
171
+
172
+ == Contributing to aws-ses
173
+
174
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
175
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
176
+ * Fork the project
177
+ * Start a feature/bugfix branch
178
+ * Commit and push until you are happy with your contribution
179
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
180
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
181
+
182
+ == Copyright
183
+
184
+ Copyright (c) 2011 Drew Blas. See LICENSE for further details.
185
+
186
+ == Thanks
187
+
188
+ Special thanks to Marcel Molina Jr. for his creation of AWS::S3 which I used portions of to get things working.
189
+
190
+ === Other Contributors:
191
+
192
+ * croaky
193
+ * nathanbertram
194
+ * sshaw
195
+ * teeparham (documentation)
196
+ * pzb
@@ -0,0 +1,82 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'erb'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "axtro-aws-ses"
18
+ gem.homepage = "http://github.com/axtro/aws-ses"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Client library for Amazon's Simple Email Service's REST API}
21
+ gem.description = gem.summary
22
+ gem.email = "drew.blas@gmail.com"
23
+ gem.authors = ["Drew Blas", 'Marcel Molina Jr.']
24
+ # Do not add dependencies here because Jewler will add them from the Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/*_test.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ require 'rcov/rcovtask'
36
+ Rcov::RcovTask.new do |test|
37
+ test.libs << 'test'
38
+ test.pattern = 'test/**/*_test.rb'
39
+ test.verbose = true
40
+ end
41
+
42
+ task :default => :test
43
+
44
+ require 'rake/rdoctask'
45
+ require File.dirname(__FILE__) + '/lib/aws/ses'
46
+
47
+ namespace :doc do
48
+ Rake::RDocTask.new do |rdoc|
49
+ rdoc.rdoc_dir = 'doc'
50
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
51
+ rdoc.title = "AWS::SES -- Support for Amazon SES's REST api #{version}"
52
+ rdoc.options << '--line-numbers' << '--inline-source'
53
+ rdoc.rdoc_files.include('README.rdoc')
54
+ rdoc.rdoc_files.include('LICENSE')
55
+ rdoc.rdoc_files.include('CHANGELOG')
56
+ rdoc.rdoc_files.include('TODO')
57
+ rdoc.rdoc_files.include('VERSION')
58
+ rdoc.rdoc_files.include('lib/**/*.rb')
59
+ end
60
+
61
+ task :rdoc => 'doc:readme'
62
+
63
+ task :refresh => :rerdoc do
64
+ system 'open doc/index.html'
65
+ end
66
+
67
+ task :readme do
68
+ require 'support/rdoc/code_info'
69
+ RDoc::CodeInfo.parse('lib/**/*.rb')
70
+
71
+ strip_comments = lambda {|comment| comment.gsub(/^# ?/, '')}
72
+ docs_for = lambda do |location|
73
+ info = RDoc::CodeInfo.for(location)
74
+ raise RuntimeError, "Couldn't find documentation for `#{location}'" unless info
75
+ strip_comments[info.comment]
76
+ end
77
+
78
+ open('README.rdoc', 'w') do |file|
79
+ file.write ERB.new(IO.read('README.erb')).result(binding)
80
+ end
81
+ end
82
+ end