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,68 @@
1
+ module RTurk
2
+ class RegisterHITType < Operation
3
+
4
+ attr_accessor :title, :keywords, :description, :reward, :currency, :assignments
5
+ attr_accessor :lifetime, :duration, :auto_approval, :note
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
26
+ 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
33
+ def to_params
34
+ map_params.merge(qualifications.to_params)
35
+ end
36
+
37
+ def parse(response)
38
+ RTurk::RegisterHITTypeResponse.new(response)
39
+ end
40
+
41
+ # More complicated validation run before request
42
+ #
43
+ def validate
44
+ unless title && reward && question && description
45
+ raise RTurk::MissingParameters, "You're missing some required parameters"
46
+ end
47
+ end
48
+
49
+ private
50
+
51
+ def map_params
52
+ {'Title'=>self.title,
53
+ 'MaxAssignments' => (self.assignments || 1),
54
+ 'LifetimeInSeconds'=> (self.lifetime || 3600),
55
+ 'AssignmentDurationInSeconds' => (self.duration || 86400),
56
+ 'Reward.Amount' => self.reward,
57
+ 'Reward.CurrencyCode' => (self.currency || 'USD'),
58
+ 'Keywords' => self.keywords,
59
+ 'Description' => self.description,
60
+ 'Question' => self.question.to_params,
61
+ 'RequesterAnnotation' => note}
62
+ end
63
+
64
+ end
65
+ def self.RegisterHITType(*args, &blk)
66
+ RTurk::RegisterHITType.create(*args, &blk)
67
+ end
68
+ end
@@ -0,0 +1,44 @@
1
+ module RTurk
2
+ class SearchHITs < Operation
3
+ # You can call this operation without any parameters and get an unsorted
4
+ # list or you can pass in a :sort_by => {:title => :ascending}
5
+ #
6
+ # You can sort by
7
+ # :title
8
+ # :reward
9
+ # :expiration
10
+ # :created_at
11
+ # :enumeration
12
+
13
+ attr_accessor :sort_property, :sort_order, :page_size, :page_number, :sort_by
14
+
15
+ SORT_BY = { :title => 'Title', :reward => 'Reward', :expiration => 'Expiration', :created_at => 'CreationTime', :enumeration => 'Enumeration'}
16
+ SORT_ORDER = {:ascending => 'Ascending', :descending => 'Descending', :asc => 'Ascending', :desc => 'Descending'}
17
+
18
+ def parse(xml)
19
+ RTurk::SearchHITsResponse.new(xml)
20
+ end
21
+
22
+ def to_params
23
+ self.set_sort_by
24
+ {
25
+ 'SortProperty' => self.sort_property,
26
+ 'SortDirection' => self.sort_order,
27
+ 'PageSize' => (self.page_size || 100),
28
+ 'PageNumber' => (self.page_number || 1)
29
+ }
30
+ end
31
+
32
+ def set_sort_by
33
+ if @sort_by
34
+ @sort_property = SORT_BY[@sort_by.keys.first]
35
+ @sort_order = SORT_ORDER[@sort_by.values.first]
36
+ end
37
+ end
38
+
39
+ end
40
+ def self.SearchHITs
41
+ RTurk::SearchHITs.create
42
+ end
43
+
44
+ end
@@ -0,0 +1,8 @@
1
+ module RTurk
2
+
3
+ class Parser
4
+ include XMLUtilities
5
+
6
+ end
7
+
8
+ end
@@ -0,0 +1,29 @@
1
+ module RTurk
2
+
3
+ class AnswerParser
4
+
5
+ require 'cgi'
6
+
7
+ def self.parse(xml)
8
+ answer_xml = Nokogiri::XML(CGI.unescapeHTML(xml.to_s))
9
+ answer_hash = {}
10
+ answers = answer_xml.xpath('//xmlns:Answer')
11
+ answers.each do |answer|
12
+ key, value = nil, nil
13
+ answer.children.each do |child|
14
+ next if child.blank?
15
+ if child.name == 'QuestionIdentifier'
16
+ key = child.inner_text
17
+ else
18
+ value = child.inner_text
19
+ end
20
+ end
21
+ answer_hash[key] = value
22
+ end
23
+ answer_hash
24
+ end
25
+
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,49 @@
1
+ # Parses:
2
+ # <Assignment>
3
+ # <AssignmentId>GYFTRHZ5J3DZREY48WNZE38ZR9RR1ZPMXGWE7WE0</AssignmentId>
4
+ # <WorkerId>AD20WXZZP9XXK</WorkerId>
5
+ # <HITId>GYFTRHZ5J3DZREY48WNZ</HITId>
6
+ # <AssignmentStatus>Approved</AssignmentStatus>
7
+ # <AutoApprovalTime>2009-08-12T19:21:54Z</AutoApprovalTime>
8
+ # <AcceptTime>2009-07-13T19:21:40Z</AcceptTime>
9
+ # <SubmitTime>2009-07-13T19:21:54Z</SubmitTime>
10
+ # <ApprovalTime>2009-07-13T19:27:54Z</ApprovalTime>
11
+ # <Answer>
12
+ # <?xml version="1.0" encoding="UTF-8"?>
13
+ # <QuestionFormAnswers xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionFormAnswers.xsd">
14
+ # <Answer>
15
+ # <QuestionIdentifier>Question100</QuestionIdentifier>
16
+ # <FreeText>Move to X.</FreeText>
17
+ # </Answer>
18
+ # </QuestionFormAnswers>
19
+ # </Answer>
20
+ # </Assignment>
21
+
22
+ module RTurk
23
+
24
+ class AssignmentParser < RTurk::Parser
25
+
26
+ attr_reader :assignment_id, :hit_id, :worker_id, :status, :accepted_at, :submitted_at,
27
+ :approved_at, :auto_approval_time
28
+
29
+ def initialize(assignment_xml)
30
+ @xml_obj = assignment_xml
31
+ map_content(@xml_obj,
32
+ :assignment_id => 'AssignmentId',
33
+ :hit_id => 'HITId',
34
+ :worker_id => 'WorkerId',
35
+ :status => 'AssignmentStatus',
36
+ :accepted_at => 'AcceptTime',
37
+ :submitted_at => 'SubmitTime',
38
+ :approved_at => 'ApprovalTime',
39
+ :auto_approval_time => 'AutoApprovalTime'
40
+ )
41
+ end
42
+
43
+ def answers
44
+ AnswerParser.parse(@xml_obj.xpath('Answer').children)
45
+ end
46
+
47
+ end
48
+
49
+ end
@@ -0,0 +1,50 @@
1
+ # <HIT>
2
+ # <HITId>ZZRZPTY4ERDZWJ868JCZ</HITId>
3
+ # <HITTypeId>NYVZTQ1QVKJZXCYZCZVZ</HITTypeId>
4
+ # <CreationTime>2009-07-07T00:56:40Z</CreationTime>
5
+ # <Title>Location</Title>
6
+ # <Description>Select the image that best represents</Description>
7
+ # <HITStatus>Assignable</HITStatus>
8
+ # <MaxAssignments>1</MaxAssignments>
9
+ # <Reward>
10
+ # <Amount>5.00</Amount>
11
+ # <CurrencyCode>USD</CurrencyCode>
12
+ # <FormattedPrice>$5.00</FormattedPrice>
13
+ # </Reward>
14
+ # <AutoApprovalDelayInSeconds>2592000</AutoApprovalDelayInSeconds>
15
+ # <Expiration>2009-07-14T00:56:40Z</Expiration>
16
+ # <AssignmentDurationInSeconds>30</AssignmentDurationInSeconds>
17
+ # <NumberOfAssignmentsPending>0</NumberOfAssignmentsPending>
18
+ # <NumberOfAssignmentsAvailable>1</NumberOfAssignmentsAvailable>
19
+ # <NumberOfAssignmentsCompleted>0</NumberOfAssignmentsCompleted>
20
+ # </HIT>
21
+
22
+ module RTurk
23
+
24
+ class HITParser < RTurk::Parser
25
+
26
+ attr_reader :id, :type_id, :status, :title, :created_at, :expires_at, :assignments_duration,
27
+ :reward_amount, :max_assignments, :pending_assignments, :available_assignments,
28
+ :completed_assignments, :auto_approval_delay
29
+
30
+ def initialize(hit_xml)
31
+ @xml_obj = hit_xml
32
+ map_content(@xml_obj,
33
+ :id => 'HITId',
34
+ :type_id => 'HITTypeId',
35
+ :status => 'HITStatus',
36
+ :title => 'Title',
37
+ :created_at => 'CreationTime',
38
+ :expires_at => 'Expiration',
39
+ :assignments_duration => 'AssignmentDurationInSeconds',
40
+ :reward_amount => 'Reward/Amount',
41
+ :max_assignments => 'MaxAssignments',
42
+ :pending_assignments => 'NumberOfAssignmentsPending',
43
+ :available_assignments => 'NumberOfAssignmentsAvailable',
44
+ :completed_assignments => 'NumberOfAssignmentsCompleted',
45
+ :auto_approval_delay => 'AutoApprovalDelayInSeconds')
46
+ end
47
+
48
+ end
49
+
50
+ end
@@ -1,8 +1,7 @@
1
1
  require 'nokogiri'
