lib/seatsio/domain.rb in seatsio-25.3.0 vs lib/seatsio/domain.rb in seatsio-26.0.0

- old
+ new

@@ -22,10 +22,11 @@ @archived = data['archived'] @validation = data['validation'] @social_distancing_rulesets = data['socialDistancingRulesets'].map { |key, r| [key, SocialDistancingRuleset.new(r['name'], r['numberOfDisabledSeatsToTheSides'], r['disableSeatsInFrontAndBehind'], r['numberOfDisabledAisleSeats'], r['maxGroupSize'], + r['maxOccupancyAbsolute'], r['maxOccupancyPercentage'], r['fixedGroupLayout'], r['disabledSeats'], r['enabledSeats'], r['index'])] }.to_h end end @@ -472,33 +473,52 @@ object_details end class SocialDistancingRuleset attr_reader :name, :number_of_disabled_seats_to_the_sides, :disable_seats_in_front_and_behind, - :number_of_disabled_aisle_seats, :max_group_size, :disabled_seats, :enabled_seats, :index + :number_of_disabled_aisle_seats, :max_group_size, :max_occupancy_absolute, + :max_occupancy_percentage, :fixed_group_layout, :disabled_seats, :enabled_seats, :index def initialize(name, number_of_disabled_seats_to_the_sides = 0, disable_seats_in_front_and_behind = false, number_of_disabled_aisle_seats = 0, - max_group_size = 0, disabled_seats = [], enabled_seats = [], index = 0) + max_group_size = 0, max_occupancy_absolute = 0, max_occupancy_percentage = 0, fixed_group_layout = false, + disabled_seats = [], enabled_seats = [], index = 0) @name = name @number_of_disabled_seats_to_the_sides = number_of_disabled_seats_to_the_sides @disable_seats_in_front_and_behind = disable_seats_in_front_and_behind @number_of_disabled_aisle_seats = number_of_disabled_aisle_seats @max_group_size = max_group_size + @max_occupancy_absolute = max_occupancy_absolute + @max_occupancy_percentage = max_occupancy_percentage + @fixed_group_layout = fixed_group_layout @disabled_seats = disabled_seats @enabled_seats = enabled_seats @index = index end + def self.fixed(name, disabled_seats = [], index = 0) + SocialDistancingRuleset.new(name, 0, false, 0, 0, 0, 0, true, disabled_seats, [], index) + end + + def self.rule_based(name, number_of_disabled_seats_to_the_sides = 0, disable_seats_in_front_and_behind = false, number_of_disabled_aisle_seats = 0, + max_group_size = 0, max_occupancy_absolute = 0, max_occupancy_percentage = 0, + disabled_seats = [], enabled_seats = [], index = 0) + SocialDistancingRuleset.new(name, number_of_disabled_seats_to_the_sides, disable_seats_in_front_and_behind, number_of_disabled_aisle_seats, + max_group_size, max_occupancy_absolute, max_occupancy_percentage, + false, disabled_seats, enabled_seats, index) + end + def == (other) self.name == other.name && self.number_of_disabled_seats_to_the_sides == other.number_of_disabled_seats_to_the_sides && self.disable_seats_in_front_and_behind == other.disable_seats_in_front_and_behind && self.number_of_disabled_aisle_seats == other.number_of_disabled_aisle_seats && self.max_group_size == other.max_group_size && + self.max_occupancy_absolute == other.max_occupancy_absolute && + self.max_occupancy_percentage == other.max_occupancy_percentage && + self.fixed_group_layout == other.fixed_group_layout && self.disabled_seats == other.disabled_seats && self.enabled_seats == other.enabled_seats && self.index == other.index end - end end