Class: Seatsio::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/seatsio/domain.rb

Direct Known Subclasses

Season

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Event

Returns a new instance of Event.



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/seatsio/domain.rb', line 226

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

Instance Attribute Details

#categoriesObject

Returns the value of attribute categories.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def categories
  @categories
end

#channelsObject

Returns the value of attribute channels.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def channels
  @channels
end

#chart_keyObject

Returns the value of attribute chart_key.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def chart_key
  @chart_key
end

#created_onObject

Returns the value of attribute created_on.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def created_on
  @created_on
end

#dateObject

Returns the value of attribute date.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def date
  @date
end

#for_sale_configObject

Returns the value of attribute for_sale_config.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def for_sale_config
  @for_sale_config
end

#idObject

Returns the value of attribute id.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def id
  @id
end

#is_event_in_seasonObject

Returns the value of attribute is_event_in_season.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def is_event_in_season
  @is_event_in_season
end

#is_in_the_pastObject

Returns the value of attribute is_in_the_past.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def is_in_the_past
  @is_in_the_past
end

#is_partial_seasonObject

Returns the value of attribute is_partial_season.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def is_partial_season
  @is_partial_season
end

#is_top_level_seasonObject

Returns the value of attribute is_top_level_season.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def is_top_level_season
  @is_top_level_season
end

#keyObject

Returns the value of attribute key.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def key
  @key
end

#nameObject

Returns the value of attribute name.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def name
  @name
end

#object_categoriesObject

Returns the value of attribute object_categories.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def object_categories
  @object_categories
end

#partial_season_keys_for_eventObject

Returns the value of attribute partial_season_keys_for_event.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def partial_season_keys_for_event
  @partial_season_keys_for_event
end

#supports_best_availableObject

Returns the value of attribute supports_best_available.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def supports_best_available
  @supports_best_available
end

#table_booking_configObject

Returns the value of attribute table_booking_config.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def table_booking_config
  @table_booking_config
end

#top_level_season_keyObject

Returns the value of attribute top_level_season_key.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def top_level_season_key
  @top_level_season_key
end

#updated_onObject

Returns the value of attribute updated_on.



220
221
222
# File 'lib/seatsio/domain.rb', line 220

def updated_on
  @updated_on
end

Class Method Details

.create_list(list = []) ⇒ Object



262
263
264
265
266
267
268
269
270
# File 'lib/seatsio/domain.rb', line 262

def self.create_list(list = [])
  result = []

  list.each do |item|
    result << Event.from_json(item)
  end

  result
end

.from_json(data) ⇒ Object



254
255
256
257
258
259
260
# File 'lib/seatsio/domain.rb', line 254

def self.from_json(data)
  if data['isSeason']
    Season.new(data)
  else
    Event.new(data)
  end
end

Instance Method Details

#is_seasonObject



250
251
252
# File 'lib/seatsio/domain.rb', line 250

def is_season
  false
end