aws-ses 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/{README → README.rdoc} +0 -0
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/aws-ses.gemspec +4 -4
- data/lib/aws/ses/extensions.rb +0 -169
- data/lib/aws/ses/version.rb +1 -1
- data/test/extensions_test.rb +0 -171
- metadata +6 -6
data/CHANGELOG
CHANGED
data/{README → README.rdoc}
RENAMED
File without changes
|
data/Rakefile
CHANGED
@@ -56,7 +56,7 @@ namespace :doc do
|
|
56
56
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
57
57
|
rdoc.title = "AWS::SES -- Support for Amazon SES's REST api #{version}"
|
58
58
|
rdoc.options << '--line-numbers' << '--inline-source'
|
59
|
-
rdoc.rdoc_files.include('README')
|
59
|
+
rdoc.rdoc_files.include('README.rdoc')
|
60
60
|
rdoc.rdoc_files.include('LICENSE')
|
61
61
|
rdoc.rdoc_files.include('CHANGELOG')
|
62
62
|
rdoc.rdoc_files.include('TODO')
|
@@ -81,7 +81,7 @@ namespace :doc do
|
|
81
81
|
strip_comments[info.comment]
|
82
82
|
end
|
83
83
|
|
84
|
-
open('README', 'w') do |file|
|
84
|
+
open('README.rdoc', 'w') do |file|
|
85
85
|
file.write ERB.new(IO.read('README.erb')).result(binding)
|
86
86
|
end
|
87
87
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/aws-ses.gemspec
CHANGED
@@ -5,17 +5,17 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{aws-ses}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.2"
|
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-
|
12
|
+
s.date = %q{2011-02-03}
|
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 = [
|
16
16
|
"LICENSE",
|
17
|
-
"README",
|
18
17
|
"README.erb",
|
18
|
+
"README.rdoc",
|
19
19
|
"TODO"
|
20
20
|
]
|
21
21
|
s.files = [
|
@@ -24,8 +24,8 @@ Gem::Specification.new do |s|
|
|
24
24
|
"Gemfile",
|
25
25
|
"Gemfile.lock",
|
26
26
|
"LICENSE",
|
27
|
-
"README",
|
28
27
|
"README.erb",
|
28
|
+
"README.rdoc",
|
29
29
|
"Rakefile",
|
30
30
|
"TODO",
|
31
31
|
"VERSION",
|
data/lib/aws/ses/extensions.rb
CHANGED
@@ -1,30 +1,4 @@
|
|
1
1
|
#:stopdoc:
|
2
|
-
|
3
|
-
class Hash
|
4
|
-
def to_query_string(include_question_mark = true)
|
5
|
-
query_string = ''
|
6
|
-
unless empty?
|
7
|
-
query_string << '?' if include_question_mark
|
8
|
-
query_string << inject([]) do |params, (key, value)|
|
9
|
-
params << "#{key}=#{value}"
|
10
|
-
end.join('&')
|
11
|
-
end
|
12
|
-
query_string
|
13
|
-
end
|
14
|
-
|
15
|
-
def to_normalized_options
|
16
|
-
# Convert all option names to downcased strings, and replace underscores with hyphens
|
17
|
-
inject({}) do |normalized_options, (name, value)|
|
18
|
-
normalized_options[name.to_header] = value.to_s
|
19
|
-
normalized_options
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def to_normalized_options!
|
24
|
-
replace(to_normalized_options)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
2
|
class String
|
29
3
|
if RUBY_VERSION <= '1.9'
|
30
4
|
def previous!
|
@@ -90,34 +64,6 @@ class String
|
|
90
64
|
end
|
91
65
|
end
|
92
66
|
|
93
|
-
class CoercibleString < String
|
94
|
-
class << self
|
95
|
-
def coerce(string)
|
96
|
-
new(string).coerce
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def coerce
|
101
|
-
case self
|
102
|
-
when 'true'; true
|
103
|
-
when 'false'; false
|
104
|
-
# Don't coerce numbers that start with zero
|
105
|
-
when /^[1-9]+\d*$/; Integer(self)
|
106
|
-
when datetime_format; Time.parse(self)
|
107
|
-
else
|
108
|
-
self
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
private
|
113
|
-
# Lame hack since Date._parse is so accepting. S3 dates are of the form: '2006-10-29T23:14:47.000Z'
|
114
|
-
# so unless the string looks like that, don't even try, otherwise it might convert an object's
|
115
|
-
# key from something like '03 1-2-3-Apple-Tree.mp3' to Sat Feb 03 00:00:00 CST 2001.
|
116
|
-
def datetime_format
|
117
|
-
/^\d{4}-\d{2}-\d{2}\w\d{2}:\d{2}:\d{2}/
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
67
|
class Symbol
|
122
68
|
def to_header
|
123
69
|
to_s.to_header
|
@@ -161,13 +107,6 @@ module Kernel
|
|
161
107
|
end
|
162
108
|
end
|
163
109
|
|
164
|
-
class Object
|
165
|
-
def returning(value)
|
166
|
-
yield(value)
|
167
|
-
value
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
110
|
class Module
|
172
111
|
def memoized(method_name)
|
173
112
|
original_method = "unmemoized_#{method_name}_#{Time.now.to_i}"
|
@@ -191,114 +130,6 @@ class Module
|
|
191
130
|
EVAL
|
192
131
|
end
|
193
132
|
end
|
194
|
-
|
195
|
-
# Transforms MarcelBucket into
|
196
|
-
#
|
197
|
-
# class MarcelBucket < AWS::S3::Bucket
|
198
|
-
# set_current_bucket_to 'marcel'
|
199
|
-
# end
|
200
|
-
def const_missing_from_s3_library(sym)
|
201
|
-
if sym.to_s =~ /^(\w+)(Bucket|S3Object)$/
|
202
|
-
const = const_set(sym, Class.new(AWS::S3.const_get($2)))
|
203
|
-
const.current_bucket = $1.underscore
|
204
|
-
const
|
205
|
-
else
|
206
|
-
const_missing_not_from_s3_library(sym)
|
207
|
-
end
|
208
|
-
end
|
209
|
-
alias_method :const_missing_not_from_s3_library, :const_missing
|
210
|
-
alias_method :const_missing, :const_missing_from_s3_library
|
211
|
-
end
|
212
|
-
|
213
|
-
|
214
|
-
class Class # :nodoc:
|
215
|
-
def cattr_reader(*syms)
|
216
|
-
syms.flatten.each do |sym|
|
217
|
-
class_eval(<<-EOS, __FILE__, __LINE__)
|
218
|
-
unless defined? @@#{sym}
|
219
|
-
@@#{sym} = nil
|
220
|
-
end
|
221
|
-
|
222
|
-
def self.#{sym}
|
223
|
-
@@#{sym}
|
224
|
-
end
|
225
|
-
|
226
|
-
def #{sym}
|
227
|
-
@@#{sym}
|
228
|
-
end
|
229
|
-
EOS
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
def cattr_writer(*syms)
|
234
|
-
syms.flatten.each do |sym|
|
235
|
-
class_eval(<<-EOS, __FILE__, __LINE__)
|
236
|
-
unless defined? @@#{sym}
|
237
|
-
@@#{sym} = nil
|
238
|
-
end
|
239
|
-
|
240
|
-
def self.#{sym}=(obj)
|
241
|
-
@@#{sym} = obj
|
242
|
-
end
|
243
|
-
|
244
|
-
def #{sym}=(obj)
|
245
|
-
@@#{sym} = obj
|
246
|
-
end
|
247
|
-
EOS
|
248
|
-
end
|
249
|
-
end
|
250
|
-
|
251
|
-
def cattr_accessor(*syms)
|
252
|
-
cattr_reader(*syms)
|
253
|
-
cattr_writer(*syms)
|
254
|
-
end
|
255
|
-
end if Class.instance_methods(false).grep(/^cattr_(?:reader|writer|accessor)$/).empty?
|
256
|
-
|
257
|
-
module SelectiveAttributeProxy
|
258
|
-
def self.included(klass)
|
259
|
-
klass.extend(ClassMethods)
|
260
|
-
klass.class_eval(<<-EVAL, __FILE__, __LINE__)
|
261
|
-
cattr_accessor :attribute_proxy
|
262
|
-
cattr_accessor :attribute_proxy_options
|
263
|
-
|
264
|
-
# Default name for attribute storage
|
265
|
-
self.attribute_proxy = :attributes
|
266
|
-
self.attribute_proxy_options = {:exclusively => true}
|
267
|
-
|
268
|
-
private
|
269
|
-
# By default proxy all attributes
|
270
|
-
def proxiable_attribute?(name)
|
271
|
-
return true unless self.class.attribute_proxy_options[:exclusively]
|
272
|
-
send(self.class.attribute_proxy).has_key?(name)
|
273
|
-
end
|
274
|
-
|
275
|
-
def method_missing(method, *args, &block)
|
276
|
-
# Autovivify attribute storage
|
277
|
-
if method == self.class.attribute_proxy
|
278
|
-
ivar = "@\#{method}"
|
279
|
-
instance_variable_set(ivar, {}) unless instance_variable_get(ivar).is_a?(Hash)
|
280
|
-
instance_variable_get(ivar)
|
281
|
-
# Delegate to attribute storage
|
282
|
-
elsif method.to_s =~ /^(\\w+)(=?)$/ && proxiable_attribute?($1)
|
283
|
-
attributes_hash_name = self.class.attribute_proxy
|
284
|
-
$2.empty? ? send(attributes_hash_name)[$1] : send(attributes_hash_name)[$1] = args.first
|
285
|
-
else
|
286
|
-
super
|
287
|
-
end
|
288
|
-
end
|
289
|
-
EVAL
|
290
|
-
end
|
291
|
-
|
292
|
-
module ClassMethods
|
293
|
-
def proxy_to(attribute_name, options = {})
|
294
|
-
if attribute_name.is_a?(Hash)
|
295
|
-
options = attribute_name
|
296
|
-
else
|
297
|
-
self.attribute_proxy = attribute_name
|
298
|
-
end
|
299
|
-
self.attribute_proxy_options = options
|
300
|
-
end
|
301
|
-
end
|
302
133
|
end
|
303
134
|
|
304
135
|
|
data/lib/aws/ses/version.rb
CHANGED
data/test/extensions_test.rb
CHANGED
@@ -1,46 +1,5 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/helper'
|
2
2
|
|
3
|
-
class HashExtensionsTest < Test::Unit::TestCase
|
4
|
-
def test_to_query_string
|
5
|
-
# Because hashes aren't ordered, I'm mostly testing against hashes with just one key
|
6
|
-
symbol_keys = {:one => 1}
|
7
|
-
string_keys = {'one' => 1}
|
8
|
-
expected = '?one=1'
|
9
|
-
[symbol_keys, string_keys].each do |hash|
|
10
|
-
assert_equal expected, hash.to_query_string
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_empty_hash_returns_no_query_string
|
15
|
-
assert_equal '', {}.to_query_string
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_include_question_mark
|
19
|
-
hash = {:one => 1}
|
20
|
-
assert_equal '?one=1', hash.to_query_string
|
21
|
-
assert_equal 'one=1', hash.to_query_string(false)
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_elements_joined_by_ampersand
|
25
|
-
hash = {:one => 1, :two => 2}
|
26
|
-
qs = hash.to_query_string
|
27
|
-
assert qs['one=1&two=2'] || qs['two=2&one=1']
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_normalized_options
|
31
|
-
expectations = [
|
32
|
-
[{:foo_bar => 1}, {'foo-bar' => '1'}],
|
33
|
-
[{'foo_bar' => 1}, {'foo-bar' => '1'}],
|
34
|
-
[{'foo-bar' => 1}, {'foo-bar' => '1'}],
|
35
|
-
[{}, {}]
|
36
|
-
]
|
37
|
-
|
38
|
-
expectations.each do |(before, after)|
|
39
|
-
assert_equal after, before.to_normalized_options
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
3
|
class StringExtensionsTest < Test::Unit::TestCase
|
45
4
|
def test_previous
|
46
5
|
expectations = {'abc' => 'abb', '123' => '122', '1' => '0'}
|
@@ -76,28 +35,6 @@ class StringExtensionsTest < Test::Unit::TestCase
|
|
76
35
|
end
|
77
36
|
end
|
78
37
|
|
79
|
-
class CoercibleStringTest < Test::Unit::TestCase
|
80
|
-
|
81
|
-
def test_coerce
|
82
|
-
coercions = [
|
83
|
-
['1', 1],
|
84
|
-
['false', false],
|
85
|
-
['true', true],
|
86
|
-
['2006-10-29T23:14:47.000Z', Time.parse('2006-10-29T23:14:47.000Z')],
|
87
|
-
['Hello!', 'Hello!'],
|
88
|
-
['false23', 'false23'],
|
89
|
-
['03 1-2-3-Apple-Tree.mp3', '03 1-2-3-Apple-Tree.mp3'],
|
90
|
-
['0815', '0815'] # This number isn't coerced because the leading zero would be lost
|
91
|
-
]
|
92
|
-
|
93
|
-
coercions.each do |before, after|
|
94
|
-
assert_nothing_raised do
|
95
|
-
assert_equal after, CoercibleString.coerce(before)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
38
|
class KerneltExtensionsTest < Test::Unit::TestCase
|
102
39
|
class Foo
|
103
40
|
def foo
|
@@ -230,111 +167,3 @@ class ModuleExtensionsTest < Test::Unit::TestCase
|
|
230
167
|
end
|
231
168
|
|
232
169
|
end
|
233
|
-
|
234
|
-
class AttributeProxyTest < Test::Unit::TestCase
|
235
|
-
class BlindProxyUsingDefaultAttributesHash
|
236
|
-
include SelectiveAttributeProxy
|
237
|
-
proxy_to :exlusively => false
|
238
|
-
end
|
239
|
-
|
240
|
-
class BlindProxyUsingCustomAttributeHash
|
241
|
-
include SelectiveAttributeProxy
|
242
|
-
proxy_to :settings
|
243
|
-
end
|
244
|
-
|
245
|
-
class ProxyUsingPassedInAttributeHash
|
246
|
-
include SelectiveAttributeProxy
|
247
|
-
|
248
|
-
def initialize(attributes = {})
|
249
|
-
@attributes = attributes
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
|
-
class RestrictedProxy
|
254
|
-
include SelectiveAttributeProxy
|
255
|
-
|
256
|
-
private
|
257
|
-
def proxiable_attribute?(name)
|
258
|
-
%w(foo bar baz).include?(name)
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
|
-
class NonExclusiveProxy
|
263
|
-
include SelectiveAttributeProxy
|
264
|
-
proxy_to :settings, :exclusively => false
|
265
|
-
end
|
266
|
-
|
267
|
-
def test_using_all_defaults
|
268
|
-
b = BlindProxyUsingDefaultAttributesHash.new
|
269
|
-
assert_nothing_raised do
|
270
|
-
b.foo = 'bar'
|
271
|
-
end
|
272
|
-
|
273
|
-
assert_nothing_raised do
|
274
|
-
b.foo
|
275
|
-
end
|
276
|
-
|
277
|
-
assert_equal 'bar', b.foo
|
278
|
-
end
|
279
|
-
|
280
|
-
def test_storage_is_autovivified
|
281
|
-
b = BlindProxyUsingDefaultAttributesHash.new
|
282
|
-
assert_nothing_raised do
|
283
|
-
b.send(:attributes)['foo'] = 'bar'
|
284
|
-
end
|
285
|
-
|
286
|
-
assert_nothing_raised do
|
287
|
-
b.foo
|
288
|
-
end
|
289
|
-
|
290
|
-
assert_equal 'bar', b.foo
|
291
|
-
end
|
292
|
-
|
293
|
-
def test_limiting_which_attributes_are_proxiable
|
294
|
-
r = RestrictedProxy.new
|
295
|
-
assert_nothing_raised do
|
296
|
-
r.foo = 'bar'
|
297
|
-
end
|
298
|
-
|
299
|
-
assert_nothing_raised do
|
300
|
-
r.foo
|
301
|
-
end
|
302
|
-
|
303
|
-
assert_equal 'bar', r.foo
|
304
|
-
|
305
|
-
assert_raises(NoMethodError) do
|
306
|
-
r.quux = 'foo'
|
307
|
-
end
|
308
|
-
|
309
|
-
assert_raises(NoMethodError) do
|
310
|
-
r.quux
|
311
|
-
end
|
312
|
-
end
|
313
|
-
|
314
|
-
def test_proxying_is_exclusive_by_default
|
315
|
-
p = ProxyUsingPassedInAttributeHash.new('foo' => 'bar')
|
316
|
-
assert_nothing_raised do
|
317
|
-
p.foo
|
318
|
-
p.foo = 'baz'
|
319
|
-
end
|
320
|
-
|
321
|
-
assert_equal 'baz', p.foo
|
322
|
-
|
323
|
-
assert_raises(NoMethodError) do
|
324
|
-
p.quux
|
325
|
-
end
|
326
|
-
end
|
327
|
-
|
328
|
-
def test_setting_the_proxy_as_non_exclusive
|
329
|
-
n = NonExclusiveProxy.new
|
330
|
-
assert_nothing_raised do
|
331
|
-
n.foo = 'baz'
|
332
|
-
end
|
333
|
-
|
334
|
-
assert_nothing_raised do
|
335
|
-
n.foo
|
336
|
-
end
|
337
|
-
|
338
|
-
assert_equal 'baz', n.foo
|
339
|
-
end
|
340
|
-
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:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
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-
|
19
|
+
date: 2011-02-03 00:00:00 -06:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -203,8 +203,8 @@ extensions: []
|
|
203
203
|
|
204
204
|
extra_rdoc_files:
|
205
205
|
- LICENSE
|
206
|
-
- README
|
207
206
|
- README.erb
|
207
|
+
- README.rdoc
|
208
208
|
- TODO
|
209
209
|
files:
|
210
210
|
- .document
|
@@ -212,8 +212,8 @@ files:
|
|
212
212
|
- Gemfile
|
213
213
|
- Gemfile.lock
|
214
214
|
- LICENSE
|
215
|
-
- README
|
216
215
|
- README.erb
|
216
|
+
- README.rdoc
|
217
217
|
- Rakefile
|
218
218
|
- TODO
|
219
219
|
- VERSION
|