2015-02-11 80 views
2

我想創建一個預先創建的形式使用紅寶石aws寶石的HIT,並不斷得到一個缺少的參數錯誤。我已經將缺少的參數限制在我的表格的具體參數中。ruby​​-aws亞馬遜機械土耳其

看來我的請求沒有正確格式化,並且旁邊沒有亞馬遜的例子。我的日誌說以下PARAMS缺失:

關係,價格,environmental_consciousness,年齡,場合,性別,幽默,經驗,地方,浪漫,additional_information

任何幫助,非常感謝!

下面是我的當前請求:

hit = mturk.createHIT(
    :Operation => 'CreateHIT', 
    :Title => 'Find a gift based on user scores', 
    :Description => 'Find a gift for an individual based on survey scores.', 
    :MaxAssignments => 3, 
    :Signature => signature, 
    :Timestamp => timestamp, 
    :Reward => { :Amount => 0.25, :CurrencyCode => 'USD' }, 
    :HITLayoutId => '3AV6FF2M2GYMGLRQEKHZ7EBN4EZOJE', 
    :HitLayoutParameter => {'Name' => 'additional_information', 'Value' => 'TEST'}, 
    :HitLayoutParameter => {'Name' => 'age', 'Value' => '22'}, 
    :HitLayoutParameter => {'Name' => 'environmental_consciousness', 'Value' => '54'}, 
    :HitLayoutParameter => {'Name' => 'experience', 'Value' => '32'}, 
    :HitLayoutParameter => {'Name' => 'gender', 'Value' => 'male'}, 
    :HitLayoutParameter => {'Name' => 'humor', 'Value' => '66'}, 
    :HitLayoutParameter => {'Name' => 'local', 'Value' => '21'}, 
    :HitLayoutParameter => {'Name' => 'occasion', 'Value' => '43'}, 
    :HitLayoutParameter => {'Name' => 'price', 'Value' => '33'}, 
    :HitLayoutParameter => {'Name' => 'relationship', 'Value' => '23'}, 
    :HitLayoutParameter => {'Name' => 'romance', 'Value' => '23'}, 

    :Keywords => 'data collection, gifting, gifts, shopping, gift listings, presents', 
    :AssignmentDurationInSeconds => 300, 
    :LifetimeInSeconds => 604800 
) 

回答

2

我能夠resolive問題 - AWS有可怕的命名約定。上面的例子確實使用了正確的格式,但是HitLayoutParameter必須是HITLayoutParameter - 注意CAPITAL HIT vs Hit。

另外,當提交多個參數時,應該只有一個HITLayoutParameter等於一個Name/Value對的數組。下面的工作代碼。

希望這可以幫助別人!

最佳,

〜DFO〜

hit = mturk.createHIT(
    :Operation => 'CreateHIT', 
    :Title => 'Find a gift based on user scores', 
    :Description => 'Find a gift for an individual based on survey scores.', 
    :MaxAssignments => 3, 
    :Signature => signature, 
    :Timestamp => timestamp, 
    :Reward => { :Amount => 0.25, :CurrencyCode => 'USD' }, 
    :HITLayoutId => '3AV6FF2M2GYMGLRQEKHZ7EBN4EZOJE', 
    :HITLayoutParameter => [ 
     {:Name => 'additional_information', :Value => 'TEST'}, 
     {:Name => 'age', :Value => '22'}, 
     {:Name => 'environmental_consciousness', :Value => '54'}, 
     {:Name => 'experience', :Value => '32'}, 
     {:Name => 'gender', :Value => 'male'}, 
     {:Name => 'humor', :Value => '66'}, 
     {:Name => 'local', :Value => '21'}, 
     {:Name => 'occasion', :Value => '43'}, 
     {:Name => 'price', :Value => '33'}, 
     {:Name => 'relationship', :Value => '23'}, 
     {:Name => 'romance', :Value => '23'} 
    ], 

    :Keywords => 'data collection, gifting, gifts, shopping, gift listings, presents', 
    :AssignmentDurationInSeconds => 300, 
    :LifetimeInSeconds => 604800 
)