rturk 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/README.markdown +3 -2
  2. data/Rakefile +10 -4
  3. data/VERSION +1 -1
  4. data/aws_docs/ApiReference_AnswerKeyDataStructureArticle.html +98 -0
  5. data/aws_docs/ApiReference_ApproveAssignmentOperation.html +75 -0
  6. data/aws_docs/ApiReference_AssignQualificationOperation.html +107 -0
  7. data/aws_docs/ApiReference_AssignmentDataStructureArticle.html +171 -0
  8. data/aws_docs/ApiReference_BlockWorkerOperation.html +70 -0
  9. data/aws_docs/ApiReference_ChangeHITTypeOfHITOperation.html +68 -0
  10. data/aws_docs/ApiReference_CommonParametersArticle.html +119 -0
  11. data/aws_docs/ApiReference_CreateHITOperation.html +330 -0
  12. data/aws_docs/ApiReference_CreateQualificationTypeOperation.html +190 -0
  13. data/aws_docs/ApiReference_DataStructuresArticle.html +7 -0
  14. data/aws_docs/ApiReference_DisableHITOperation.html +63 -0
  15. data/aws_docs/ApiReference_DisposeHITOperation.html +56 -0
  16. data/aws_docs/ApiReference_DisposeQualificationTypeOperation.html +52 -0
  17. data/aws_docs/ApiReference_ExtendHITOperation.html +86 -0
  18. data/aws_docs/ApiReference_ExternalQuestionArticle.html +125 -0
  19. data/aws_docs/ApiReference_ForceExpireHITOperation.html +61 -0
  20. data/aws_docs/ApiReference_FormattedContentXHTMLArticle.html +289 -0
  21. data/aws_docs/ApiReference_GetAccountBalanceOperation.html +51 -0
  22. data/aws_docs/ApiReference_GetAssignmentsForHITOperation.html +166 -0
  23. data/aws_docs/ApiReference_GetBonusPaymentsOperation.html +160 -0
  24. data/aws_docs/ApiReference_GetFileUploadURLOperation.html +75 -0
  25. data/aws_docs/ApiReference_GetHITOperation.html +89 -0
  26. data/aws_docs/ApiReference_GetHITsForQualificationTypeOperation.html +137 -0
  27. data/aws_docs/ApiReference_GetQualificationRequestsOperation.html +155 -0
  28. data/aws_docs/ApiReference_GetQualificationScoreOperation.html +68 -0
  29. data/aws_docs/ApiReference_GetQualificationTypeOperation.html +57 -0
  30. data/aws_docs/ApiReference_GetQualificationsForQualificationTypeOperation.html +134 -0
  31. data/aws_docs/ApiReference_GetRequesterStatisticOperation.html +315 -0
  32. data/aws_docs/ApiReference_GetReviewableHITsOperation.html +155 -0
  33. data/aws_docs/ApiReference_GrantBonusOperation.html +95 -0
  34. data/aws_docs/ApiReference_GrantQualificationOperation.html +69 -0
  35. data/aws_docs/ApiReference_HITDataStructureArticle.html +302 -0
  36. data/aws_docs/ApiReference_HelpOperation.html +125 -0
  37. data/aws_docs/ApiReference_LocaleDataStructureArticle.html +29 -0
  38. data/aws_docs/ApiReference_NotificationAPI_BuildingANotificationReceptor.html +36 -0
  39. data/aws_docs/ApiReference_NotificationAPI_ElementsOfANotification.html +40 -0
  40. data/aws_docs/ApiReference_NotificationDataStructureArticle.html +73 -0
  41. data/aws_docs/ApiReference_NotificationReceptorAPIArticle.html +9 -0
  42. data/aws_docs/ApiReference_NotificationReceptorAPI_RESTTransportArticle.html +39 -0
  43. data/aws_docs/ApiReference_NotificationReceptorAPI_SOAPTransportArticle.html +45 -0
  44. data/aws_docs/ApiReference_NotifyWorkersOperation.html +82 -0
  45. data/aws_docs/ApiReference_OperationsArticle.html +8 -0
  46. data/aws_docs/ApiReference_PriceDataStructureArticle.html +65 -0
  47. data/aws_docs/ApiReference_QualificationDataStructureArticle.html +89 -0
  48. data/aws_docs/ApiReference_QualificationRequestDataStructureArticle.html +102 -0
  49. data/aws_docs/ApiReference_QualificationRequirementDataStructureArticle.html +176 -0
  50. data/aws_docs/ApiReference_QualificationTypeDataStructureArticle.html +198 -0
  51. data/aws_docs/ApiReference_QuestionAnswerDataArticle.html +8 -0
  52. data/aws_docs/ApiReference_QuestionFormAnswersDataStructureArticle.html +54 -0
  53. data/aws_docs/ApiReference_QuestionFormDataStructureArticle.html +796 -0
  54. data/aws_docs/ApiReference_RegisterHITTypeOperation.html +149 -0
  55. data/aws_docs/ApiReference_RejectAssignmentOperation.html +66 -0
  56. data/aws_docs/ApiReference_RejectQualificationRequestOperation.html +61 -0
  57. data/aws_docs/ApiReference_RevokeQualificationOperation.html +78 -0
  58. data/aws_docs/ApiReference_SearchHITsOperation.html +164 -0
  59. data/aws_docs/ApiReference_SearchQualificationTypesOperation.html +211 -0
  60. data/aws_docs/ApiReference_SendTestEventNotificationOperation.html +78 -0
  61. data/aws_docs/ApiReference_SetHITAsReviewingOperation.html +73 -0
  62. data/aws_docs/ApiReference_SetHITTypeNotificationOperation.html +99 -0
  63. data/aws_docs/ApiReference_UnblockWorkerOperation.html +67 -0
  64. data/aws_docs/ApiReference_UpdateQualificationScoreOperation.html +77 -0
  65. data/aws_docs/ApiReference_UpdateQualificationTypeOperation.html +180 -0
  66. data/aws_docs/ApiReference_WsdlLocationArticle.html +95 -0
  67. data/aws_docs/ApiReference_XMLParameterValuesArticle.html +37 -0
  68. data/aws_docs/Welcome.html +125 -0
  69. data/aws_docs/WhatsNew.html +16 -0
  70. data/aws_docs/_title.html +28 -0
  71. data/aws_docs/_toc.html +749 -0
  72. data/aws_docs/aws-docs-IE.css +419 -0
  73. data/aws_docs/aws-docs.css +455 -0
  74. data/aws_docs/copyrightinfo.html +14 -0
  75. data/aws_docs/frameset.js +12 -0
  76. data/aws_docs/images/Feedback_link.gif +0 -0
  77. data/aws_docs/images/caution.png +0 -0
  78. data/aws_docs/images/home.gif +0 -0
  79. data/aws_docs/images/important.png +0 -0
  80. data/aws_docs/images/next.gif +0 -0
  81. data/aws_docs/images/note.png +0 -0
  82. data/aws_docs/images/prev.gif +0 -0
  83. data/aws_docs/images/tip.png +0 -0
  84. data/aws_docs/images/title-swoosh-logo.gif +0 -0
  85. data/aws_docs/images/toc_bullet.gif +0 -0
  86. data/aws_docs/images/toc_plus.gif +0 -0
  87. data/aws_docs/index.html +18 -0
  88. data/aws_docs/toc.js +84 -0
  89. data/lib/rturk.rb +2 -2
  90. data/lib/rturk/adapter.rb +11 -0
  91. data/lib/rturk/adapters/assignment.rb +13 -50
  92. data/lib/rturk/adapters/hit.rb +21 -9
  93. data/lib/rturk/adapters/worker.rb +23 -0
  94. data/lib/rturk/operation.rb +1 -1
  95. data/lib/rturk/operations/create_hit.rb +10 -54
  96. data/lib/rturk/operations/register_hit_type.rb +68 -0
  97. data/lib/rturk/operations/search_hits.rb +44 -0
  98. data/lib/rturk/parser.rb +8 -0
  99. data/lib/rturk/parsers/answer_parser.rb +29 -0
  100. data/lib/rturk/parsers/assignment_parser.rb +49 -0
  101. data/lib/rturk/parsers/hit_parser.rb +50 -0
  102. data/lib/rturk/{response.rb → parsers/response.rb} +7 -2
  103. data/lib/rturk/{responses → parsers/responses}/create_hit_response.rb +2 -2
  104. data/lib/rturk/{responses → parsers/responses}/get_account_balance_response.rb +0 -0
  105. data/lib/rturk/{responses → parsers/responses}/get_assignments_for_hit_response.rb +3 -3
  106. data/lib/rturk/{responses → parsers/responses}/get_hit_response.rb +9 -16
  107. data/lib/rturk/{responses → parsers/responses}/get_reviewable_hits_response.rb +3 -5
  108. data/lib/rturk/parsers/responses/register_hit_type_response.rb +17 -0
  109. data/lib/rturk/parsers/responses/search_hits_response.rb +65 -0
  110. data/lib/rturk/xml_utilities.rb +14 -3
  111. data/rturk.gemspec +112 -12
  112. data/spec/adapters/hit_spec.rb +10 -0
  113. data/spec/fake_responses/register_hit_type.xml +6 -0
  114. data/spec/fake_responses/search_hits.xml +50 -0
  115. data/spec/operations/create_hit_spec.rb +2 -2
  116. data/spec/operations/get_hit_spec.rb +1 -1
  117. data/spec/operations/register_hit_type_spec.rb +24 -0
  118. data/spec/{adapters/answers_spec.rb → parsers/answer_parser_spec.rb} +2 -2
  119. data/spec/parsers/hit_parser_spec.rb +41 -0
  120. data/spec/xml_parse_spec.rb +2 -2
  121. metadata +111 -11
  122. data/lib/rturk/adapters/answers.rb +0 -38
