ruby-aws 1.6.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 95dee8cb700ed6360aaabd138e3b63958e0d2196
4
+ data.tar.gz: f3e9386d6974434ac4bda8cd54c28a9a39c7622c
5
+ SHA512:
6
+ metadata.gz: f1403ccfc9c3082692ede2791110dac1b9f587d7194b5d74dfe2a3823f6874fd7dac9dfd5fa3a1eab9822e037c8386fe8845b92ebd6f3d3f56f53b3ef8722736
7
+ data.tar.gz: 960a5ad5fef9d51f9759b3174e3afbfd40068c4b81037ed6d17b7bb8bee751cc4e87743377c619229c114212827c88f382c7c18de88fd17689791df8a183f18c
@@ -0,0 +1,4 @@
1
+ �Λ'ŏ��Bt�#��,��Է���܉'_����d�ﰇ�ɉ
2
+ �J��N��Ó_&��E��>ۤڛ��ɖ��� �.1����V0"3�ӰQ��
3
+ �c'�nf
4
+ �CɈ�Qt��&�B58����[��{
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,19 @@
1
+ == 1.7.1 / 2014-10-20
2
+
3
+ === 1 minor update
4
+ * Correctly generate version.rb
5
+
6
+ == 1.7.0 / 2014-10-17
7
+
8
+ === 1 major enhancement
9
+ * Update MechanicalTurk WSDL version to 2013-11-15 (Qualification Requirement Set Comparators: In/NotIn/DoesNotExist)
10
+
11
+ === 4 minor updates
12
+ * Improve retriable error detection
13
+ * Add constants for new QualificationTypeIds
14
+ * Updates for Hoe and Ruby deprecations
15
+ * Rename markdown files w/ .md extension
16
+
1
17
  == 1.6.0 / 2012-08-23
2
18
 
3
19
  === 1 major enhancement
@@ -1,8 +1,8 @@
1
- History.txt
1
+ History.md
2
2
  LICENSE.txt
3
3
  Manifest.txt
4
4
  NOTICE.txt
5
- README.txt
5
+ README.md
6
6
  Rakefile
7
7
  bin/ruby-aws
8
8
  lib/amazon/util.rb
data/NOTICE.txt CHANGED
@@ -1,4 +1,4 @@
1
1
  Libraries for Amazon Web Services
2
- Copyright 2007 Amazon Technologies, Inc.
2
+ Copyright 2007-2014 Amazon Technologies, Inc.
3
3
 
4
4
  This product includes software developed by Amazon Technologies, Inc.
@@ -86,11 +86,11 @@ Amazon Web Services, please visit our {Rubyforge project page}[http://rubyforge.
86
86
 
87
87
  If you have any comments, questions, or feedback concerning the Mechanical
88
88
  Turk service in general, please visit the {Amazon Mechanical Turk discussion
89
- forums}[http://developer.amazonwebservices.com/connect/forum.jspa?forumID=11]
89
+ forums}[https://forums.aws.amazon.com/forum.jspa?forumID=11]
90
90
 
91
91
  == License
92
92
 
93
- Copyright (c) 2007 Amazon Technologies, Inc.
93
+ Copyright (c) 2007-2014 Amazon Technologies, Inc.
94
94
 
95
95
  Licensed under the Apache License, Version 2.0 (the "License");
96
96
  you may not use this file except in compliance with the License.
data/Rakefile CHANGED
@@ -6,8 +6,8 @@ require './lib/ruby-aws/version.rb'
6
6
 
7
7
  Hoe.spec 'ruby-aws' do
8
8
  self.version = RubyAWS::VERSION.dup
9
- self.rubyforge_name = 'ruby-aws'
10
9
  developer 'David J Parrott', 'valthon@nothlav.net'
10
+ license 'APLv2'
11
11
  extra_deps << ['highline','>= 1.2.7']
12
12
  extra_deps << ['nokogiri','>= 1.4']
13
13
  need_tar
@@ -21,7 +21,7 @@ end
21
21
  task :gitversion do
22
22
  gv = `git describe --dirty`.chomp.gsub(/^v/,'').gsub('-','.')
23
23
  File.open('lib/ruby-aws/version.rb', File::WRONLY | File::CREAT | File::TRUNC ) do |f|
24
- f << "# Copyright:: Copyright (c) 2007 Amazon Technologies, Inc.\n"
24
+ f << "# Copyright:: Copyright (c) 2007-2014 Amazon Technologies, Inc.\n"
25
25
  f << "# License:: Apache License, Version 2.0\n"
26
26
  f << "\n"
27
27
  f << "module RubyAWS\n"
@@ -32,7 +32,7 @@ class DataReader
32
32
  end
33
33
 
34
34
  def load( filename, format=:Tabular )
35
- return {} unless File.exists? filename
35
+ return {} unless File.exist? filename
36
36
  raw_data = File.read( filename )
37
37
  case format
38
38
  when :Tabular
@@ -50,7 +50,7 @@ class DataReader
50
50
 
51
51
  def save( filename, format=:Tabular, force_headers=false )
52
52
  return if @data.nil? or @data.empty?
53
- existing = File.exists?( filename ) && File.size( filename ) > 0
53
+ existing = File.exist?( filename ) && File.size( filename ) > 0
54
54
  File.open( filename, 'a+' ) {|f|
55
55
  f << case format
56
56
  when :Tabular
@@ -64,7 +64,7 @@ class UserDataStore
64
64
  def saveNamespace(name)
65
65
  filename = File.join( @base, name )
66
66
  # kill old config before saving
67
- File.delete filename if File.exists? filename
67
+ File.delete filename if File.exist? filename
68
68
  # now save out the data
69
69
  DataReader.save( filename, @data[name], :Properties ) unless @data[name].keys.empty?
70
70
  end
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright (c) 2007 Amazon Technologies, Inc.
1
+ # Copyright:: Copyright (c) 2007-2014 Amazon Technologies, Inc.
2
2
  # License:: Apache License, Version 2.0
3
3
 
4
4
  require 'erb'
@@ -13,14 +13,25 @@ module WebServices
13
13
 
14
14
  class MechanicalTurkRequester < Amazon::WebServices::Util::ConvenienceWrapper
15
15
 
16
- WSDL_VERSION = "2012-03-25"
16
+ WSDL_VERSION = "2013-11-15"
17
17
 
18
+ # Deprecated qualification type IDs
18
19
  ABANDONMENT_RATE_QUALIFICATION_TYPE_ID = "00000000000000000070";
19
20
  APPROVAL_RATE_QUALIFICATION_TYPE_ID = "000000000000000000L0";
20
21
  REJECTION_RATE_QUALIFICATION_TYPE_ID = "000000000000000000S0";
21
22
  RETURN_RATE_QUALIFICATION_TYPE_ID = "000000000000000000E0";
22
23
  SUBMISSION_RATE_QUALIFICATION_TYPE_ID = "00000000000000000000";
24
+
25
+ # Current qualification type IDs
23
26
  LOCALE_QUALIFICATION_TYPE_ID = "00000000000000000071";
27
+ TOTAL_NUMBER_OF_HITS_APPROVED_QUALIFICATION_TYPE_ID = "00000000000000000040";
28
+ ADULT_QUALIFICATION_TYPE_ID = "00000000000000000060";
29
+ PHOTO_MODERATION_MASTERS_QUALIFICATION_TYPE_ID = "21VZU98JHSTLZ5BPP4A9NOBJEK3DPG";
30
+ PHOTO_MODERATION_MASTERS_SANDBOX_QUALIFICATION_TYPE_ID = "2TGBB6BFMFFOM08IBMAFGGESC1UWJX";
31
+ CATEGORIZATION_MASTERS_QUALIFICATION_TYPE_ID = "2NDP2L92HECWY8NS8H3CK0CP5L9GHO";
32
+ CATEGORIZATION_MASTERS_SANDBOX_QUALIFICATION_TYPE_ID = "2F1KVCNHMVHV8E9PBUB2A4J79LU20F";
33
+ MASTERS_QUALIFICATION_TYPE_ID = "2F1QJWKUDD8XADTFD2Q0G6UTO95ALH";
34
+ MASTERS_SANDBOX_QUALIFICATION_TYPE_ID = "2ARFPLSP75KLA8M8DH1HTEQVJT3SY6";
24
35
 
25
36
  DEFAULT_THREADCOUNT = 10
26
37
 
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright (c) 2007 Amazon Technologies, Inc.
1
+ # Copyright:: Copyright (c) 2007-2014 Amazon Technologies, Inc.
2
2
  # License:: Apache License, Version 2.0
3
3
 
4
4
  require 'amazon/util/logging'
@@ -45,7 +45,7 @@ class MechanicalTurkErrorHandler
45
45
  validateResponse( response )
46
46
  return response
47
47
  rescue Exception => error
48
- case handleError( error,method )
48
+ case handleError( error,method,args )
49
49
  when :RetryWithBackoff
50
50
  retry if doBackoff( try )
51
51
  when :RetryImmediate
@@ -70,11 +70,14 @@ class MechanicalTurkErrorHandler
70
70
  return false
71
71
  end
72
72
 
73
- def handleError( error, method )
73
+ def handleError( error, method, args )
74
74
  log "Handling error: #{error.inspect}"
75
+ idempotent = args.none? {|params| params[:UniqueRequestToken].nil? || params[:UniqueRequestToken].empty? }
76
+ retryable = methodRetryable( method ) || idempotent
77
+
75
78
  case error.class.to_s
76
- when 'Timeout::Error','SOAP::HTTPStreamError'
77
- if methodRetryable( method )
79
+ when 'Timeout::Error','SOAP::HTTPStreamError','Errno::ECONNRESET','Errno::EPIPE'
80
+ if retryable
78
81
  return :RetryImmediate
79
82
  else
80
83
  return :Unknown
@@ -89,7 +92,7 @@ class MechanicalTurkErrorHandler
89
92
  when 'Amazon::WebServices::Util::ValidationException'
90
93
  case error.message
91
94
  when 'AWS.ServiceUnavailable'
92
- return :RetryWithBackoff if methodRetryable( method )
95
+ return :RetryWithBackoff if retryable
93
96
  end
94
97
  return :Fail
95
98
  when 'RuntimeError'
@@ -1,6 +1,6 @@
1
- # Copyright:: Copyright (c) 2007 Amazon Technologies, Inc.
1
+ # Copyright:: Copyright (c) 2007-2014 Amazon Technologies, Inc.
2
2
  # License:: Apache License, Version 2.0
3
3
 
4
4
  module RubyAWS
5
- VERSION = '1.6.0'.freeze
5
+ VERSION = '1.7.1'.freeze
6
6
  end
@@ -88,7 +88,7 @@ begin
88
88
  if @getResults
89
89
  raise "missing input file" unless @inputFile
90
90
  raise "missing output file" unless @outputFile
91
- raise "input file does not exist: #{@inputFile}" unless File.exists? @inputFile
91
+ raise "input file does not exist: #{@inputFile}" unless File.exist? @inputFile
92
92
  end
93
93
  rescue => e
94
94
  puts e.message
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # Copyright:: Copyright (c) 2007 Amazon Technologies, Inc.
3
+ # Copyright:: Copyright (c) 2007-2014 Amazon Technologies, Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
 
6
6
  begin ; require 'rubygems' ; rescue LoadError ; end
@@ -50,14 +50,21 @@ def createSimpleSurvey
50
50
  questionFile = rootDir + "/simple_survey.question"
51
51
 
52
52
 
53
- # This is an example of creating a qualification.
54
- # This is a built-in qualification -- user must be based in the US
55
- qualReq = { :QualificationTypeId => Amazon::WebServices::MechanicalTurkRequester::LOCALE_QUALIFICATION_TYPE_ID,
56
- :Comparator => 'EqualTo',
57
- :LocaleValue => {:Country => 'US'}, }
53
+ # This is an example of using qualification requirements.
54
+ # This is a built-in qualification -- user must be based in the United States, Canada, or Great Britain
55
+ locationQualReq = { :QualificationTypeId => Amazon::WebServices::MechanicalTurkRequester::LOCALE_QUALIFICATION_TYPE_ID,
56
+ :Comparator => 'In',
57
+ :LocaleValue => [{:Country => 'US'},
58
+ {:Country => 'CA'},
59
+ {:Country => 'GB'}] }
60
+
61
+ # This is a built-in qualification -- user must have had greater than 1000 HTIs approved
62
+ numHITsApprovedQualReq = { :QualificationTypeId => Amazon::WebServices::MechanicalTurkRequester::NUMBER_OF_HITS_APPROVED_QUALIFICATION_TYPE_ID,
63
+ :Comparator => 'GreaterThan',
64
+ :IntegerValue => 1000 }
58
65
 
59
66
  # The create HIT method takes in an array of QualificationRequirements since a HIT can have multiple qualifications.
60
- qualReqs = [qualReq]
67
+ qualReqs = [locationQualReq, numHITsApprovedQualReq]
61
68
 
62
69
  # Loading the question (QuestionForm) file
63
70
  question = File.read( questionFile )
@@ -30,7 +30,7 @@ AutoApprovalDelayInSeconds:3600
30
30
  ## Qualification Properties
31
31
  ######################################
32
32
 
33
- # In this example, two system qualifications are specified for the HIT.
33
+ # In this example, two system qualifications and one location qualification are specified for the HIT.
34
34
 
35
35
  # this is a built-in qualification -- user must have an approval rate of 25% or greater
36
36
  QualificationRequirement.1.QualificationTypeId:000000000000000000L0
@@ -43,3 +43,11 @@ QualificationRequirement.2.QualificationTypeId:00000000000000000070
43
43
  QualificationRequirement.2.Comparator:LessThan
44
44
  QualificationRequirement.2.IntegerValue:51
45
45
  QualificationRequirement.2.RequiredToPreview:true
46
+
47
+ # this is a built-in qualification -- user must be based in the United States, Canada, or Great Britain
48
+ QualificationRequirement.3.QualificationTypeId:00000000000000000071
49
+ QualificationRequirement.3.Comparator:In
50
+ QualificationRequirement.3.LocaleValue.1.Country:US
51
+ QualificationRequirement.3.LocaleValue.2.Country:CA
52
+ QualificationRequirement.3.LocaleValue.3.Country:GB
53
+ QualificationRequirement.3.RequiredToPreview:true
@@ -1,56 +1,83 @@
1
- # Copyright:: Copyright (c) 2007 Amazon Technologies, Inc.
1
+ # Copyright:: Copyright (c) 2007-2014 Amazon Technologies, Inc.
2
2
  # License:: Apache License, Version 2.0
3
3
 
4
4
  require 'test/unit/testcase'
5
5
  require 'ruby-aws'
6
6
  require 'amazon/webservices/util/mock_transport'
7
7
  require 'timeout'
8
+ require 'amazon/webservices/util/validation_exception'
8
9
 
9
10
  class TestErrorHandler < Test::Unit::TestCase
11
+ RETRYABLE_ATTEMPT_COUNT = 7
10
12
 
11
13
  def setup
12
14
  @mock = Amazon::WebServices::Util::MockTransport.new
13
15
  @mturk = Amazon::WebServices::MechanicalTurkRequester.new( :Transport => @mock, :AWSAccessKey => 'bogus', :AWSAccessKeyId => 'fake' )
14
16
  end
15
17
 
16
- def testTimeoutOnce
17
-
18
+ def testTimeoutOnceRetryable
18
19
  # mock will timeout first time, return success on second call
19
- toggle = false
20
- @mock.listen do |call|
21
- Timeout.timeout(1) do
22
- if toggle
23
- toggle = !toggle
24
- else
25
- toggle = !toggle
26
- sleep(5)
27
- end
20
+ should_fail = true
21
+ @mock.listen do |call|
22
+ Timeout.timeout(1) do
23
+ if should_fail
24
+ should_fail = false
25
+ sleep(2)
26
+ end
28
27
  end
29
28
  nil
30
29
  end
31
30
 
32
- assert_equal false, toggle
33
31
  # invoke a retryable call once, should auto-retry and return success
34
32
  @mturk.getAccountBalance
35
33
  assert_equal 2, @mock.call_buffer.size, "Should have retried once"
36
34
  @mock.each {|call| assert_equal :GetAccountBalance, call.name, "Should have been a GetAccountBalance call" }
35
+ end
37
36
 
38
- @mock.flush
39
- assert_equal false, toggle
40
- # but invoking a non-retryable call will throw an exception
37
+ def testTimeoutOnceNotRetryable
38
+ # mock will timeout first time, return success on second call
39
+ should_fail = true
40
+ @mock.listen do |call|
41
+ Timeout.timeout(1) do
42
+ if should_fail
43
+ should_fail = false
44
+ sleep(2)
45
+ end
46
+ end
47
+ nil
48
+ end
49
+
50
+ # invoking a non-retryable call will throw an exception
41
51
  begin
42
52
  @mturk.grantBonus
43
53
  fail "Should have thrown an exception"
44
54
  rescue Timeout::Error
45
55
  # expect this exception
46
56
  end
47
- assert_equal true, toggle
48
57
  assert_equal :GrantBonus, @mock.next.name
49
58
  assert_nil @mock.next
50
59
  end
51
60
 
52
- def testTimeoutAlways
61
+ def testTimeoutOnceRetryableUniqueRequestToken
62
+ # mock will timeout first time, return success on second call
63
+ should_fail = true
64
+ @mock.listen do |call|
65
+ Timeout.timeout(1) do
66
+ if should_fail
67
+ should_fail = false
68
+ sleep(2)
69
+ end
70
+ end
71
+ nil
72
+ end
53
73
 
74
+ # invoke call with an idempotency once, should auto-retry and return success
75
+ @mturk.grantBonus :UniqueRequestToken => 'UniqueTokenValue'
76
+ assert_equal 2, @mock.call_buffer.size, "Should have retried once"
77
+ @mock.each {|call| assert_equal :GrantBonus, call.name, "Should have been a GrantBonus call" }
78
+ end
79
+
80
+ def testTimeoutAlways
54
81
  #mock will always timeout
55
82
  @mock.listen do |call|
56
83
  Timeout.timeout(1) { sleep(2) }
@@ -63,12 +90,251 @@ class TestErrorHandler < Test::Unit::TestCase
63
90
  # expect this exception
64
91
  end
65
92
 
66
- 7.times do
93
+ RETRYABLE_ATTEMPT_COUNT.times do
94
+ assert_equal :SearchHITs, @mock.next.name
95
+ end
96
+ assert_nil @mock.next
97
+ end
98
+
99
+ def testResetConnectionOnceRetryable
100
+ # mock will reset connection first time, return success on second call
101
+ should_fail = true
102
+ @mock.listen do |call|
103
+ if should_fail
104
+ should_fail = false
105
+ raise Errno::ECONNRESET
106
+ end
107
+ nil
108
+ end
109
+
110
+ # invoke a retryable call once, should auto-retry and return success
111
+ @mturk.getAccountBalance
112
+ assert_equal 2, @mock.call_buffer.size, "Should have retried once"
113
+ @mock.each {|call| assert_equal :GetAccountBalance, call.name, "Should have been a GetAccountBalance call" }
114
+ end
115
+
116
+ def testResetConnectionOnceNotRetryable
117
+ # mock will reset connection first time, return success on second call
118
+ should_fail = true
119
+ @mock.listen do |call|
120
+ if should_fail
121
+ should_fail = false
122
+ raise Errno::ECONNRESET
123
+ end
124
+ nil
125
+ end
126
+
127
+ # invoking a non-retryable call will throw an exception
128
+ begin
129
+ @mturk.grantBonus
130
+ fail "Should have thrown an exception"
131
+ rescue Errno::ECONNRESET
132
+ # expect this exception
133
+ end
134
+ assert_equal :GrantBonus, @mock.next.name
135
+ assert_nil @mock.next
136
+ end
137
+
138
+ def testResetConnectionOnceRetryableUniqueRequestToken
139
+ # mock will reset connection first time, return success on second call
140
+ should_fail = true
141
+ @mock.listen do |call|
142
+ if should_fail
143
+ should_fail = false
144
+ raise Errno::ECONNRESET
145
+ end
146
+ nil
147
+ end
148
+
149
+ # invoke call with an idempotency once, should auto-retry and return success
150
+ @mturk.grantBonus :UniqueRequestToken => 'UniqueTokenValue'
151
+ assert_equal 2, @mock.call_buffer.size, "Should have retried once"
152
+ @mock.each {|call| assert_equal :GrantBonus, call.name, "Should have been a GrantBonus call" }
153
+ end
154
+
155
+ def testResetConnectionAlways
156
+ #mock will always reset connection
157
+ @mock.listen do |call|
158
+ raise Errno::ECONNRESET
159
+ end
160
+
161
+ begin
162
+ @mturk.searchHITs
163
+ fail "Should have thrown an exception"
164
+ rescue Errno::ECONNRESET
165
+ # expect this exception
166
+ end
167
+
168
+ RETRYABLE_ATTEMPT_COUNT.times do
169
+ assert_equal :SearchHITs, @mock.next.name
170
+ end
171
+ assert_nil @mock.next
172
+ end
173
+
174
+ def testPipeBrokenOnceRetryable
175
+ # mock will break pipe first time, return success on second call
176
+ should_fail = true
177
+ @mock.listen do |call|
178
+ if should_fail
179
+ should_fail = false
180
+ raise Errno::EPIPE
181
+ end
182
+ nil
183
+ end
184
+
185
+ # invoke a retryable call once, should auto-retry and return success
186
+ @mturk.getAccountBalance
187
+ assert_equal 2, @mock.call_buffer.size, "Should have retried once"
188
+ @mock.each {|call| assert_equal :GetAccountBalance, call.name, "Should have been a GetAccountBalance call" }
189
+ end
190
+
191
+ def testPipeBrokenOnceNotRetryable
192
+ # mock will break pipe first time, return success on second call
193
+ should_fail = true
194
+ @mock.listen do |call|
195
+ if should_fail
196
+ should_fail = false
197
+ raise Errno::EPIPE
198
+ end
199
+ nil
200
+ end
201
+
202
+ # invoking a non-retryable call will throw an exception
203
+ begin
204
+ @mturk.grantBonus
205
+ fail "Should have thrown an exception"
206
+ rescue Errno::EPIPE
207
+ # expect this exception
208
+ end
209
+ assert_equal :GrantBonus, @mock.next.name
210
+ assert_nil @mock.next
211
+ end
212
+
213
+ def testPipeBrokenOnceRetryableUniqueRequestToken
214
+ # mock will reset connection first time, return success on second call
215
+ should_fail = true
216
+ @mock.listen do |call|
217
+ if should_fail
218
+ should_fail = false
219
+ raise Errno::EPIPE
220
+ end
221
+ nil
222
+ end
223
+
224
+ # invoke call with an idempotency once, should auto-retry and return success
225
+ @mturk.grantBonus :UniqueRequestToken => 'UniqueTokenValue'
226
+ assert_equal 2, @mock.call_buffer.size, "Should have retried once"
227
+ @mock.each {|call| assert_equal :GrantBonus, call.name, "Should have been a GrantBonus call" }
228
+ end
229
+
230
+ def testPipeBrokenAlways
231
+ #mock will always break pipe
232
+ @mock.listen do |call|
233
+ raise Errno::EPIPE
234
+ end
235
+
236
+ begin
237
+ @mturk.searchHITs
238
+ fail "Should have thrown an exception"
239
+ rescue Errno::EPIPE
240
+ # expect this exception
241
+ end
242
+
243
+ RETRYABLE_ATTEMPT_COUNT.times do
67
244
  assert_equal :SearchHITs, @mock.next.name
68
245
  end
69
246
  assert_nil @mock.next
70
247
  end
71
248
 
249
+ def testServiceUnavailableOnceRetryable
250
+ # mock will break pipe first time, return success on second call
251
+ should_fail = true
252
+ @mock.listen do |call|
253
+ if should_fail
254
+ should_fail = false
255
+ raise Amazon::WebServices::Util::ValidationException.new(nil, 'AWS.ServiceUnavailable')
256
+ end
257
+ nil
258
+ end
259
+
260
+ # invoke a retryable call once, should auto-retry and return success
261
+ @mturk.getAccountBalance
262
+ assert_equal 2, @mock.call_buffer.size, "Should have retried once"
263
+ @mock.each {|call| assert_equal :GetAccountBalance, call.name, "Should have been a GetAccountBalance call" }
264
+ end
265
+
266
+ def testServiceUnavailableOnceNotRetryable
267
+ # mock will break pipe first time, return success on second call
268
+ should_fail = true
269
+ @mock.listen do |call|
270
+ if should_fail
271
+ should_fail = false
272
+ raise Amazon::WebServices::Util::ValidationException.new(nil, 'AWS.ServiceUnavailable')
273
+ end
274
+ nil
275
+ end
276
+
277
+ # invoking a non-retryable call will throw an exception
278
+ begin
279
+ @mturk.grantBonus
280
+ fail "Should have thrown an exception"
281
+ rescue Amazon::WebServices::Util::ValidationException
282
+ # expect this exception
283
+ end
284
+ assert_equal :GrantBonus, @mock.next.name
285
+ assert_nil @mock.next
286
+ end
287
+
288
+ def testServiceUnavailableOnceRetryableUniqueRequestToken
289
+ # mock will reset connection first time, return success on second call
290
+ should_fail = true
291
+ @mock.listen do |call|
292
+ if should_fail
293
+ should_fail = false
294
+ raise Amazon::WebServices::Util::ValidationException.new(nil, 'AWS.ServiceUnavailable')
295
+ end
296
+ nil
297
+ end
298
+
299
+ # invoke call with an idempotency once, should auto-retry and return success
300
+ @mturk.grantBonus :UniqueRequestToken => 'UniqueTokenValue'
301
+ assert_equal 2, @mock.call_buffer.size, "Should have retried once"
302
+ @mock.each {|call| assert_equal :GrantBonus, call.name, "Should have been a GrantBonus call" }
303
+ end
304
+
305
+ def testServiceUnavailableAlways
306
+ #mock will always break pipe
307
+ @mock.listen do |call|
308
+ raise Amazon::WebServices::Util::ValidationException.new(nil, 'AWS.ServiceUnavailable')
309
+ end
310
+
311
+ begin
312
+ @mturk.searchHITs
313
+ fail "Should have thrown an exception"
314
+ rescue Amazon::WebServices::Util::ValidationException
315
+ # expect this exception
316
+ end
317
+
318
+ RETRYABLE_ATTEMPT_COUNT.times do
319
+ assert_equal :SearchHITs, @mock.next.name
320
+ end
321
+ assert_nil @mock.next
322
+ end
323
+
324
+ def testGenericValidationException
325
+ @mock.listen do |call|
326
+ raise Amazon::WebServices::Util::ValidationException.new(nil, 'Blah blah')
327
+ end
328
+
329
+ begin
330
+ @mturk.searchHITs
331
+ fail "Should have thrown an exception"
332
+ rescue Amazon::WebServices::Util::ValidationException
333
+ # expect this exception
334
+ end
335
+ assert_equal :SearchHITs, @mock.next.name
336
+ assert_nil @mock.next
337
+ end
72
338
 
73
339
  def testRuntimeError
74
340
  @mock.listen do |call|
metadata CHANGED
@@ -1,130 +1,118 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
5
- prerelease:
4
+ version: 1.7.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - David J Parrott
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain:
12
- - !binary |-
13
- LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURTakNDQWpLZ0F3SUJB
14
- Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREJMTVJrd0Z3WURWUVFEREJCeWRX
15
- SjUKTFdGM2N5MWtaWFpsYkc5d01Sa3dGd1lLQ1pJbWlaUHlMR1FCR1JZSmNu
16
- VmllV1p2Y21kbE1STXdFUVlLQ1pJbQppWlB5TEdRQkdSWURiM0puTUI0WERU
17
- QTNNRGd4TkRFMU5Ea3dORm9YRFRBNE1EZ3hNekUxTkRrd05Gb3dTekVaCk1C
18
- Y0dBMVVFQXd3UWNuVmllUzFoZDNNdFpHVjJaV3h2Y0RFWk1CY0dDZ21TSm9t
19
- VDhpeGtBUmtXQ1hKMVlubG0KYjNKblpURVRNQkVHQ2dtU0pvbVQ4aXhrQVJr
20
- V0EyOXlaekNDQVNJd0RRWUpLb1pJaHZjTkFRRUJCUUFEZ2dFUApBRENDQVFv
21
- Q2dnRUJBTUo2RCs1SDN4K0g4MXVnaDNQY1FoZ0ErR2taQnFCY2ViandLVENV
22
- ZFVPNlRPZzZQSHdQCk5jSlR1QU80Z0k0N0VIa2tSNDdrRGR5SHpkSklzMmxW
23
- V2N0Z3V0NVBBVC9RM1BzeXlVZmczdlFMOWpoZjk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Sg7dXSpR0s1BQJ50qlye64u9JqiW25T4i3Uap/fD3wrlj0SlVwvasQ4qi3cgf
29
+ tlC13CXjOWGW+hn+n/swny4LFXOus/qZixxiMAePSmN3QUC+bl/GvdBqZz0uPmQc
30
+ QRVpdW2BFol3aw2mXmdYxaOwHvTxcB7DHmkfOf2h
31
+ -----END CERTIFICATE-----
32
+ date: 2014-10-20 00:00:00.000000000 Z
41
33
  dependencies:
42
34
  - !ruby/object:Gem::Dependency
43
35
  name: highline
44
36
  requirement: !ruby/object:Gem::Requirement
45
- none: false
46
37
  requirements:
47
- - - ! '>='
38
+ - - ">="
48
39
  - !ruby/object:Gem::Version
49
40
  version: 1.2.7
50
41
  type: :runtime
51
42
  prerelease: false
52
43
  version_requirements: !ruby/object:Gem::Requirement
53
- none: false
54
44
  requirements:
55
- - - ! '>='
45
+ - - ">="
56
46
  - !ruby/object:Gem::Version
57
47
  version: 1.2.7
58
48
  - !ruby/object:Gem::Dependency
59
49
  name: nokogiri
60
50
  requirement: !ruby/object:Gem::Requirement
61
- none: false
62
51
  requirements:
63
- - - ! '>='
52
+ - - ">="
64
53
  - !ruby/object:Gem::Version
65
54
  version: '1.4'
66
55
  type: :runtime
67
56
  prerelease: false
68
57
  version_requirements: !ruby/object:Gem::Requirement
69
- none: false
70
58
  requirements:
71
- - - ! '>='
59
+ - - ">="
72
60
  - !ruby/object:Gem::Version
73
61
  version: '1.4'
74
62
  - !ruby/object:Gem::Dependency
75
63
  name: rdoc
76
64
  requirement: !ruby/object:Gem::Requirement
77
- none: false
78
65
  requirements:
79
- - - ~>
66
+ - - "~>"
80
67
  - !ruby/object:Gem::Version
81
- version: '3.10'
68
+ version: '4.0'
82
69
  type: :development
83
70
  prerelease: false
84
71
  version_requirements: !ruby/object:Gem::Requirement
85
- none: false
86
72
  requirements:
87
- - - ~>
73
+ - - "~>"
88
74
  - !ruby/object:Gem::Version
89
- version: '3.10'
75
+ version: '4.0'
90
76
  - !ruby/object:Gem::Dependency
91
77
  name: hoe
92
78
  requirement: !ruby/object:Gem::Requirement
93
- none: false
94
79
  requirements:
95
- - - ~>
80
+ - - "~>"
96
81
  - !ruby/object:Gem::Version
97
- version: '3.0'
82
+ version: '3.13'
98
83
  type: :development
99
84
  prerelease: false
100
85
  version_requirements: !ruby/object:Gem::Requirement
101
- none: false
102
86
  requirements:
103
- - - ~>
87
+ - - "~>"
104
88
  - !ruby/object:Gem::Version
105
- version: '3.0'
106
- description: ! "Libraries for Amazon Web Services (ruby-aws) is a set of libraries
107
- and tools\ndesigned to make it easier for you to build solutions leveraging Amazon
108
- Web\nServices like Amazon Mechanical Turk. The goals of the libraries are:\n\n*
109
- To abstract you from the \"muck\" of using web services\n* To simplify using the
110
- various Amazon Web Service APIs\n* To allow you to focus more on solving the business
111
- problem\n and less on managing technical details"
89
+ version: '3.13'
90
+ description: |-
91
+ Libraries for Amazon Web Services (ruby-aws) is a set of libraries and tools
92
+ designed to make it easier for you to build solutions leveraging Amazon Web
93
+ Services like Amazon Mechanical Turk. The goals of the libraries are:
94
+
95
+ * To abstract you from the "muck" of using web services
96
+ * To simplify using the various Amazon Web Service APIs
97
+ * To allow you to focus more on solving the business problem
98
+ and less on managing technical details
112
99
  email: ruby-aws-develop@rubyforge.org
113
100
  executables:
114
101
  - ruby-aws
115
102
  extensions: []
116
103
  extra_rdoc_files:
117
- - History.txt
104
+ - History.md
118
105
  - LICENSE.txt
119
106
  - Manifest.txt
120
107
  - NOTICE.txt
121
- - README.txt
108
+ - README.md
122
109
  files:
123
- - History.txt
110
+ - ".gemtest"
111
+ - History.md
124
112
  - LICENSE.txt
125
113
  - Manifest.txt
126
114
  - NOTICE.txt
127
- - README.txt
115
+ - README.md
128
116
  - Rakefile
129
117
  - bin/ruby-aws
130
118
  - lib/amazon/util.rb
@@ -192,32 +180,31 @@ files:
192
180
  - test/unit/test_question_generator.rb
193
181
  - test/unit/test_threadpool.rb
194
182
  - test/unit/test_user_data_store.rb
195
- - .gemtest
196
183
  homepage: http://rubyforge.org/projects/ruby-aws/
197
- licenses: []
184
+ licenses:
185
+ - APLv2
186
+ metadata: {}
198
187
  post_install_message:
199
188
  rdoc_options:
200
- - --main
201
- - README.txt
189
+ - "--main"
190
+ - README.md
202
191
  require_paths:
203
192
  - lib
204
193
  required_ruby_version: !ruby/object:Gem::Requirement
205
- none: false
206
194
  requirements:
207
- - - ! '>='
195
+ - - ">="
208
196
  - !ruby/object:Gem::Version
209
197
  version: '0'
210
198
  required_rubygems_version: !ruby/object:Gem::Requirement
211
- none: false
212
199
  requirements:
213
- - - ! '>='
200
+ - - ">="
214
201
  - !ruby/object:Gem::Version
215
202
  version: '0'
216
203
  requirements: []
217
- rubyforge_project: ruby-aws
218
- rubygems_version: 1.8.24
204
+ rubyforge_project:
205
+ rubygems_version: 2.2.0.rc.1
219
206
  signing_key:
220
- specification_version: 3
207
+ specification_version: 4
221
208
  summary: Ruby libraries for working with Amazon Web Services ( Mechanical Turk )
222
209
  test_files:
223
210
  - test/test_ruby-aws.rb
metadata.gz.sig CHANGED
Binary file