ruby-aws亚马逊机械土耳其人

时间:2015-02-11 15:23:37

标签: ruby amazon-web-services mechanicalturk

我正在尝试使用ruby-aws gem创建一个带有预先创建的表单的HIT,并不断收到错误的params错误。我将失踪的参数限制在特定于我的形式的参数上。

似乎我的请求没有正确格式化,并且亚马逊旁边没有示例。我的日志说缺少以下参数:

关系,价格,环境意识,年龄,场合,性别,幽默,经验,本地,浪漫,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
)

1 个答案:

答案 0 :(得分:2)

我能够解决这个问题 - 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
)