@@ -0,0 +1,14 @@
1
+ <html>
2
+ <head>
3
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4
+
5
+ <title>Copyright Information</title>
6
+ <link rel="stylesheet" href="aws-docs.css" type="text/css">
7
+ </head>
8
+ <body>
9
+ <h3>Amazon Mechanical Turk API Reference (API Version 2008-08-02)</h3>
10
+ <p>
11
+ Copyright &copy; 2009 Amazon Web Services LLC or its affiliates. All rights reserved.
12
+ </p>
13
+ </body>
14
+ </html>
@@ -0,0 +1,12 @@
1
+
2
+ // Check to see if the page is outside of the frameset
3
+ if (top.location == self.location) {
4
+ // If it isn't in the frameset, get the filename
5
+ var file_name = document.location.href;
6
+ var end = (file_name.indexOf("?") == -1) ? file_name.length : file_name.indexOf("?");
7
+ // Then load the file in the frameset and append the filename at the end
8
+ self.location.replace("index.html?"+file_name.substring(file_name.lastIndexOf("/")+1, end));
9
+ }
10
+ // If it is in the frameset, it's fine.
11
+ else {
12
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,18 @@
1
+ <html>
2
+ <head>
3
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4
+
5
+ <title>Amazon Mechanical Turk</title><script type="text/javascript" src="toc.js"></script></head>
6
+ <frameset rows="50,*" cols="*" frameborder="no" color="#006699" onload="loadContent()">
7
+ <frame src="_title.html" name="titleFrame" scrolling="no" noresize="yes">
8
+ <frameset cols="220,*">
9
+ <frame src="_toc.html" name="navFrame" scrolling="yes">
10
+ <frame src="Welcome.html" name="mainFrame" onload="extractFileName()">
11
+ </frameset>
12
+ </frameset>
13
+ <noframes>
14
+ Sorry, this document can be viewed only with a
15
+ frames-capable browser.
16
+
17
+ </noframes>
18
+ </html>
data/aws_docs/toc.js ADDED
@@ -0,0 +1,84 @@
1
+ // Get the filename from the url (for forwards from pages loaded outside a frameset)
2
+ var myPage = top.document.location.search.substr(1);
3
+
4
+ // This is the function that loads the new page (if there is one) into the mainFrame.
5
+ function loadContent() {
6
+ i = document.getElementsByTagName('FRAME')[2];
7
+
8
+ // If we find something after the "?", load that file in the mainFrame.
9
+ if (myPage.length > 0) {
10
+ // If the link is from the "Get Started" button, handle it.
11
+ if (myPage.lastIndexOf(".html") == -1){
12
+ var iSrc = i.getAttribute("src");
13
+ myPage = iSrc;
14
+ }
15
+ else {
16
+ i.src = myPage;
17
+ }
18
+ }
19
+ else {
20
+ // If we don't find anything, set the variable to the default first page.
21
+ var iSrc = i.getAttribute("src");
22
+ myPage = iSrc;
23
+ }
24
+ }
25
+
26
+ // Get the filename of the loaded page, strip out the suffix, and pass it on.
27
+ function extractFileName() {
28
+ var path = window.frames['mainFrame'].document.location.pathname;
29
+ var lastSlash = path.lastIndexOf("/");
30
+ var fileName = path.substring(lastSlash+1,path.length);
31
+ var myLink = fileName.slice(0,-5);
32
+ //alert(myLink);
33
+ highlight(myLink);
34
+ }
35
+
36
+ // Highlight the TOC entry of the loaded page, and pass along variables.
37
+ function highlight(name) {
38
+ var jsFrame = window.frames['navFrame'];
39
+ var syncId = "t-" + name;
40
+ jsFrame.changeColor(syncId);
41
+ syncUp(name,syncId);
42
+ setTimeout(function(){scrollNow(syncId);},50)
43
+ //scrollHold(syncId);
44
+ }
45
+
46
+ // Synchronize the TOC with the content displayed in the mainFrame.
47
+ function syncUp(id,tId) {
48
+ var jsFrame = window.frames['navFrame'];
49
+ var linkId = jsFrame.document.getElementById(id);
50
+ var tLinkId = jsFrame.document.getElementById(tId);
51
+ var parent_node = tLinkId.parentNode.parentNode.parentNode.parentNode.parentNode;
52
+ var sibling_node = tLinkId.parentNode.parentNode.childNodes[1];
53
+ var par = parent_node.id;
54
+ var syncPar = "t-" + id;
55
+ var topParent = jsFrame.document.getElementsByTagName("TABLE")[1];
56
+ if (sibling_node) {
57
+ jsFrame.tocShowChildren(id);
58
+ if (parent_node && parent_node != topParent) {
59
+ syncUp(par,syncPar);
60
+ }
61
+ else if (!parent_node) {
62
+ }
63
+ }
64
+ else if (!sibling_node) {
65
+ if ( parent_node && parent_node != topParent) {
66
+ syncUp(par,syncPar);
67
+ }
68
+ else if (!parent_node) {
69
+ }
70
+ }
71
+ }
72
+
73
+ function scrollHold(i) {
74
+ //thisObj = this;
75
+ //alert(i);
76
+ setTimeout(scrollNow(i), 1000);
77
+ }
78
+
79
+ function scrollNow(i) {
80
+ //alert(i);
81
+ var jsFrame = window.frames['navFrame'];
82
+ var scrollId = jsFrame.document.getElementById(i)
83
+ scrollId.scrollIntoView(true);
84
+ }
data/lib/rturk.rb CHANGED
@@ -27,12 +27,12 @@ end
27
27
  require 'rturk/utilities'
28
28
  require 'rturk/xml_utilities'
29
29
  require 'rturk/requester'
30
- require 'rturk/response'
31
- Dir.glob(File.join(File.dirname(__FILE__), 'rturk', 'responses', '*.rb')).each {|f| require f }
32
30
  require 'rturk/operation'
31
+ require 'rturk/parser'
33
32
  Dir.glob(File.join(File.dirname(__FILE__), 'rturk', 'operations', '*.rb')).each {|f| require f }
34
33
  Dir.glob(File.join(File.dirname(__FILE__), 'rturk', 'builders', '*.rb')).each {|f| require f }
35
34
  Dir.glob(File.join(File.dirname(__FILE__), 'rturk', 'adapters', '*.rb')).each {|f| require f }
36
35
  Dir.glob(File.join(File.dirname(__FILE__), 'rturk', 'parsers', '*.rb')).each {|f| require f }
36
+ Dir.glob(File.join(File.dirname(__FILE__), 'rturk', 'parsers', 'responses', '*.rb')).each {|f| require f }
37
37
 
38
38
  require 'rturk/errors'
@@ -0,0 +1,11 @@
1
+ module RTurk
2
+
3
+ class Adapter
4
+
5
+ def setup_attributes(attrs = {})
6
+ @attributes = attrs
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -2,54 +2,12 @@ require 'time'
2
2
 
3
3
  module RTurk
4
4
 
5
- # Parses:
6
- # <Assignment>
7
- # <AssignmentId>GYFTRHZ5J3DZREY48WNZE38ZR9RR1ZPMXGWE7WE0</AssignmentId>
8
- # <WorkerId>AD20WXZZP9XXK</WorkerId>
9
- # <HITId>GYFTRHZ5J3DZREY48WNZ</HITId>
10
- # <AssignmentStatus>Approved</AssignmentStatus>
11
- # <AutoApprovalTime>2009-08-12T19:21:54Z</AutoApprovalTime>
12
- # <AcceptTime>2009-07-13T19:21:40Z</AcceptTime>
13
- # <SubmitTime>2009-07-13T19:21:54Z</SubmitTime>
14
- # <ApprovalTime>2009-07-13T19:27:54Z</ApprovalTime>
15
- # <Answer>
16
- # <?xml version="1.0" encoding="UTF-8"?>
17
- # <QuestionFormAnswers xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionFormAnswers.xsd">
18
- # <Answer>
19
- # <QuestionIdentifier>Question100</QuestionIdentifier>
20
- # <FreeText>Move to X.</FreeText>
21
- # </Answer>
22
- # </QuestionFormAnswers>
23
- # </Answer>
24
- # </Assignment>
25
-
26
5
  class Assignment
27
- include RTurk::XmlUtilities
28
-
29
- attr_accessor :worker_id, :id, :status, :submitted_at, :accepted_at, :approved_at
30
- attr_reader :answers
31
-
32
- def initialize(xml_object)
33
- map_content(xml_object,
34
- :id => 'AssignmentId',
35
- :worker_id => 'WorkerId',
36
- :status => 'AssignmentStatus',
37
- :accepted_at => 'AcceptTime',
38
- :approved_at => "ApprovalTime",
39
- :submitted_at => 'SubmitTime')
40
- self.answers = xml_object.xpath('Answer')
41
- end
42
-
43
- def approved_at=(time)
44
- @approved_at = Time.parse(time)
45
- end
46
6
 
47
- def submitted_at=(time)
48
- @submitted_at = Time.parse(time)
49
- end
7
+ attr_reader :id, :source
50
8
 
51
- def accepted_at=(time)
52
- @accepted_at = Time.parse(time)
9
+ def initialize(id, source = nil)
10
+ @id, @source = id, source
53
11
  end
54
12
 
55
13
  def approve!(feedback = nil)
@@ -61,13 +19,18 @@ module RTurk
61
19
  end
62
20
 
63
21
  def bonus!(amount, reason)
64
- RTurk::GrantBonus(:amount, :feedback => reason)
22
+ RTurk::GrantBonus(:assignment_id => self.id, :worker_id => self.worker_id, :amount => amount, :feedback => reason)
65
23
  end
66
-
67
- def answers=(answer_xml)
68
- @answers = RTurk::Answers.new(answer_xml.children.to_s)
24
+
25
+ def worker
26
+ RTurk::Worker.new(self.worker_id)
27
+ end
28
+
29
+ def method_missing(method, *args)
30
+ if self.source.respond_to?(method)
31
+ self.source.send(method, *args)
32
+ end
69
33
  end
70
-
71
34
  end
72
35
 
73
36
  end
@@ -20,13 +20,13 @@ module RTurk
20
20
 
21
21
 
22
22
  class Hit
23
- include RTurk::XmlUtilities
23
+ include RTurk::XMLUtilities
24
24
 
25
25
  class << self;
26
26
 
27
27
  def create(*args, &blk)
28
28
  response = RTurk::CreateHIT(*args, &blk)
29
- response.hit
29
+ new(response.hit_id, response)
30
30
  end
31
31
 
32
32
  def find(id)
@@ -34,19 +34,29 @@ module RTurk
34
34
  end
35
35
 
36
36
  def all_reviewable
37
- RTurk.GetReviewableHITs.hits
37
+ RTurk.GetReviewableHITs.hit_ids.inject([]) do |arr, hit_id|
38
+ arr << new(hit_id); arr
39
+ end
40
+ end
41
+
42
+ def all
43
+ RTurk.SearchHITs.hits.inject([]) do |arr, hit|
44
+ arr << new(hit.id, hit); arr;
45
+ end
38
46
  end
39
47
 
40
48
  end
41
49
 
42
- attr_accessor :id
50
+ attr_accessor :id, :source
43
51
 
44
- def initialize(id, type = nil)
45
- @id, @type = id, type
52
+ def initialize(id, source = nil)
53
+ @id, @source = id, source
46
54
  end
47
55
 
48
56
  def assignments
49
- RTurk::GetAssignmentsForHIT(:hit_id => self.id).assignments
57
+ RTurk::GetAssignmentsForHIT(:hit_id => self.id).assignments.inject([]) do |arr,assignment|
58
+ arr << RTurk::Assignment.new(assignment.assignment_id, assignment); arr
59
+ end
50
60
  end
51
61
 
52
62
  def details
@@ -75,8 +85,10 @@ module RTurk
75
85
  end
76
86
 
77
87
  def method_missing(method, *args)
78
- if self.details.respond_to?(method)
79
- self.details.send(method, *args)
88
+ if @source.respond_to?(method)
89
+ @source.send(method, *args)
90
+ elsif self.details.respond_to?(method)
91
+ self.details.send(method)
80
92
  end
81
93
  end
82
94
 
@@ -0,0 +1,23 @@
1
+ module RTurk
2
+
3
+ class Worker
4
+
5
+ def initialize(id)
6
+ @id = id
7
+ end
8
+
9
+ # Blocks a worker, the reason is required and not shown to the worker
10
+ #
11
+ def block!(reason)
12
+ RTurk::BlockWorker(:worker_id => @id, :reason => reason)
13
+ end
14
+
15
+ # Unblock the worker
16
+ #
17
+ def unblock!
18
+ RTurk::UnblockWorker(:worker_id => @id)
19
+ end
20
+
21
+ end
22
+
23
+ end
@@ -65,7 +65,7 @@ module RTurk
65
65
  validate
66
66
  end
67
67
  check_params
68
- params = {'Operation' => self.class.to_s.gsub('RTurk::', '')}
68
+ params = {'Operation' => self.class.to_s.gsub(/^\w+::/,'')}
69
69
  params = params.merge(self.default_params)
70
70
  params = to_params.merge(params)
71
71
  response = RTurk.Request(params)
@@ -1,43 +1,17 @@
1
+ require File.join(File.dirname(__FILE__), 'register_hit_type')
2
+
1
3
  module RTurk
2
- class CreateHIT < Operation
3
-
4
- attr_accessor :title, :keywords, :description, :reward, :currency, :assignments
5
- attr_accessor :lifetime, :duration, :auto_approval, :note, :hit_type_id
4
+ class CreateHIT < RegisterHITType
5
+ attr_accessor :hit_type_id
6
6
 
7
- # @param [Symbol, Hash] qualification_key opts The unique qualification key
8
- # @option opts [Hash] :comparator A comparator and value e.g. :gt => 80
9
- # @option opts [Boolean] :boolean true or false
10
- # @option opts [Symbol] :exists A comparator without a value
11
- # @return [RTurk::Qualifications]
12
- def qualifications
13
- @qualifications ||= RTurk::Qualifications.new
14
- end
15
-
16
- # Gives us access to a question builder attached to this HIT
17
- #
18
- # @param [String, Hash] URL Params, if none is passed, simply returns the question
19
- # @return [RTurk::Question] The question if instantiated or nil
20
- def question(*args)
21
- unless args.empty?
22
- @question ||= RTurk::Question.new(*args)
23
- else
24
- @question
25
- end
7
+ def parse(response)
8
+ RTurk::CreateHITResponse.new(response)
26
9
  end
27
-
28
- # Returns parameters specific to this instance
29
- #
30
- # @return [Hash]
31
- # Any class level default parameters get loaded in at
32
- # the time of request
10
+
33
11
  def to_params
34
- params = map_params.merge(qualifications.to_params)
12
+ super.merge('HITTypeId' => hit_type_id)
35
13
  end
36
14
 
37
- def parse(response)
38
- RTurk::CreateHITResponse.new(response)
39
- end
40
-
41
15
  # More complicated validation run before request
42
16
  #
43
17
  def validate
@@ -46,30 +20,12 @@ module RTurk
46
20
  raise RTurk::MissingParameters, "When you specify a HitTypeID, you must incude a question and lifetime length"
47
21
  end
48
22
  else
49
- unless title && reward && question && description
50
- raise RTurk::MissingParameters, "You're missing some required parameters"
51
- end
23
+ super # validate as RegisterHitType
52
24
  end
53
25
  end
54
-
55
- private
56
-
57
- def map_params
58
- {'Title'=>self.title,
59
- 'MaxAssignments' => (self.assignments || 1),
60
- 'LifetimeInSeconds'=> (self.lifetime || 3600),
61
- 'AssignmentDurationInSeconds' => (self.duration || 86400),
62
- 'Reward.Amount' => self.reward,
63
- 'Reward.CurrencyCode' => (self.currency || 'USD'),
64
- 'Keywords' => self.keywords,
65
- 'Description' => self.description,
66
- 'Question' => self.question.to_params,
67
- 'RequesterAnnotation' => note}
68
- end
69
-
70
26
  end
27
+
71
28
  def self.CreateHIT(*args, &blk)
72
29
  RTurk::CreateHIT.create(*args, &blk)
73
30
  end
74
-
75
31
  end