2
2
 
3
3
  module RTurk
4
- class Response
5
- include RTurk::XmlUtilities
4
+ class Response < RTurk::Parser
6
5
 
7
6
  #
8
7
  # In some cases we want more than just a hash parsed from the returned
@@ -54,5 +53,11 @@ module RTurk
54
53
  xml_to_hash(@xml)
55
54
  end
56
55
 
56
+ def method_missing(method)
57
+ if @attributes && @attributes.include?(method)
58
+ @attributes[method]
59
+ end
60
+ end
61
+
57
62
  end
58
63
  end
@@ -21,12 +21,12 @@ module RTurk
21
21
  @xml.xpath('//HITId').inner_text
22
22
  end
23
23
 
24
- def hit_type_id
24
+ def type_id
25
25
  @xml.xpath('//HITTypeId').inner_text
26
26
  end
27
27
 
28
28
  def hit
29
- RTurk::Hit.new(self.hit_id, self.hit_type_id)
29
+ RTurk::Hit.new(self.hit_id, self)
30
30
  end
31
31
 
32
32
  end
@@ -31,11 +31,11 @@ module RTurk
31
31
  class GetAssignmentsForHITResponse < Response
32
32
 
33
33
  def assignments
34
- assignments = []
34
+ @assignments ||= []
35
35
  @xml.xpath('//Assignment').each do |assignment_xml|
