Class: Typingpool::Amazon::HIT::Assignment
- Inherits:
-
Object
- Object
- Typingpool::Amazon::HIT::Assignment
- Defined in:
- lib/typingpool/amazon/hit/assignment.rb,
lib/typingpool/amazon/hit/assignment/empty.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Empty
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
See the RTurk documentation and Amazon Mechanical Turk API documentation for more on these fields.
-
#status ⇒ Object
readonly
See the RTurk documentation and Amazon Mechanical Turk API documentation for more on these fields.
-
#submitted_at ⇒ Object
readonly
See the RTurk documentation and Amazon Mechanical Turk API documentation for more on these fields.
-
#worker_id ⇒ Object
readonly
See the RTurk documentation and Amazon Mechanical Turk API documentation for more on these fields.
Instance Method Summary collapse
-
#answers ⇒ Object
Returns the answers associated with this assignment as a hash.
-
#at_amazon ⇒ Object
Returms an RTurk::Assignment object corresponding to this assignment.
-
#body ⇒ Object
Returns the transcription submitted by the user as raw text.
-
#initialize(rturk_hit) ⇒ Assignment
constructor
Constructor.
Constructor Details
#initialize(rturk_hit) ⇒ Assignment
Constructor. Takes an RTurk::Hit instance.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/typingpool/amazon/hit/assignment.rb', line 12 def initialize(rturk_hit) if assignment = rturk_hit.assignments[0] #expensive! @id = assignment.id @status = assignment.status @worker_id = assignment.worker_id @submitted_at = assignment.submitted_at if answers = assignment.answers @answers = answers.to_hash end end end |
Instance Attribute Details
#id ⇒ Object (readonly)
See the RTurk documentation and Amazon Mechanical Turk API documentation for more on these fields.
9 10 11 |
# File 'lib/typingpool/amazon/hit/assignment.rb', line 9 def id @id end |
#status ⇒ Object (readonly)
See the RTurk documentation and Amazon Mechanical Turk API documentation for more on these fields.
9 10 11 |
# File 'lib/typingpool/amazon/hit/assignment.rb', line 9 def status @status end |
#submitted_at ⇒ Object (readonly)
See the RTurk documentation and Amazon Mechanical Turk API documentation for more on these fields.
9 10 11 |
# File 'lib/typingpool/amazon/hit/assignment.rb', line 9 def submitted_at @submitted_at end |
#worker_id ⇒ Object (readonly)
See the RTurk documentation and Amazon Mechanical Turk API documentation for more on these fields.
9 10 11 |
# File 'lib/typingpool/amazon/hit/assignment.rb', line 9 def worker_id @worker_id end |
Instance Method Details
#answers ⇒ Object
Returns the answers associated with this assignment as a hash. If there are no answers, returns an empty hash.
26 27 28 |
# File 'lib/typingpool/amazon/hit/assignment.rb', line 26 def answers @answers ||= {} end |
#at_amazon ⇒ Object
Returms an RTurk::Assignment object corresponding to this assignment.
37 38 39 |
# File 'lib/typingpool/amazon/hit/assignment.rb', line 37 def at_amazon RTurk::Assignment.new(@id) end |
#body ⇒ Object
Returns the transcription submitted by the user as raw text.
31 32 33 |
# File 'lib/typingpool/amazon/hit/assignment.rb', line 31 def body (answers['transcription'] || answers['1']).to_s end |