2016-04-07 29 views
1

我試圖做出這種要求:如何使用RTurk在Amazon Mechanical Turk(MTurk)中調用SetHITTypeNotification?

https://mechanicalturk.amazonaws.com/?Service=AWSMechanicalTurkRequester 
&AWSAccessKeyId=[the Requester's Access Key ID] 
&Operation=SetHITTypeNotification 
&Signature=[signature for this request] 
&Timestamp=[your system's local time] 
&HITTypeId=T100CN9P324W00EXAMPLE 
&[email protected] 
&Notification.1.Transport=Email 
&Notification.1.Version=2006-05-05 
&Notification.1.EventType=AssignmentSubmitted 
基於文檔這裏

http://docs.aws.amazon.com/AWSMechTurk/latest/AWSMturkAPI/ApiReference_SetHITTypeNotificationOperation.html

這裏是我的代碼:

RTurk.SetHITTypeNotification(:hit_type_id => "3M36IJVRR974ABAC76WQ0TCVKX9SIA", :notification => { :destination => "https://sqs.us-east-1.amazonaws.com/971351813114/MechanicalTurk", :transport => "SQS", :version => "2006-05-05", :event_type => "assignment_accepted" }, :active => true) 

和這裏的是我的錯誤看到:

NoMethodError: undefined method `to_param_hash' for #<Hash:0x007ffe1ed82858> 

任何人都知道w to_param_hash錯誤意味着什麼或如何解決它?

回答

1

在這個問題上花了幾個小時。在這裏接受幫助以防止其他人遇到同樣的情況。事實證明,我需要創建一個Notification對象,當您查看如何在其他上下文中使用RTurk中的Notifications時,這非常有用。這裏有一個作品的片段:

n = RTurk::Notification.new("https://sqs.us-east-1.amazonaws.com/971351813114/MechanicalTurk", "SQS", "2006-05-05", "AssignmentAccepted") 
a = RTurk.SetHITTypeNotification(:hit_type_id => "3M36IJVRR974ABAC76WQ0TCVKX9SIA", :notification => n, :active => true) 
t = RTurk.SendTestEventNotification(:notification => n, :test_event_type => "AssignmentAccepted") 

希望這可以幫助其他人在相同的情況!

相關問題