class Kempelen::API::Responses::HitResponse

noinspection RubyTooManyInstanceVariablesInspection

Attributes

assignments_available[R]
assignments_completed[R]
assignments_pending[R]
auto_approval_delay[R]
creation_time[R]
description[R]
expiration[R]
hit_group_id[R]
hit_id[R]
hit_layout_id[R]
hit_status[R]
hit_type_id[R]
keywords[R]
lifetime[R]
max_assignments[R]
qualification_requirement[R]
question[R]
requester_annotation[R]
review_status[R]
reward[R]
similar_hits[R]
title[R]

Public Class Methods

new(response) click to toggle source
Calls superclass method Kempelen::API::Responses::Base::new
# File lib/kempelen/API/responses/hit_response.rb, line 29
def initialize(response)
  super()

  load_from_response(response)
end

Public Instance Methods

load_from_response(response) click to toggle source
# File lib/kempelen/API/responses/hit_response.rb, line 35
def load_from_response(response)
  super(response)

  hit_response = response["HIT"]
  unless hit_response.nil?
    @hit_id = hit_response["HITId"]
    @hit_type_id = hit_response["HITTypeId"]
    @hit_group_id = hit_response["HITGroupId"]
    @hit_layout_id = hit_response["HITLayoutId"]
    @creation_time = DateTime.parse(hit_response["CreationTime"]) rescue nil
    @expiration = DateTime.parse(hit_response["Expiration"]) rescue nil
    @hit_status = hit_response["HITStatus"]
    @max_assignments = hit_response["MaxAssignments"].to_i
    @assignments_pending = hit_response["NumberofAssignmentsPending"].to_i
    @assignments_available = hit_response["NumberofAssignmentsAvailable"].to_i
    @assignments_completed = hit_response["NumberofAssignmentsCompleted"].to_i
    @similar_hits = hit_response["NumberOfSimilarHITs"].to_i
    @auto_approval_delay = hit_response["AutoApprovalDelayInSeconds"].to_i
    @lifetime = hit_response["LifetimeInSeconds"].to_i
    @title = hit_response["Title"]
    @description = hit_response["Description"]
    @keywords = hit_response["Keywords"]
    @question = hit_response["Question"]
    @review_status = hit_response["HITReviewStatus"]
    @requester_annotation = hit_response["RequesterAnnotation"]
  end
end