rturk 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +3 -2
- data/Rakefile +10 -4
- data/VERSION +1 -1
- data/aws_docs/ApiReference_AnswerKeyDataStructureArticle.html +98 -0
- data/aws_docs/ApiReference_ApproveAssignmentOperation.html +75 -0
- data/aws_docs/ApiReference_AssignQualificationOperation.html +107 -0
- data/aws_docs/ApiReference_AssignmentDataStructureArticle.html +171 -0
- data/aws_docs/ApiReference_BlockWorkerOperation.html +70 -0
- data/aws_docs/ApiReference_ChangeHITTypeOfHITOperation.html +68 -0
- data/aws_docs/ApiReference_CommonParametersArticle.html +119 -0
- data/aws_docs/ApiReference_CreateHITOperation.html +330 -0
- data/aws_docs/ApiReference_CreateQualificationTypeOperation.html +190 -0
- data/aws_docs/ApiReference_DataStructuresArticle.html +7 -0
- data/aws_docs/ApiReference_DisableHITOperation.html +63 -0
- data/aws_docs/ApiReference_DisposeHITOperation.html +56 -0
- data/aws_docs/ApiReference_DisposeQualificationTypeOperation.html +52 -0
- data/aws_docs/ApiReference_ExtendHITOperation.html +86 -0
- data/aws_docs/ApiReference_ExternalQuestionArticle.html +125 -0
- data/aws_docs/ApiReference_ForceExpireHITOperation.html +61 -0
- data/aws_docs/ApiReference_FormattedContentXHTMLArticle.html +289 -0
- data/aws_docs/ApiReference_GetAccountBalanceOperation.html +51 -0
- data/aws_docs/ApiReference_GetAssignmentsForHITOperation.html +166 -0
- data/aws_docs/ApiReference_GetBonusPaymentsOperation.html +160 -0
- data/aws_docs/ApiReference_GetFileUploadURLOperation.html +75 -0
- data/aws_docs/ApiReference_GetHITOperation.html +89 -0
- data/aws_docs/ApiReference_GetHITsForQualificationTypeOperation.html +137 -0
- data/aws_docs/ApiReference_GetQualificationRequestsOperation.html +155 -0
- data/aws_docs/ApiReference_GetQualificationScoreOperation.html +68 -0
- data/aws_docs/ApiReference_GetQualificationTypeOperation.html +57 -0
- data/aws_docs/ApiReference_GetQualificationsForQualificationTypeOperation.html +134 -0
- data/aws_docs/ApiReference_GetRequesterStatisticOperation.html +315 -0
- data/aws_docs/ApiReference_GetReviewableHITsOperation.html +155 -0
- data/aws_docs/ApiReference_GrantBonusOperation.html +95 -0
- data/aws_docs/ApiReference_GrantQualificationOperation.html +69 -0
- data/aws_docs/ApiReference_HITDataStructureArticle.html +302 -0
- data/aws_docs/ApiReference_HelpOperation.html +125 -0
- data/aws_docs/ApiReference_LocaleDataStructureArticle.html +29 -0
- data/aws_docs/ApiReference_NotificationAPI_BuildingANotificationReceptor.html +36 -0
- data/aws_docs/ApiReference_NotificationAPI_ElementsOfANotification.html +40 -0
- data/aws_docs/ApiReference_NotificationDataStructureArticle.html +73 -0
- data/aws_docs/ApiReference_NotificationReceptorAPIArticle.html +9 -0
- data/aws_docs/ApiReference_NotificationReceptorAPI_RESTTransportArticle.html +39 -0
- data/aws_docs/ApiReference_NotificationReceptorAPI_SOAPTransportArticle.html +45 -0
- data/aws_docs/ApiReference_NotifyWorkersOperation.html +82 -0
- data/aws_docs/ApiReference_OperationsArticle.html +8 -0
- data/aws_docs/ApiReference_PriceDataStructureArticle.html +65 -0
- data/aws_docs/ApiReference_QualificationDataStructureArticle.html +89 -0
- data/aws_docs/ApiReference_QualificationRequestDataStructureArticle.html +102 -0
- data/aws_docs/ApiReference_QualificationRequirementDataStructureArticle.html +176 -0
- data/aws_docs/ApiReference_QualificationTypeDataStructureArticle.html +198 -0
- data/aws_docs/ApiReference_QuestionAnswerDataArticle.html +8 -0
- data/aws_docs/ApiReference_QuestionFormAnswersDataStructureArticle.html +54 -0
- data/aws_docs/ApiReference_QuestionFormDataStructureArticle.html +796 -0
- data/aws_docs/ApiReference_RegisterHITTypeOperation.html +149 -0
- data/aws_docs/ApiReference_RejectAssignmentOperation.html +66 -0
- data/aws_docs/ApiReference_RejectQualificationRequestOperation.html +61 -0
- data/aws_docs/ApiReference_RevokeQualificationOperation.html +78 -0
- data/aws_docs/ApiReference_SearchHITsOperation.html +164 -0
- data/aws_docs/ApiReference_SearchQualificationTypesOperation.html +211 -0
- data/aws_docs/ApiReference_SendTestEventNotificationOperation.html +78 -0
- data/aws_docs/ApiReference_SetHITAsReviewingOperation.html +73 -0
- data/aws_docs/ApiReference_SetHITTypeNotificationOperation.html +99 -0
- data/aws_docs/ApiReference_UnblockWorkerOperation.html +67 -0
- data/aws_docs/ApiReference_UpdateQualificationScoreOperation.html +77 -0
- data/aws_docs/ApiReference_UpdateQualificationTypeOperation.html +180 -0
- data/aws_docs/ApiReference_WsdlLocationArticle.html +95 -0
- data/aws_docs/ApiReference_XMLParameterValuesArticle.html +37 -0
- data/aws_docs/Welcome.html +125 -0
- data/aws_docs/WhatsNew.html +16 -0
- data/aws_docs/_title.html +28 -0
- data/aws_docs/_toc.html +749 -0
- data/aws_docs/aws-docs-IE.css +419 -0
- data/aws_docs/aws-docs.css +455 -0
- data/aws_docs/copyrightinfo.html +14 -0
- data/aws_docs/frameset.js +12 -0
- data/aws_docs/images/Feedback_link.gif +0 -0
- data/aws_docs/images/caution.png +0 -0
- data/aws_docs/images/home.gif +0 -0
- data/aws_docs/images/important.png +0 -0
- data/aws_docs/images/next.gif +0 -0
- data/aws_docs/images/note.png +0 -0
- data/aws_docs/images/prev.gif +0 -0
- data/aws_docs/images/tip.png +0 -0
- data/aws_docs/images/title-swoosh-logo.gif +0 -0
- data/aws_docs/images/toc_bullet.gif +0 -0
- data/aws_docs/images/toc_plus.gif +0 -0
- data/aws_docs/index.html +18 -0
- data/aws_docs/toc.js +84 -0
- data/lib/rturk.rb +2 -2
- data/lib/rturk/adapter.rb +11 -0
- data/lib/rturk/adapters/assignment.rb +13 -50
- data/lib/rturk/adapters/hit.rb +21 -9
- data/lib/rturk/adapters/worker.rb +23 -0
- data/lib/rturk/operation.rb +1 -1
- data/lib/rturk/operations/create_hit.rb +10 -54
- data/lib/rturk/operations/register_hit_type.rb +68 -0
- data/lib/rturk/operations/search_hits.rb +44 -0
- data/lib/rturk/parser.rb +8 -0
- data/lib/rturk/parsers/answer_parser.rb +29 -0
- data/lib/rturk/parsers/assignment_parser.rb +49 -0
- data/lib/rturk/parsers/hit_parser.rb +50 -0
- data/lib/rturk/{response.rb → parsers/response.rb} +7 -2
- data/lib/rturk/{responses → parsers/responses}/create_hit_response.rb +2 -2
- data/lib/rturk/{responses → parsers/responses}/get_account_balance_response.rb +0 -0
- data/lib/rturk/{responses → parsers/responses}/get_assignments_for_hit_response.rb +3 -3
- data/lib/rturk/{responses → parsers/responses}/get_hit_response.rb +9 -16
- data/lib/rturk/{responses → parsers/responses}/get_reviewable_hits_response.rb +3 -5
- data/lib/rturk/parsers/responses/register_hit_type_response.rb +17 -0
- data/lib/rturk/parsers/responses/search_hits_response.rb +65 -0
- data/lib/rturk/xml_utilities.rb +14 -3
- data/rturk.gemspec +112 -12
- data/spec/adapters/hit_spec.rb +10 -0
- data/spec/fake_responses/register_hit_type.xml +6 -0
- data/spec/fake_responses/search_hits.xml +50 -0
- data/spec/operations/create_hit_spec.rb +2 -2
- data/spec/operations/get_hit_spec.rb +1 -1
- data/spec/operations/register_hit_type_spec.rb +24 -0
- data/spec/{adapters/answers_spec.rb → parsers/answer_parser_spec.rb} +2 -2
- data/spec/parsers/hit_parser_spec.rb +41 -0
- data/spec/xml_parse_spec.rb +2 -2
- metadata +111 -11
- data/lib/rturk/adapters/answers.rb +0 -38
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'cgi'
|
2
|
-
|
3
|
-
module RTurk
|
4
|
-
class Answers
|
5
|
-
|
6
|
-
attr_accessor :answer_hash
|
7
|
-
|
8
|
-
def initialize(xml)
|
9
|
-
answer_xml = Nokogiri::XML(CGI.unescapeHTML(xml))
|
10
|
-
@answer_hash = {}
|
11
|
-
answers = answer_xml.xpath('//xmlns:Answer')
|
12
|
-
answers.each do |answer|
|
13
|
-
key, value = nil, nil
|
14
|
-
answer.children.each do |child|
|
15
|
-
next if child.blank?
|
16
|
-
if child.name == 'QuestionIdentifier'
|
17
|
-
key = child.inner_text
|
18
|
-
else
|
19
|
-
value = child.inner_text
|
20
|
-
end
|
21
|
-
end
|
22
|
-
@answer_hash[key] = value
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
|
27
|
-
# @param [<String, Symbol>] The string or symbol of the question name
|
28
|
-
# @return [String] The value of the question name
|
29
|
-
def [](key)
|
30
|
-
@answer_hash[key]
|
31
|
-
end
|
32
|
-
|
33
|
-
def to_hash
|
34
|
-
@answer_hash
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|