aws-ses 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/CHANGELOG +6 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +28 -0
- data/LICENSE +20 -0
- data/README +47 -0
- data/README.erb +25 -0
- data/Rakefile +85 -0
- data/TODO +2 -0
- data/VERSION +1 -0
- data/lib/aws/ses.rb +22 -0
- data/lib/aws/ses/addresses.rb +61 -0
- data/lib/aws/ses/base.rb +213 -0
- data/lib/aws/ses/exceptions.rb +50 -0
- data/lib/aws/ses/extensions.rb +313 -0
- data/lib/aws/ses/response.rb +97 -0
- data/lib/aws/ses/version.rb +12 -0
- data/test/base_test.rb +9 -0
- data/test/extensions_test.rb +340 -0
- data/test/fixtures.rb +89 -0
- data/test/helper.rb +48 -0
- data/test/mocks/fake_response.rb +26 -0
- data/test/response_test.rb +33 -0
- metadata +257 -0
data/test/helper.rb
ADDED
@@ -0,0 +1,48 @@
|
|
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 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
begin
|
14
|
+
require 'ruby-debug'
|
15
|
+
rescue LoadError
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'flexmock'
|
19
|
+
require 'flexmock/test_unit'
|
20
|
+
|
21
|
+
require File.dirname(__FILE__) + '/mocks/fake_response'
|
22
|
+
require File.dirname(__FILE__) + '/fixtures'
|
23
|
+
|
24
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
25
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
26
|
+
require 'aws/ses'
|
27
|
+
|
28
|
+
class Test::Unit::TestCase
|
29
|
+
include AWS::SES
|
30
|
+
|
31
|
+
def mock_connection_for(instance, klass, options = {})
|
32
|
+
data = options[:returns]
|
33
|
+
return_values = case data
|
34
|
+
when Hash
|
35
|
+
FakeResponse.new(data)
|
36
|
+
when Array
|
37
|
+
data.map {|hash| FakeResponse.new(hash)}
|
38
|
+
else
|
39
|
+
abort "Response data for mock connection must be a Hash or an Array. Was #{data.inspect}."
|
40
|
+
end
|
41
|
+
|
42
|
+
connection = flexmock('Mock connection') do |mock|
|
43
|
+
mock.should_receive(:request).and_return(*return_values).at_least.once
|
44
|
+
end
|
45
|
+
|
46
|
+
instance.should_receive(:connection).and_return(connection)
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module AWS
|
2
|
+
module SES
|
3
|
+
class FakeResponse
|
4
|
+
attr_reader :code, :body, :headers
|
5
|
+
def initialize(options = {})
|
6
|
+
@code = options.delete(:code) || 200
|
7
|
+
@body = options.delete(:body) || ''
|
8
|
+
@headers = {'content-type' => 'application/xml'}.merge(options.delete(:headers) || {})
|
9
|
+
end
|
10
|
+
|
11
|
+
# For ErrorResponse
|
12
|
+
def response
|
13
|
+
body
|
14
|
+
end
|
15
|
+
|
16
|
+
def [](header)
|
17
|
+
headers[header]
|
18
|
+
end
|
19
|
+
|
20
|
+
def each(&block)
|
21
|
+
headers.each(&block)
|
22
|
+
end
|
23
|
+
alias_method :each_header, :each
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/helper'
|
2
|
+
class BaseResponseTest < Test::Unit::TestCase
|
3
|
+
def setup
|
4
|
+
@headers = {'content-type' => 'text/plain', 'date' => Time.now}
|
5
|
+
@response = FakeResponse.new()
|
6
|
+
@base_response = Response.new('ResponseAction', @response)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_status_predicates
|
10
|
+
response = Proc.new {|code| Response.new('ResponseAction', FakeResponse.new(:code => code))}
|
11
|
+
assert response[200].success?
|
12
|
+
assert response[300].redirect?
|
13
|
+
assert response[400].client_error?
|
14
|
+
assert response[500].server_error?
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_headers_passed_along_from_original_response
|
18
|
+
assert_equal @response.headers, @base_response.headers
|
19
|
+
assert_equal @response['date'], @base_response['date']
|
20
|
+
original_headers, new_headers = {}, {}
|
21
|
+
@response.headers.each {|k,v| original_headers[k] = v}
|
22
|
+
@base_response.each {|k,v| new_headers[k] = v}
|
23
|
+
assert_equal original_headers, new_headers
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class ErrorResponseTest < Test::Unit::TestCase
|
28
|
+
def test_error_responses_are_always_in_error
|
29
|
+
assert Error.new('ErrorAction', FakeResponse.new).error?
|
30
|
+
assert Error.new('ErrorAction', FakeResponse.new(:code => 200)).error?
|
31
|
+
assert Error.new('ErrorAction', FakeResponse.new(:headers => {'content-type' => 'text/plain'})).error?
|
32
|
+
end
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,257 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aws-ses
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Drew Blas
|
14
|
+
- Marcel Molina Jr.
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2011-01-26 00:00:00 -06:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
prerelease: false
|
24
|
+
name: xml-simple
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
hash: 3
|
32
|
+
segments:
|
33
|
+
- 0
|
34
|
+
version: "0"
|
35
|
+
requirement: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
prerelease: false
|
38
|
+
name: builder
|
39
|
+
type: :runtime
|
40
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
49
|
+
requirement: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
prerelease: false
|
52
|
+
name: mime-types
|
53
|
+
type: :runtime
|
54
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
version: "0"
|
63
|
+
requirement: *id003
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
prerelease: false
|
66
|
+
name: shoulda
|
67
|
+
type: :development
|
68
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
77
|
+
requirement: *id004
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
prerelease: false
|
80
|
+
name: bundler
|
81
|
+
type: :development
|
82
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 23
|
88
|
+
segments:
|
89
|
+
- 1
|
90
|
+
- 0
|
91
|
+
- 0
|
92
|
+
version: 1.0.0
|
93
|
+
requirement: *id005
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
prerelease: false
|
96
|
+
name: jeweler
|
97
|
+
type: :development
|
98
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
hash: 7
|
104
|
+
segments:
|
105
|
+
- 1
|
106
|
+
- 5
|
107
|
+
- 2
|
108
|
+
version: 1.5.2
|
109
|
+
requirement: *id006
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
prerelease: false
|
112
|
+
name: rcov
|
113
|
+
type: :development
|
114
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
hash: 3
|
120
|
+
segments:
|
121
|
+
- 0
|
122
|
+
version: "0"
|
123
|
+
requirement: *id007
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
prerelease: false
|
126
|
+
name: flexmock
|
127
|
+
type: :development
|
128
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ~>
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
hash: 41
|
134
|
+
segments:
|
135
|
+
- 0
|
136
|
+
- 8
|
137
|
+
- 11
|
138
|
+
version: 0.8.11
|
139
|
+
requirement: *id008
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
prerelease: false
|
142
|
+
name: xml-simple
|
143
|
+
type: :runtime
|
144
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
hash: 3
|
150
|
+
segments:
|
151
|
+
- 0
|
152
|
+
version: "0"
|
153
|
+
requirement: *id009
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
prerelease: false
|
156
|
+
name: builder
|
157
|
+
type: :runtime
|
158
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
159
|
+
none: false
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
hash: 3
|
164
|
+
segments:
|
165
|
+
- 0
|
166
|
+
version: "0"
|
167
|
+
requirement: *id010
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
prerelease: false
|
170
|
+
name: mime-types
|
171
|
+
type: :runtime
|
172
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
173
|
+
none: false
|
174
|
+
requirements:
|
175
|
+
- - ">="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
hash: 3
|
178
|
+
segments:
|
179
|
+
- 0
|
180
|
+
version: "0"
|
181
|
+
requirement: *id011
|
182
|
+
description: Client library for Amazon's Simple Email Service's REST API
|
183
|
+
email: drew.blas@gmail.com
|
184
|
+
executables: []
|
185
|
+
|
186
|
+
extensions: []
|
187
|
+
|
188
|
+
extra_rdoc_files:
|
189
|
+
- LICENSE
|
190
|
+
- README
|
191
|
+
- README.erb
|
192
|
+
- TODO
|
193
|
+
files:
|
194
|
+
- .document
|
195
|
+
- CHANGELOG
|
196
|
+
- Gemfile
|
197
|
+
- Gemfile.lock
|
198
|
+
- LICENSE
|
199
|
+
- README
|
200
|
+
- README.erb
|
201
|
+
- Rakefile
|
202
|
+
- TODO
|
203
|
+
- VERSION
|
204
|
+
- lib/aws/ses.rb
|
205
|
+
- lib/aws/ses/addresses.rb
|
206
|
+
- lib/aws/ses/base.rb
|
207
|
+
- lib/aws/ses/exceptions.rb
|
208
|
+
- lib/aws/ses/extensions.rb
|
209
|
+
- lib/aws/ses/response.rb
|
210
|
+
- lib/aws/ses/version.rb
|
211
|
+
- test/base_test.rb
|
212
|
+
- test/extensions_test.rb
|
213
|
+
- test/fixtures.rb
|
214
|
+
- test/helper.rb
|
215
|
+
- test/mocks/fake_response.rb
|
216
|
+
- test/response_test.rb
|
217
|
+
has_rdoc: true
|
218
|
+
homepage: http://github.com/drewblas/aws-ses
|
219
|
+
licenses:
|
220
|
+
- MIT
|
221
|
+
post_install_message:
|
222
|
+
rdoc_options: []
|
223
|
+
|
224
|
+
require_paths:
|
225
|
+
- lib
|
226
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
227
|
+
none: false
|
228
|
+
requirements:
|
229
|
+
- - ">="
|
230
|
+
- !ruby/object:Gem::Version
|
231
|
+
hash: 3
|
232
|
+
segments:
|
233
|
+
- 0
|
234
|
+
version: "0"
|
235
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
|
+
none: false
|
237
|
+
requirements:
|
238
|
+
- - ">="
|
239
|
+
- !ruby/object:Gem::Version
|
240
|
+
hash: 3
|
241
|
+
segments:
|
242
|
+
- 0
|
243
|
+
version: "0"
|
244
|
+
requirements: []
|
245
|
+
|
246
|
+
rubyforge_project:
|
247
|
+
rubygems_version: 1.4.2
|
248
|
+
signing_key:
|
249
|
+
specification_version: 3
|
250
|
+
summary: Client library for Amazon's Simple Email Service's REST API
|
251
|
+
test_files:
|
252
|
+
- test/base_test.rb
|
253
|
+
- test/extensions_test.rb
|
254
|
+
- test/fixtures.rb
|
255
|
+
- test/helper.rb
|
256
|
+
- test/mocks/fake_response.rb
|
257
|
+
- test/response_test.rb
|