36
- assignments << RTurk::Assignment.new(assignment_xml)
36
+ @assignments << AssignmentParser.new(assignment_xml)
37
37
  end
38
- assignments
38
+ @assignments
39
39
  end
40
40
 
41
41
  end
@@ -46,35 +46,28 @@ module RTurk
46
46
 
47
47
  class GetHITResponse < Response
48
48
 
49
- attr_accessor :id, :type_id, :status, :title, :description, :reward, :assignments
50
- attr_accessor :similar_hits, :review_status, :expires_at, :auto_approval
49
+ attr_reader :hit_id, :type_id, :status, :review_status, :title, :created_at, :expires_at,
50
+ :assignments_duration, :reward_amount, :max_assignments, :auto_approval_delay
51
51
 
52
52
  def initialize(response)
53
53
  @raw_xml = response
54
54
  @xml = Nokogiri::XML(@raw_xml)
55
55
  raise_errors
56
56
  map_content(@xml.xpath('//HIT'),
57
- :id => 'HITId',
57
+ :hit_id => 'HITId',
58
58
  :type_id => 'HITTypeId',
59
59
  :status => 'HITStatus',
60
- :title => "Title",
61
- :description => 'Description',
62
- :assignments => 'MaxAssignments',
63
- :similar_hits => 'NumberOfSimilarHITs',
64
60
  :review_status => 'HITReviewStatus',
61
+ :title => 'Title',
62
+ :created_at => 'CreationTime',
65
63
  :expires_at => 'Expiration',
66
- :auto_approval => 'AutoApprovalDelayInSeconds'
64
+ :assignments_duration => 'AssignmentDurationInSeconds',
65
+ :reward_amount => 'Reward/Amount',
66
+ :max_assignments => 'MaxAssignments',
67
+ :auto_approval_delay => 'AutoApprovalDelayInSeconds'
67
68
  )
68
69
  end
69
70
 
70
- def expires_at=(time)
71
- @expires_at = Time.parse(time)
72
- end
73
-
74
- def auto_approval=(seconds)
75
- @auto_approval = seconds.to_i
76
- end
77
-
78
71
  end
79
72
 
80
73
  end
@@ -20,12 +20,10 @@ module RTurk
20
20
 
21
21
  class GetReviewableHITsResponse < Response
22
22
 
