lib/seatsio/domain.rb in seatsio-23.6.0 vs lib/seatsio/domain.rb in seatsio-23.7.0

- old
+ new

@@ -69,14 +69,35 @@ @categories = data['categories'] end end end + class Channel + attr_reader :key, :name, :color, :index, :objects + + def initialize(key, name, color, index, objects) + @key = key + @name = name + @color = color + @index = index + @objects = objects + end + + def == (other) + self.key == other.key && + self.name == other.name && + self.color == other.color && + self.index == other.index && + self.objects == other.objects + end + + end + class Event attr_accessor :id, :key, :chart_key, :book_whole_tables, :supports_best_available, - :table_booking_modes, :for_sale_config, :created_on, :updated_on + :table_booking_modes, :for_sale_config, :created_on, :updated_on, :channels def initialize(data) @id = data['id'] @key = data['key'] @chart_key = data['chartKey'] @@ -84,10 +105,13 @@ @supports_best_available = data['supportsBestAvailable'] @table_booking_modes = data['tableBookingModes'] @for_sale_config = ForSaleConfig.new(data['forSaleConfig']) if data['forSaleConfig'] @created_on = parse_date(data['createdOn']) @updated_on = parse_date(data['updatedOn']) + @channels = data['channels'].map { + |d| Channel.new(d['key'], d['name'], d['color'], d['index'], d['objects']) + } if data['channels'] end def self.create_list(list = []) result = [] @@ -204,10 +228,10 @@ end class ChartReportItem attr_reader :label, :labels, :category_key, :category_label, :section, :entrance, :capacity, :object_type, - :left_neighbour, :right_neighbour + :left_neighbour, :right_neighbour def initialize(data) @label = data['label'] @labels = data['labels'] @category_label = data['categoryLabel']