lib/rturk/builders/notification_builder.rb in rturk-2.1.0 vs lib/rturk/builders/notification_builder.rb in rturk-2.1.1

- old
+ new

@@ -1,7 +1,8 @@ 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 @@ -13,10 +14,16 @@ hash = {} missing = [] each_pair do |k, v| raise MissingParameters, "Missing parameter for #{k}" if v.nil? - hash["Notification.1.#{k}"] = v + if (k == :EventType) && (v.is_a? Array) + v.each_index do |i| + hash["Notification.1.#{k}.#{i+1}"] = v[i] + end + else + hash["Notification.1.#{k}"] = v + end end hash end end end