23
- def hits
24
- @hits ||= []
25
- @xml.xpath('//HIT').each do |hit_xml|
26
- @hits << RTurk::Hit.new(hit_xml.inner_text.strip)
23
+ def hit_ids
24
+ @xml.xpath('//HIT').inject([]) do |arr, hit_xml|
25
+ arr << hit_xml.inner_text.strip; arr
27
26
  end
28
- @hits
29
27
  end
30
28
 
31
29
  end
@@ -0,0 +1,17 @@
1
+ # Parses out the RegisterHITType response
2
+ #
3
+ # Example response:
4
+ # <RegisterHITTypeResult>
5
+ # <Request>
6
+ # <IsValid>True</IsValid>
7
+ # </Request>
8
+ # <HITTypeId>KZ3GKTRXBWGYX8WXBW60</HITTypeId>
9
+ # </RegisterHITTypeResult>
10
+
11
+ module RTurk
12
+ class RegisterHITTypeResponse < Response
13
+ def type_id
14
+ @xml.xpath('//HITTypeId').inner_text
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,65 @@
1
+ module RTurk
2
+ # <SearchHITsResult>
3
+ # <Request>
4
+ # <IsValid>True</IsValid>
5
+ # </Request>
6
+ # <NumResults>2</NumResults>
7
+ # <TotalNumResults>2</TotalNumResults>
8
+ # <PageNumber>1</PageNumber>
9
+ #
10
+ # <HIT>
11
+ # <HITId>GBHZVQX3EHXZ2AYDY2T0</HITId>
12
+ # <HITTypeId>NYVZTQ1QVKJZXCYZCZVZ</HITTypeId>
13
+ # <CreationTime>2009-04-22T00:17:32Z</CreationTime>
14
+ # <Title>Location</Title>
15
+ # <Description>Select the image that best represents</Description>
16
+ # <HITStatus>Reviewable</HITStatus>
17
+ # <MaxAssignments>1</MaxAssignments>
18
+ # <Reward>
19
+ # <Amount>5.00</Amount>
20
+ # <CurrencyCode>USD</CurrencyCode>
21
+ # <FormattedPrice>$5.00</FormattedPrice>
22
+ # </Reward>
23
+ # <AutoApprovalDelayInSeconds>2592000</AutoApprovalDelayInSeconds>
24
+ # <Expiration>2009-04-29T00:17:32Z</Expiration>
25
+ # <AssignmentDurationInSeconds>30</AssignmentDurationInSeconds>
26
+ # <NumberOfAssignmentsPending>0</NumberOfAssignmentsPending>
27
+ # <NumberOfAssignmentsAvailable>0</NumberOfAssignmentsAvailable>
28
+ # <NumberOfAssignmentsCompleted>1</NumberOfAssignmentsCompleted>
29
+ # </HIT>
30
+ #
31
+ # <HIT>
32
+ # <HITId>ZZRZPTY4ERDZWJ868JCZ</HITId>
33
+ # <HITTypeId>NYVZTQ1QVKJZXCYZCZVZ</HITTypeId>
34
+ # <CreationTime>2009-07-07T00:56:40Z</CreationTime>
35
+ # <Title>Location</Title>
36
+ # <Description>Select the image that best represents</Description>
37
+ # <HITStatus>Assignable</HITStatus>
38
+ # <MaxAssignments>1</MaxAssignments>
39
+ # <Reward>
40
+ # <Amount>5.00</Amount>
41
+ # <CurrencyCode>USD</CurrencyCode>
42
+ # <FormattedPrice>$5.00</FormattedPrice>
43
+ # </Reward>
44
+ # <AutoApprovalDelayInSeconds>2592000</AutoApprovalDelayInSeconds>
45
+ # <Expiration>2009-07-14T00:56:40Z</Expiration>
46
+ # <AssignmentDurationInSeconds>30</AssignmentDurationInSeconds>
47
+ # <NumberOfAssignmentsPending>0</NumberOfAssignmentsPending>
48
+ # <NumberOfAssignmentsAvailable>1</NumberOfAssignmentsAvailable>
49
+ # <NumberOfAssignmentsCompleted>0</NumberOfAssignmentsCompleted>
50
+ # </HIT>
51
+ # </SearchHITsResult>
52
+
53
+ class SearchHITsResponse < Response
54
+
55
+ def hits
56
+ @hits ||= begin
57
+ @xml.xpath('//HIT').inject([]) do |arr, hit_xml|
58
+ arr << HITParser.new(hit_xml); arr
59
+ end
60
+ end
61
+ end
62
+
63
+ end
64
+
65
+ end