source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
ryantate/rturk
https://github.com/ryantate/rturk
spec/operations/update_qualification_score_spec.rb
Ruby
mit
208
master
1,287
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) describe RTurk::UpdateQualificationScore do before(:all) do aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml'))) RTurk.setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true) faker('update_qualification_...
github
ryantate/rturk
https://github.com/ryantate/rturk
spec/operations/search_qualification_types_spec.rb
Ruby
mit
208
master
1,328
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) describe RTurk::SearchQualificationTypes do before(:all) do aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml'))) RTurk.setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true) faker('search_qualification_...
github
ryantate/rturk
https://github.com/ryantate/rturk
spec/operations/unblock_worker_spec.rb
Ruby
mit
208
master
952
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) describe RTurk::UnblockWorker do before(:all) do aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml'))) RTurk.setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true) faker('unblock_worker', :operation => ...
github
ryantate/rturk
https://github.com/ryantate/rturk
spec/operations/get_account_balance_spec.rb
Ruby
mit
208
master
326
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) describe RTurk::GetAccountBalance do before(:all) do faker('get_account_balance', :operation => 'GetAccountBalance') end it "should give me my account balance" do RTurk.GetAccountBalance.amount.should eql(15555.55) end ...
github
ryantate/rturk
https://github.com/ryantate/rturk
spec/operations/disable_hit_spec.rb
Ruby
mit
208
master
848
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) describe RTurk::DisableHIT do before(:all) do aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml'))) RTurk.setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true) faker('disable_hit', :operation => 'Disab...
github
ryantate/rturk
https://github.com/ryantate/rturk
spec/operations/get_qualification_score_spec.rb
Ruby
mit
208
master
1,731
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) describe RTurk::GetQualificationScore do before(:all) do aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml'))) RTurk.setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true) faker('get_qualification_score'...
github
ryantate/rturk
https://github.com/ryantate/rturk
spec/parsers/qualification_type_parser_spec.rb
Ruby
mit
208
master
2,543
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) describe RTurk::QualificationTypeParser do before(:all) do @qualification_type_xml = <<-XML <QualificationType> <QualificationTypeId>WKAZMYZDCYCZP412TZEZ</QualificationTypeId> <CreationTime>2009-05-17T10:05:15Z</Creation...
github
ryantate/rturk
https://github.com/ryantate/rturk
spec/parsers/qualification_parser.rb
Ruby
mit
208
master
729
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) describe RTurk::QualificationParser do before(:all) do @qualification_xml = <<-XML <Qualification> <QualificationTypeId>789RVWYBAZW00EXAMPLE</QualificationTypeId> <SubjectId>AZ3456EXAMPLE</SubjectId> <GrantTime>2005-01-31T...
github
ryantate/rturk
https://github.com/ryantate/rturk
spec/parsers/answer_parser_spec.rb
Ruby
mit
208
master
1,264
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) describe RTurk::AnswerParser do before(:all) do @answer = <<-XML &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;QuestionFormAnswers xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionFo...
github
ryantate/rturk
https://github.com/ryantate/rturk
spec/parsers/hit_parser_spec.rb
Ruby
mit
208
master
1,301
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) describe RTurk::HITParser do before(:all) do @hit_xml = <<-XML <HIT> <HITId>ZZRZPTY4ERDZWJ868JCZ</HITId> <HITTypeId>NYVZTQ1QVKJZXCYZCZVZ</HITTypeId> <CreationTime>2009-07-07T00:56:40Z</CreationTime> <Title>Location</Titl...
github
ryantate/rturk
https://github.com/ryantate/rturk
examples/review_answer.rb
Ruby
mit
208
master
587
require File.expand_path('../example_helper', __FILE__) aws = YAML.load(File.open(File.join(File.dirname(__FILE__), 'mturk.yml'))) RTurk::setup(aws['AWSAccessKeyId'], aws['AWSAccessKey']) file = File.open(File.join(File.dirname(__FILE__), 'answers.yml'), 'w') hits = RTurk::Hit.all_reviewable puts "#{hits.size} revie...
github
ryantate/rturk
https://github.com/ryantate/rturk
examples/create_hit.rb
Ruby
mit
208
master
492
require File.expand_path('../example_helper', __FILE__) aws = YAML.load(File.open(File.join(File.dirname(__FILE__), 'mturk.yml'))) RTurk::setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true) hit = RTurk::Hit.create(:title => 'Write a tweet for me') do |hit| hit.description = 'Simply write a witty twi...
github
ryantate/rturk
https://github.com/ryantate/rturk
examples/blank_slate.rb
Ruby
mit
208
master
586
require File.expand_path('../example_helper', __FILE__) aws = YAML.load(File.open(File.join(File.dirname(__FILE__), 'mturk.yml'))) RTurk::setup(aws['AWSAccessKeyId'], aws['AWSAccessKey']) hits = RTurk::Hit.all_reviewable puts "#{hits.size} reviewable hits. \n" unless hits.empty? puts "Approving all assignments an...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk.rb
Ruby
mit
208
master
1,221
module RTurk require 'rturk/logger' SANDBOX = 'https://mechanicalturk.sandbox.amazonaws.com/' PRODUCTION = 'https://mechanicalturk.amazonaws.com/' API_VERSION = '2012-03-25' # '2008-08-02' OLD_API_VERSION = '2006-05-05' class << self attr_reader :access_key, :secret_key, :host def setup(access_ke...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/utilities.rb
Ruby
mit
208
master
1,281
module RTurk::Utilities def camelize(phrase) phrase.gsub!(/^[a-z]|\_+[a-z]/) { |a| a.upcase } phrase.gsub!(/\_/, '') return phrase end def stringify_keys(ahash) ahash = ahash.inject({}) do |options, (key, value)| options[(key.to_s rescue key) || key] = value options end ahash...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/macros.rb
Ruby
mit
208
master
962
module RTurk::Macros # Attempt to expire hit, then approve assignments, and finally dispose of def kill_hit(hit_id) forceExpireHIT(:HITId => hit_id) get_assignments_for_hit(hit_id).each do |assignment| approveAssignment(:AssignmentId => assignment[:AssignmentId]) end disposeHIT(:HITId => hit_...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/requester.rb
Ruby
mit
208
master
2,917
require 'cgi' require 'digest/sha1' require 'base64' require 'time' require 'base64' require 'digest/sha1' require 'restclient' module RTurk class Requester class << self include RTurk::Utilities # @param [Hash] params # @option [String] 'Operation' The operation - Required # @option [St...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/xml_utilities.rb
Ruby
mit
208
master
1,164
module RTurk::XMLUtilities def xml_to_hash(noko_xml) hash = {} noko_xml.children.each do |child| next if child.blank? if child.text? return child.text else hash[child.name] = xml_to_hash(child) end end hash end def map_content(xml_obj, hash) hash.each_...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/logger.rb
Ruby
mit
208
master
381
require 'logger' module RTurk class Logger class << self def logger=(logger_obj) @logger = logger_obj end def logger unless @logger @logger = ::Logger.new(STDOUT) @logger.level = ::Logger::INFO end @logger end end end def sel...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operation.rb
Ruby
mit
208
master
2,331
module RTurk class Operation class << self def default_params @default_params ||= {} end def required_params @required_params || [] end def require_params(*args) @required_params ||= [] @required_params.push(*args) end def set_operatio...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/qualification_type_parser.rb
Ruby
mit
208
master
1,177
# Parses a QualificationType object module RTurk class QualificationTypeParser < RTurk::Parser attr_reader :qualification_type_id, :creation_time, :name, :description, :keywords, :status, :retry_delay_in_seconds, :is_requestable, :test, :test_duration_in_seconds, :answer_key, :aut...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/bonus_payment_parser.rb
Ruby
mit
208
master
522
module RTurk class BonusPaymentParser < RTurk::Parser attr_reader :assignment_id, :bonus_amount, :currency_code, :reason, :grant_time def initialize(payment_xml) @xml_obj = payment_xml map_content(@xml_obj, :assignment_id => 'AssignmentId', :bon...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/qualification_parser.rb
Ruby
mit
208
master
633
# Parses a Qualification object module RTurk class QualificationParser < RTurk::Parser attr_reader :qualification_type_id, :subject_id, :grant_time, :integer_value, :locale_value, :status def initialize(qualifications_xml) @xml_obj = qualifications_xml map_content(@xml_obj, ...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/hit_parser.rb
Ruby
mit
208
master
2,040
# <HIT> # <HITId>ZZRZPTY4ERDZWJ868JCZ</HITId> # <HITTypeId>NYVZTQ1QVKJZXCYZCZVZ</HITTypeId> # <CreationTime>2009-07-07T00:56:40Z</CreationTime> # <Title>Location</Title> # <Description>Select the image that best represents</Description> # <HITStatus>Assignable</HITStatus> # <MaxAssignments...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/answer_parser.rb
Ruby
mit
208
master
588
module RTurk class AnswerParser require 'cgi' def self.parse(xml) answer_xml = Nokogiri::XML(CGI.unescapeHTML(xml.to_s)) answer_hash = {} answers = answer_xml.xpath('//xmlns:Answer') answers.each do |answer| key, value = nil, nil answer.children.each do |child| ...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/response.rb
Ruby
mit
208
master
1,366
require 'nokogiri' module RTurk class Response < RTurk::Parser # # In some cases we want more than just a hash parsed from the returned # XML. This class is our response object, and it can be extended for more # functionality. # attr_reader :xml, :raw_xml def initialize(res...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/assignment_parser.rb
Ruby
mit
208
master
1,912
# Parses: # <Assignment> # <AssignmentId>GYFTRHZ5J3DZREY48WNZE38ZR9RR1ZPMXGWE7WE0</AssignmentId> # <WorkerId>AD20WXZZP9XXK</WorkerId> # <HITId>GYFTRHZ5J3DZREY48WNZ</HITId> # <AssignmentStatus>Approved</AssignmentStatus> # <AutoApprovalTime>2009-08-12T19:21:54Z</AutoApprovalTime> # <AcceptTime>2009-07-13T19:...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/qualification_request_parser.rb
Ruby
mit
208
master
673
# Parses a QualificationRequest object module RTurk class QualificationRequestParser < RTurk::Parser attr_reader :qualification_request_id, :qualification_type_id, :subject_id, :submit_time, :test, :answer def initialize(qualification_request_xml) @xml_obj = qualification_request_xml ...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/responses/search_hits_response.rb
Ruby
mit
208
master
2,707
module RTurk # <SearchHITsResult> # <Request> # <IsValid>True</IsValid> # </Request> # <NumResults>2</NumResults> # <TotalNumResults>2</TotalNumResults> # <PageNumber>1</PageNumber> # # <HIT> # <HITId>GBHZVQX3EHXZ2AYDY2T0</HITId> # <HITTypeId>NYVZTQ1QVKJZXCYZCZVZ</HITTypeId...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/responses/search_qualification_types_response.rb
Ruby
mit
208
master
3,115
module RTurk # <SearchQualificationTypesResult> # <Request> # <IsValid>True</IsValid> # </Request> # <NumResults>10</NumResults> # <TotalNumResults>5813</TotalNumResults> # <QualificationType> # <QualificationTypeId>WKAZMYZDCYCZP412TZEZ</QualificationTypeId> # <CreationTime>2009-...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/responses/get_qualifications_for_qualification_type_response.rb
Ruby
mit
208
master
756
# Parses the GetQualificationType Response module RTurk class GetQualificationsForQualificationTypeResponse < Response attr_reader :num_results, :total_num_results, :page_number def initialize(response) @raw_xml = response.body @xml = Nokogiri::XML(@raw_xml) raise_errors map_content(...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/responses/register_hit_type_response.rb
Ruby
mit
208
master
357
# Parses out the RegisterHITType response # # Example response: # <RegisterHITTypeResult> # <Request> # <IsValid>True</IsValid> # </Request> # <HITTypeId>KZ3GKTRXBWGYX8WXBW60</HITTypeId> # </RegisterHITTypeResult> module RTurk class RegisterHITTypeResponse < Response def type_id @xml.xpath('//HIT...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/responses/get_assignments_for_hit_response.rb
Ruby
mit
208
master
1,665
# <GetAssignmentsForHITResult> # <Request> # <IsValid>True</IsValid> # </Request> # <NumResults>1</NumResults> # <TotalNumResults>1</TotalNumResults> # <PageNumber>1</PageNumber> # <Assignment> # <AssignmentId>GYFTRHZ5J3DZREY48WNZE38ZR9RR1ZPMXGWE7WE0</AssignmentId> # <WorkerId>AD20WXZZP9XXK</Wor...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/responses/get_qualification_score_response.rb
Ruby
mit
208
master
848
# Parses the GetQualificationType Response # # <GetQualificationScoreResult> # <Qualification> # <QualificationTypeId>789RVWYBAZW00EXAMPLE</QualificationTypeId> # <SubjectId>AZ3456EXAMPLE</SubjectId> # <GrantTime>2005-01-31T23:59:59Z</GrantTime> # <IntegerValue>95</IntegerValue> # </Qualifica...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/responses/get_qualification_requests_response.rb
Ruby
mit
208
master
797
# Parses the GetQualificationRequests Response module RTurk class GetQualificationRequestsResponse < Response attr_reader :num_results, :total_num_results, :page_number def initialize(response) @raw_xml = response.body @xml = Nokogiri::XML(@raw_xml) raise_errors map_content(@xml.xpat...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/responses/get_hit_response.rb
Ruby
mit
208
master
3,812
# Parses the GetHIT Response # # <?xml version="1.0"?> # <GetHITResponse> # <OperationRequest> # <RequestId>49341251-fcbd-45c3-ab98-8fbe2e4d8060</RequestId> # </OperationRequest> # <HIT> # <Request> # <IsValid>True</IsValid> # </Request> # <HITId>GR4R3HY3YGBZXDCAPJWZ</HITId> # <HITTypeId...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/responses/get_bonus_payments_response.rb
Ruby
mit
208
master
216
module RTurk class GetBonusPaymentsResponse < Response def payments @payments ||= @xml.xpath('//BonusPayment').map do |payment_xml| BonusPaymentParser.new(payment_xml) end end end end
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/responses/get_reviewable_hits_response.rb
Ruby
mit
208
master
911
# <GetReviewableHITsResult> # <Request> # <IsValid>True</IsValid> # </Request> # <NumResults>3</NumResults> # <TotalNumResults>3</TotalNumResults> # <PageNumber>1</PageNumber> # <HIT> # <HITId>GBHZVQX3EHXZ2AYDY2T0</HITId> # </HIT> # <HIT> # <HITId>GBHZVQX3EHXZ2AYDY2T1</HITId> # </HIT> # ...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/responses/update_qualification_score_response.rb
Ruby
mit
208
master
348
# Parses the GetQualificationType Response module RTurk class UpdateQualificationScoreResponse < Response attr_reader :is_valid def initialize(response) @raw_xml = response.body @xml = Nokogiri::XML(@raw_xml) raise_errors map_content(@xml.xpath('//QualificationScore'), :is_valid => '...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/responses/get_qualification_type_response.rb
Ruby
mit
208
master
1,181
# Parses the GetQualificationType Response module RTurk class GetQualificationTypeResponse < Response attr_reader :qualification_type_id, :creation_time, :name, :description, :keywords, :status, :retry_delay_in_seconds, :is_requestable, :test, :test_duration_in_seconds, :answer_ke...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/responses/create_hit_response.rb
Ruby
mit
208
master
665
# Parses out the CreateHIT response # # Example response: # <CreateHITResponse> # <OperationRequest> # <RequestId>ece2785b-6292-4b12-a60e-4c34847a7916</RequestId> # </OperationRequest> # <HIT> # <Request> # <IsValid>True</IsValid> # </Request> # <HITId>GBHZVQX3EHXZ2AYDY2T0</HITId> # <HIT...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/parsers/responses/get_assignment_response.rb
Ruby
mit
208
master
246
module RTurk class GetAssignmentResponse < Response def assignment @assignment ||= AssignmentParser.new(@xml.xpath('//Assignment').first) end def hit @hit ||= HITParser.new(@xml.xpath('//HIT').first) end end end
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/get_hit.rb
Ruby
mit
208
master
610
module RTurk class GetHIT < Operation require_params :hit_id attr_accessor :hit_id, :include_assignment_summary def parse(xml) RTurk::GetHITResponse.new(xml) end def to_params params = {"HITId" => self.hit_id} if @include_assignment_summary params["ResponseGroup"] = {...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/send_test_event_notification.rb
Ruby
mit
208
master
396
module RTurk class SendTestEventNotification < Operation PARAMZ = [:notification, :test_event_type] attr_accessor *PARAMZ require_params *PARAMZ def to_params { :TestEventType => self.test_event_type }. merge(self.notification.to_param_hash) end end def self.SendTestEventNotif...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/get_qualification_score.rb
Ruby
mit
208
master
508
# Operation to get info about qualification score module RTurk class GetQualificationScore < Operation attr_accessor :qualification_type_id, :subject_id require_params :qualification_type_id, :subject_id def parse(xml) RTurk::GetQualificationScoreResponse.new(xml) end def to_params ...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/approve_assignment.rb
Ruby
mit
208
master
708
# Operation to approve an assignment # # http://mechanicalturk.amazonaws.com/?Service=AWSMechanicalTurkRequester # &AWSAccessKeyId=[the Requester's Access Key ID] # &Version=2008-08-02 # &Operation=ApproveAssignment # &Signature=[signature for this request] # &Timestamp=[your system's local time] # &AssignmentId=123RVW...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/disable_hit.rb
Ruby
mit
208
master
364
# http://docs.amazonwebservices.com/AWSMturkAPI/2008-08-02/ApiReference_DisposeHITOperation.html module RTurk class DisableHIT < Operation require_params :hit_id attr_accessor :hit_id def to_params {'HITId' => self.hit_id} end end def self.DisableHIT(*args, &blk) RTurk:...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/get_qualification_type.rb
Ruby
mit
208
master
449
# Operation to get info about qualification type module RTurk class GetQualificationType < Operation attr_accessor :qualification_type_id require_params :qualification_type_id def parse(xml) RTurk::GetQualificationTypeResponse.new(xml) end def to_params {'QualificationTypeId' => qua...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/search_hits.rb
Ruby
mit
208
master
1,236
module RTurk class SearchHITs < Operation # You can call this operation without any parameters and get an unsorted # list or you can pass in a :sort_by => {:title => :ascending} # # You can sort by # :title # :reward # :expiration # :created_at # :enumeration att...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/unblock_worker.rb
Ruby
mit
208
master
420
# Operation to block a worker # # The worker does not see the reason you gave. It's for your records # only. module RTurk class UnblockWorker < Operation attr_accessor :worker_id, :reason require_params :worker_id def to_params {'WorkerId' => self.worker_id, 'Reason' => self.reason} ...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/register_hit_type.rb
Ruby
mit
208
master
1,967
module RTurk class RegisterHITType < Operation attr_accessor :title, :description, :reward, :currency, :duration, :keywords, :auto_approval_delay alias_attr :auto_approval, :auto_approval_delay # @param [Symbol, Hash] qualification_key opts The unique qualification key # @option opts [Hash] :compar...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/search_qualification_types.rb
Ruby
mit
208
master
1,480
module RTurk class SearchQualificationTypes < Operation # You can call this operation without only required parameters and get an unsorted # list or you can pass in a :sort_by => {:name => :ascending} # # You can sort by # :name attr_accessor :query, :sort_property, :sort_order, :page_s...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/get_bonus_payments.rb
Ruby
mit
208
master
575
module RTurk class GetBonusPayments < Operation attr_accessor :hit_id, :assignment_id, :page_size, :page_number def parse(xml) GetBonusPaymentsResponse.new(xml) end def to_params params = { 'PageSize' => (page_size || 100), 'PageNumber' => (page_number |...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/grant_qualification.rb
Ruby
mit
208
master
461
# Operation grants a Worker's request for a Qualification. module RTurk class GrantQualification < Operation attr_accessor :qualification_request_id, :integer_value require_params :qualification_request_id def to_params {'QualificationRequestId' => self.qualification_request_id, 'Inte...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/extend_hit.rb
Ruby
mit
208
master
557
module RTurk class RTurk::ExtendHIT < RTurk::Operation attr_accessor :hit_id, :assignments, :seconds require_params :hit_id def to_params if assignments.nil? && seconds.nil? raise MissingParameters, 'Must add to either the HIT assignment count or expiration time.' end ...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/set_hit_type_notification.rb
Ruby
mit
208
master
416
module RTurk class SetHITTypeNotification < Operation PARAMZ = [:hit_type_id, :notification, :active] attr_accessor *PARAMZ require_params *PARAMZ def to_params { :HITTypeId => self.hit_type_id, :Active => self.active }. merge(self.notification.to_param_hash) end end d...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/reject_assignment.rb
Ruby
mit
208
master
461
module RTurk # == Reject Assignment # # Operation to reject a workers assignment, requires a reason class RejectAssignment < Operation attr_accessor :assignment_id, :feedback require_params :assignment_id, :feedback def to_params {'AssignmentId' => self.assignment_id, 'Req...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/approve_rejected_assignment.rb
Ruby
mit
208
master
368
module RTurk class ApproveRejectedAssignment < Operation attr_accessor :assignment_id, :feedback require_params :assignment_id def to_params {'AssignmentId' => self.assignment_id, 'RequesterFeedback' => self.feedback} end end def self.ApproveRejectedAssignment(*args) RTurk::Ap...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/reject_qualification_request.rb
Ruby
mit
208
master
463
# Operation rejects a user's request for a Qualification module RTurk class RejectQualificationRequest < Operation attr_accessor :qualification_request_id, :reason require_params :qualification_request_id def to_params {'QualificationRequestId' => self.qualification_request_id, 'Reaso...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/revoke_qualification.rb
Ruby
mit
208
master
529
# Operation to revoke a qualification from a worker module RTurk class RevokeQualification < Operation attr_accessor :qualification_type_id, :subject_id, :reason require_params :qualification_type_id, :subject_id def to_params params = { 'QualificationTypeId' => qualification_type_id, ...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/notify_workers.rb
Ruby
mit
208
master
1,486
######################################################################### # Operation to send email to a group of workers. # # # # Caveats: # # - A message can only...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/update_qualification_score.rb
Ruby
mit
208
master
756
# Operation to update a qualification score # http://docs.aws.amazon.com/AWSMechTurk/latest/AWSMturkAPI/ApiReference_UpdateQualificationScoreOperation.html module RTurk class UpdateQualificationScore < Operation attr_accessor :qualification_type_id, :qualification_type_score, :subject_id, :integer_value requ...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/get_qualifications_for_qualification_type.rb
Ruby
mit
208
master
775
# Operation to get qualifications for a qualification type module RTurk class GetQualificationsForQualificationType < Operation attr_accessor :qualification_type_id, :status, :page_size, :page_number require_params :qualification_type_id def parse(xml) RTurk::GetQualificationsForQualificationTypeR...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/create_hit.rb
Ruby
mit
208
master
1,717
require File.join(File.dirname(__FILE__), 'register_hit_type') module RTurk class CreateHIT < RegisterHITType attr_accessor :hit_type_id, :max_assignments, :lifetime, :annotation alias_attr :note, :annotation alias_attr :assignments, :max_assignments def parse(response) RTurk::CreateHITRespons...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/get_account_balance.rb
Ruby
mit
208
master
214
module RTurk class GetAccountBalance < Operation def parse(xml) RTurk::GetAccountBalanceResponse.new(xml) end end def self.GetAccountBalance RTurk::GetAccountBalance.create end end
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/get_assignment.rb
Ruby
mit
208
master
347
module RTurk class GetAssignment < Operation require_params :assignment_id attr_accessor :assignment_id def parse(xml) GetAssignmentResponse.new(xml) end def to_params {'AssignmentId' => assignment_id} end end def self.GetAssignment(*args, &blk) RTurk::GetAssignment.cre...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/update_qualification_type.rb
Ruby
mit
208
master
1,387
# Operation to update a qualification type module RTurk class UpdateQualificationType < Operation attr_accessor :qualification_type_id, :name, :description, :keywords, :status, :auto_granted, :retry_delay_in_seconds, :test, :answer_key, :test_duration_in_seconds, ...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/dispose_hit.rb
Ruby
mit
208
master
364
# http://docs.amazonwebservices.com/AWSMturkAPI/2008-08-02/ApiReference_DisposeHITOperation.html module RTurk class DisposeHIT < Operation require_params :hit_id attr_accessor :hit_id def to_params {'HITId' => self.hit_id} end end def self.DisposeHIT(*args, &blk) RTurk:...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/create_qualification_type.rb
Ruby
mit
208
master
1,238
# Operation to create a qualification type module RTurk class CreateQualificationType < Operation attr_accessor :name, :description, :keywords, :status, :auto_granted, :retry_delay_in_seconds, :test, :answer_key, :test_duration_in_seconds, :auto_granted_value require_param...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/dispose_qualification_type.rb
Ruby
mit
208
master
377
# Operation to despose a qualification type module RTurk class DisposeQualificationType < Operation attr_accessor :qualification_type_id require_params :qualification_type_id def to_params {'QualificationTypeId' => qualification_type_id} end end def self.DisposeQualificationType(*args) ...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/get_qualification_requests.rb
Ruby
mit
208
master
749
# operation retrieves requests for Qualifications of a particular Qualification type module RTurk class GetQualificationRequests < Operation attr_accessor :qualification_type_id, :status, :page_size, :page_number require_params :qualification_type_id def parse(xml) RTurk::GetQualificationRequestsR...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/force_expire_hit.rb
Ruby
mit
208
master
275
module RTurk class ForceExpireHIT < Operation require_params :hit_id attr_accessor :hit_id def to_params {'HITId' => self.hit_id} end end def self.ForceExpireHIT(*args, &blk) RTurk::ForceExpireHIT.create(*args, &blk) end end
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/get_reviewable_hits.rb
Ruby
mit
208
master
759
module RTurk class GetReviewableHITs < Operation attr_accessor :page_size, :page_number, :hit_type_id, :status, :sort_property, :sort_direction def parse(xml) RTurk::GetReviewableHITsResponse.new(xml) end def to_params params = { 'PageSize' => (page_size || 100),...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/set_hit_as_reviewing.rb
Ruby
mit
208
master
439
# http://docs.amazonwebservices.com/AWSMechTurk/2008-08-02/AWSMturkAPI/ApiReference_SetHITAsReviewingOperation.html module RTurk class SetHITAsReviewing < Operation require_params :hit_id attr_accessor :hit_id, :revert def to_params {'HITId' => self.hit_id, 'Revert' => self.revert} end...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/assign_qualification.rb
Ruby
mit
208
master
557
# Operation to assign a qualification to a worker module RTurk class AssignQualification < Operation attr_accessor :qualification_type_id, :worker_id, :send_notification, :integer_value require_params :qualification_type_id, :worker_id def to_params {'QualificationTypeId' => qualification_type_id,...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/block_worker.rb
Ruby
mit
208
master
423
# Operation to block a worker # # The worker does not see the reason you gave. It's for your records # only. module RTurk class BlockWorker < Operation attr_accessor :worker_id, :reason require_params :worker_id, :reason def to_params {'WorkerId' => self.worker_id, 'Reason' => self.r...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/get_assignments_for_hit.rb
Ruby
mit
208
master
510
module RTurk class GetAssignmentsForHIT < Operation require_params :hit_id attr_accessor :hit_id, :page_size, :page_number, :status def parse(xml) GetAssignmentsForHITResponse.new(xml) end def to_params {'HITId' => hit_id, 'PageSize' => (page_size || 100), ...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/operations/grant_bonus.rb
Ruby
mit
208
master
598
module RTurk # == Grant Bonus operation # # Grants a worker a bonus # class GrantBonus < Operation attr_accessor :assignment_id, :feedback, :worker_id, :amount, :currency require_params :assignment_id, :worker_id, :amount, :feedback def to_params {'AssignmentId' => self.assignmen...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/builders/question_form_builder.rb
Ruby
mit
208
master
2,344
require 'cgi' require 'uri' require "erector/xml_widget" module RTurk # see http://docs.amazonwebservices.com/AWSMechTurk/2008-08-02/AWSMturkAPI/ApiReference_QuestionFormDataStructureArticle.html # @param options hash (optional) # ::xml:: raw xml (optional). If it starts with \&lt;QuestionForm then it's used as ...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/builders/qualification_builder.rb
Ruby
mit
208
master
3,290
module RTurk class Qualification # For more information about qualification requirements see: # http://docs.amazonwebservices.com/AWSMturkAPI/2008-08-02/index.html?ApiReference_QualificationRequirementDataStructureArticle.html # COMPARATORS = {:gt => 'GreaterThan', :lt => 'LessThan', :gte => 'Great...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/builders/external_question_builder.rb
Ruby
mit
208
master
1,398
require 'cgi' require 'uri' module RTurk class ExternalQuestion attr_accessor :url, :url_params, :frame_height def initialize(url, opts = {}) @url = url self.frame_height = opts.delete(:frame_height) || 400 self.url_params = opts end def querystring @url_params.collect { |k...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/builders/qualifications_builder.rb
Ruby
mit
208
master
1,120
module RTurk class Qualifications # For more information about qualification requirements see: # http://docs.amazonwebservices.com/AWSMturkAPI/2008-08-02/index.html?ApiReference_QualificationRequirementDataStructureArticle.html # def to_params params = {} qualifications.each_with_index ...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/builders/answer_key_builder.rb
Ruby
mit
208
master
1,427
require 'cgi' require 'uri' require "erector/xml_widget" module RTurk # see http://docs.amazonwebservices.com/AWSMechTurk/2008-08-02/AWSMturkAPI/index.html?ApiReference_CreateQualificationTypeOperation.html class AnswerKey < Erector::XMLWidget XMLNS = "http://mechanicalturk.amazonaws.com/AWSMechanicalTurkData...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/builders/notification_builder.rb
Ruby
mit
208
master
828
module RTurk Notification = Struct.new(:Destination, :Transport, :Version, :EventType) do # EventType can be a single string or an array of strings extend RTurk::Utilities members.each do |member| underscore = underscore(member) alias_method underscore, member alias_method "#{underscore...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/adapters/worker.rb
Ruby
mit
208
master
385
module RTurk class Worker def initialize(id) @id = id end # Blocks a worker, the reason is required and not shown to the worker # def block!(reason) RTurk::BlockWorker(:worker_id => @id, :reason => reason) end # Unblock the worker # def unblock! ...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/adapters/assignment.rb
Ruby
mit
208
master
1,184
require 'time' module RTurk class Assignment attr_reader :id, :source def initialize(id, source = nil) @id, @source = id, source end def bonus_payments RTurk::GetBonusPayments(:assignment_id => id).payments end def approve!(feedback = nil) RTurk::ApproveAssignment(:assign...
github
ryantate/rturk
https://github.com/ryantate/rturk
lib/rturk/adapters/hit.rb
Ruby
mit
208
master
3,299
module RTurk # =The RTurk Hit Adapter # # Lets us interact with Mechanical Turk without having to know all the operations. # # == Basic usage # @example # require 'rturk' # # RTurk.setup(YourAWSAccessKeyId, YourAWSAccessKey, :sandbox => true) # hit = RTurk::Hit.create(:title => "Add som...
github
cookpad/barbeque
https://github.com/cookpad/barbeque
barbeque.gemspec
Ruby
mit
208
master
1,334
$:.push File.expand_path("../lib", __FILE__) require "barbeque/version" Gem::Specification.new do |s| s.name = "barbeque" s.version = Barbeque::VERSION s.authors = ["Takashi Kokubun"] s.email = ["takashi-kokubun@cookpad.com"] s.homepage = "https://github.com/cookpad/barbeque" s.summ...
github
cookpad/barbeque
https://github.com/cookpad/barbeque
Rakefile
Ruby
mit
208
master
1,975
begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end require 'rdoc/task' RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' rdoc.title = 'Barbeque' rdoc.options << '--line-numbers' rdoc.rdoc_files.include('README.md') rdoc...
github
cookpad/barbeque
https://github.com/cookpad/barbeque
Gemfile
Ruby
mit
208
master
913
source 'https://rubygems.org' # Declare your gem's dependencies in barbeque.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec # Declare any dependencies that are still in development here instead of in ...
github
cookpad/barbeque
https://github.com/cookpad/barbeque
app/controllers/barbeque/job_definitions_controller.rb
Ruby
mit
208
master
3,141
class Barbeque::JobDefinitionsController < Barbeque::ApplicationController def index @job_definitions = Barbeque::JobDefinition.all end def show @job_definition = Barbeque::JobDefinition.find(params[:id]) @job_executions = @job_definition.job_executions.order(id: :desc).page(params[:page]) @retry...
github
cookpad/barbeque
https://github.com/cookpad/barbeque
app/controllers/barbeque/monitors_controller.rb
Ruby
mit
208
master
1,663
class Barbeque::MonitorsController < Barbeque::ApplicationController def index now = Time.zone.now from = 6.hours.ago(now.beginning_of_hour) rows = Barbeque::JobExecution.find_by_sql([<<SQL.strip_heredoc, from, now]).map(&:attributes) select t.date_hour , app.id as app_id , app.name ...
github
cookpad/barbeque
https://github.com/cookpad/barbeque
app/controllers/barbeque/job_retries_controller.rb
Ruby
mit
208
master
606
class Barbeque::JobRetriesController < Barbeque::ApplicationController def show @job_retry = Barbeque::JobRetry.find(params[:id]) @job_execution = @job_retry.job_execution # Return 404 when job_definition or app is deleted @job_definition = Barbeque::JobDefinition.find(@job_execution.job_definition_id...
github
cookpad/barbeque
https://github.com/cookpad/barbeque
app/controllers/barbeque/job_executions_controller.rb
Ruby
mit
208
master
1,123
class Barbeque::JobExecutionsController < Barbeque::ApplicationController ID_REGEXP = /\A[0-9]+\z/ def show if ID_REGEXP === params[:message_id] job_execution = Barbeque::JobExecution.find_by(id: params[:message_id]) if job_execution redirect_to(job_execution) return end e...
github
cookpad/barbeque
https://github.com/cookpad/barbeque
app/controllers/barbeque/sns_subscriptions_controller.rb
Ruby
mit
208
master
1,320
class Barbeque::SnsSubscriptionsController < Barbeque::ApplicationController def index @sns_subscriptions = Barbeque::SnsSubscription.all end def show @sns_subscription = Barbeque::SnsSubscription.find(params[:id]) end def new @sns_subscription = Barbeque::SnsSubscription.new end def edit ...
github
cookpad/barbeque
https://github.com/cookpad/barbeque
app/controllers/barbeque/apps_controller.rb
Ruby
mit
208
master
954
class Barbeque::AppsController < Barbeque::ApplicationController def index @apps = Barbeque::App.all end def show @app = Barbeque::App.find(params[:id]) end def new @app = Barbeque::App.new end def edit @app = Barbeque::App.find(params[:id]) end def create @app = Barbeque::App....
github
cookpad/barbeque
https://github.com/cookpad/barbeque
app/controllers/barbeque/job_queues_controller.rb
Ruby
mit
208
master
4,741
require 'aws-sdk-cloudwatch' require 'aws-sdk-sqs' require 'barbeque/config' class Barbeque::JobQueuesController < Barbeque::ApplicationController def index @job_queues = Barbeque::JobQueue.all end def show @job_queue = Barbeque::JobQueue.find(params[:id]) end def new @job_queue = Barbeque::Job...
github
cookpad/barbeque
https://github.com/cookpad/barbeque
app/controllers/barbeque/api/job_executions_controller.rb
Ruby
mit
208
master
2,085
require 'barbeque/maintenance' class Barbeque::Api::JobExecutionsController < Barbeque::Api::ApplicationController include Garage::RestfulActions validates :create do string :application, required: true, description: 'Application name of the job' string :job, required: true, description: 'Class of Job to ...
github
cookpad/barbeque
https://github.com/cookpad/barbeque
app/controllers/barbeque/api/application_controller.rb
Ruby
mit
208
master
906
require 'garage' class Barbeque::Api::ApplicationController < ActionController::API before_action :force_json_format include Garage::ControllerHelper rescue_from ActiveRecord::RecordNotFound do |exception| respond_with_error(404, 'record_not_found', exception.message) end rescue_from WeakParameters::V...
github
cookpad/barbeque
https://github.com/cookpad/barbeque
app/controllers/barbeque/api/revision_locks_controller.rb
Ruby
mit
208
master
920
class Barbeque::Api::RevisionLocksController < Barbeque::Api::ApplicationController include Garage::RestfulActions validates :create do string :revision, required: true, description: 'Docker image revision to lock' end private def require_resources protect_resource_as Barbeque::Api::RevisionLockRes...