lib/rturk/builders/qualification_builder.rb in rturk-2.8.0 vs lib/rturk/builders/qualification_builder.rb in rturk-2.9.0
- old
+ new
@@ -8,23 +8,23 @@
COMPARATORS = {:gt => 'GreaterThan', :lt => 'LessThan', :gte => 'GreaterThanOrEqualTo',
:lte => 'LessThanOrEqualTo', :eql => 'EqualTo', :not => 'NotEqualTo', :exists => 'Exists'}
TYPES = {:approval_rate => '000000000000000000L0', :submission_rate => '00000000000000000000',
- :abandoned_rate => '0000000000000000007', :return_rate => '000000000000000000E0',
+ :abandoned_rate => '00000000000000000070', :return_rate => '000000000000000000E0',
:rejection_rate => '000000000000000000S0', :hits_approved => '00000000000000000040',
:adult => '00000000000000000060', :country => '00000000000000000071'}
attr_accessor :qualifier
# Builds the basic requirements for a qualification
# needs at the minimum
# type_id, :comparator => :value
# or
- # type_id, true
+ # type_id, :exists => true
# or
- # type_id, :exists
+ # type_id, true
#
def initialize(type, opts)
# If the value is a string, we can assume it's the country since,
# Amazon states that there can be only integer values and countries
self.qualifier = {}
@@ -37,11 +37,11 @@
qualifier[:RequiredToPreview] = opts['RequiredToPreview'].to_s unless opts['RequiredToPreview'].nil?
qualifier.merge!(build_comparator(opts))
elsif opts == true || opts == false
qualifier[:IntegerValue] = opts == true ? 1 : 0
qualifier[:Comparator] = COMPARATORS[:eql]
- end
+ end
qualifier
end
def to_params
params = {}
@@ -66,10 +66,10 @@
if COMPARATORS.has_key?(k)
qualifier[:Comparator] = COMPARATORS[k]
if v.to_s.match(/[A-Z]./)
qualifier[:Country] = v
else
- qualifier[:IntegerValue] = v
+ qualifier[:IntegerValue] = v unless k == :exists
end
end
end
qualifier
end