Method: Seatsio::Event#initialize
- Defined in:
- lib/seatsio/domain.rb
#initialize(data) ⇒ Event
Returns a new instance of Event.
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/seatsio/domain.rb', line 200 def initialize(data) @id = data['id'] @key = data['key'] @chart_key = data['chartKey'] @name = data['name'] @date = Date.iso8601(data['date']) if data['date'] @supports_best_available = data['supportsBestAvailable'] @table_booking_config = TableBookingConfig::from_json(data['tableBookingConfig']) @for_sale_config = ForSaleConfig::from_json(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'] @is_top_level_season = data['isTopLevelSeason'] @is_partial_season = data['isPartialSeason'] @is_event_in_season = data['isEventInSeason'] @top_level_season_key = data['topLevelSeasonKey'] @object_categories = data['objectCategories'] @categories = Category.create_list(data['categories']) if data['categories'] @is_in_the_past = data['isInThePast'] @partial_season_keys_for_event = data['partialSeasonKeysForEvent'] end |