GetRequesterStatistic.rb: Connection reset by peer

Mar 7, 2016 at 3:45 PM
CrowdMOS-0.2 requires ruby-aws-1.2.0 gem. I installed following package on top of ruby-1.8.7:
$ gem list
bundle (0.0.1)
bundler (1.11.2)
certified (1.0.0)
coderay (1.1.1)
facets (2.5.0)
highline (1.6.1)
hoe (3.14.2)
json (1.8.3)
method_source (0.8.2)
pry-doc (0.8.0)
rake (10.5.0)
rdoc (4.2.2)
ruby-aws (1.2.0)
setup (5.2.0)
slop (3.6.0)
yard (0.8.7.6)
I ran GetRequesterStatistics.rb but it failed:
$ ruby GetRequesterStatistics.rb 
Worker thread has thrown an exception: undefined method `[]' for nil:NilClass
Worker thread has thrown an exception: undefined method `[]' for nil:NilClass
[...]
ruby-logs.txt mentioned to switch to HTTPS:
$ cat ruby-logs.txt
D, [2016-02-19T22:10:11.755328 #8508] DEBUG -- : Sending service request 'getAccountBalance' with args: {}
D, [2016-02-19T22:10:11.755400 #8508] DEBUG -- : Sending request: GetAccountBalance [{}]
D, [2016-02-19T22:10:11.755424 #8508] DEBUG -- : Dispatching call to GetAccountBalance (try 1)
D, [2016-02-19T22:10:12.145191 #8508] DEBUG -- : Validating response: {:Errors=>{:Error=>{:Code=>"NonSecureRequest", :Message=>"This request must be made over a secure channel. You must use 'https' rather than 'http'."}}, :RequestID=>"8ac9793e-dbaf-4b5e-87a9-796a21b76ce0"}
D, [2016-02-19T22:10:12.145297 #8508] DEBUG -- : Handling error: #<NoMethodError: undefined method `[]' for nil:NilClass>
Thus I changed HTTP into HTTPS in /var/lib/gems/1.8/gems/ruby-aws-1.2.0/lib/amazon/webservices/mechanical_turk.rb but got disconnected by AWS:
$ ruby GetRequesterStatistics.rb 
Worker thread has thrown an exception: Connection reset by peer
Worker thread has thrown an exception: Connection reset by peer
Worker thread has thrown an exception: Connection reset by peer

$ head -30 ruby-aws.log
# Logfile created on Mon Mar 07 11:35:27 -0500 2016 by logger.rb/1.2.6
D, [2016-03-07T11:35:27.023494 #9168] DEBUG -- : Generating relay with following args: {:Name=>:AWSMechanicalTurkRequester, :Host=>"mechanicalturk.sandbox.amazonaws.com", :Transport=>#<Amazon::WebServices::Util::RESTTransport:0x7f497daddf68 @url="https://mechanicalturk.sandbox.amazonaws.com/?Service=AWSMechanicalTurkRequester", @httpMethod=:POST, @version="2007-06-21", @headers={"Content-Type"=>"application/x-www-form-urlencoded; charset=utf-8", "X-Amazon-Software"=>"ruby-aws/0.0.1 MTurkRubySDK", "User-Agent"=>"ruby-aws/0.0.1 MTurkRubySDK"}>, :ServiceClass=>Amazon::WebServices::MechanicalTurk, :Version=>"2007-06-21", :SoftwareName=>"MTurkRubySDK"}
D, [2016-03-07T11:35:27.027395 #9168] DEBUG -- : Generating error handler with the following args: {:Name=>:AWSMechanicalTurkRequester, :Host=>"mechanicalturk.sandbox.amazonaws.com", :Relay=>#<Amazon::WebServices::Util::AmazonAuthenticationRelay:0x7f497dadd478 @transport=#<Amazon::WebServices::Util::RESTTransport:0x7f497daddf68 @url="https://mechanicalturk.sandbox.amazonaws.com/?Service=AWSMechanicalTurkRequester", @httpMethod=:POST, @version="2007-06-21", @headers={"Content-Type"=>"application/x-www-form-urlencoded; charset=utf-8", "X-Amazon-Software"=>"ruby-aws/0.0.1 MTurkRubySDK", "User-Agent"=>"ruby-aws/0.0.1 MTurkRubySDK"}>, @name=:AWSMechanicalTurkRequester, @key="55dMMcWCCiCEg4te+A3+YNU3zbxjAb/d5F1nNtsj", @keyId="AKIAIID3W6YIEDAAWPNA">, :Transport=>#<Amazon::WebServices::Util::RESTTransport:0x7f497daddf68 @url="https://mechanicalturk.sandbox.amazonaws.com/?Service=AWSMechanicalTurkRequester", @httpMethod=:POST, @version="2007-06-21", @headers={"Content-Type"=>"application/x-www-form-urlencoded; charset=utf-8", "X-Amazon-Software"=>"ruby-aws/0.0.1 MTurkRubySDK", "User-Agent"=>"ruby-aws/0.0.1 MTurkRubySDK"}>, :ServiceClass=>Amazon::WebServices::MechanicalTurk, :Version=>"2007-06-21", :SoftwareName=>"MTurkRubySDK"}
D, [2016-03-07T11:35:27.028203 #9168] DEBUG -- : Sending request: GetRequesterStatistic [{:Statistic=>"NumberAssignmentsAvailable", :TimePeriod=>"LifeToDate"}]
D, [2016-03-07T11:35:27.028268 #9168] DEBUG -- : Sending request: GetRequesterStatistic [{:Statistic=>"NumberAssignmentsAccepted", :TimePeriod=>"LifeToDate"}]
D, [2016-03-07T11:35:27.028333 #9168] DEBUG -- : Dispatching call to GetRequesterStatistic (try 1)
D, [2016-03-07T11:35:27.028518 #9168] DEBUG -- : Sending request: GetRequesterStatistic [{:Statistic=>"PercentAssignmentsApproved", :TimePeriod=>"LifeToDate"}]
D, [2016-03-07T11:35:27.028441 #9168] DEBUG -- : Sending request: GetRequesterStatistic [{:Statistic=>"NumberAssignmentsApproved", :TimePeriod=>"LifeToDate"}]
D, [2016-03-07T11:35:27.028470 #9168] DEBUG -- : Dispatching call to GetRequesterStatistic (try 1)
D, [2016-03-07T11:35:27.028373 #9168] DEBUG -- : Sending request: GetRequesterStatistic [{:Statistic=>"NumberAssignmentsPending", :TimePeriod=>"LifeToDate"}]
D, [2016-03-07T11:35:27.091700 #9168] DEBUG -- : Dispatching call to GetRequesterStatistic (try 1)
D, [2016-03-07T11:35:27.091796 #9168] DEBUG -- : Dispatching call to GetRequesterStatistic (try 1)
D, [2016-03-07T11:35:27.157906 #9168] DEBUG -- : Dispatching call to GetRequesterStatistic (try 1)
D, [2016-03-07T11:35:27.263373 #9168] DEBUG -- : Handling error: #<Errno::ECONNRESET: Connection reset by peer>
D, [2016-03-07T11:35:27.362050 #9168] DEBUG -- : Sending request: GetRequesterStatistic [{:Statistic=>"NumberAssignmentsRejected", :TimePeriod=>"LifeToDate"}]
D, [2016-03-07T11:35:27.362192 #9168] DEBUG -- : Dispatching call to GetRequesterStatistic (try 1)
D, [2016-03-07T11:35:27.396172 #9168] DEBUG -- : Handling error: #<Errno::ECONNRESET: Connection reset by peer>
D, [2016-03-07T11:35:27.396411 #9168] DEBUG -- : Sending request: GetRequesterStatistic [{:Statistic=>"PercentAssignmentsRejected", :TimePeriod=>"LifeToDate"}]
D, [2016-03-07T11:35:27.396469 #9168] DEBUG -- : Dispatching call to GetRequesterStatistic (try 1)
D, [2016-03-07T11:35:27.501279 #9168] DEBUG -- : Handling error: #<Errno::ECONNRESET: Connection reset by peer>
D, [2016-03-07T11:35:27.501353 #9168] DEBUG -- : Handling error: #<Errno::ECONNRESET: Connection reset by peer>
D, [2016-03-07T11:35:27.501601 #9168] DEBUG -- : Sending request: GetRequesterStatistic [{:Statistic=>"NumberAssignmentsReturned", :TimePeriod=>"LifeToDate"}]
D, [2016-03-07T11:35:27.501758 #9168] DEBUG -- : Sending request: GetRequesterStatistic [{:Statistic=>"NumberAssignmentsAbandoned", :TimePeriod=>"LifeToDate"}]
D, [2016-03-07T11:35:27.501807 #9168] DEBUG -- : Dispatching call to GetRequesterStatistic (try 1)
D, [2016-03-07T11:35:27.501847 #9168] DEBUG -- : Dispatching call to GetRequesterStatistic (try 1)
D, [2016-03-07T11:35:27.544180 #9168] DEBUG -- : Handling error: #<Errno::ECONNRESET: Connection reset by peer>
D, [2016-03-07T11:35:27.544431 #9168] DEBUG -- : Sending request: GetRequesterStatistic [{:Statistic=>"TotalRewardPayout", :TimePeriod=>"LifeToDate"}]
D, [2016-03-07T11:35:27.544488 #9168] DEBUG -- : Dispatching call to GetRequesterStatistic (try 1)
D, [2016-03-07T11:35:27.577756 #9168] DEBUG -- : Handling error: #<Errno::ECONNRESET: Connection reset by peer>
D, [2016-03-07T11:35:27.577960 #9168] DEBUG -- : Sending request: GetRequesterStatistic [{:Statistic=>"AverageRewardAmount", :TimePeriod=>"LifeToDate"}]
Other scripts also fail with the same error. Do you know what is the problem and how I can fix this?

I have the intuition that this is a API change issue. ruby-aws-1.2.0 is deprecated and has been replaced by mturk-1.9.1. CrowdMOS code probably needs to be updated to match mturk-1.9.1. Am I correct?

Unfortunately I don't know Ruby language. How much time would it need for a complete Ruby noob to do that port? What about a Ruby expert?

Thanks for your answer.