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.



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

Instance Attribute Details

#categoriesObject

Returns the value of attribute categories.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def categories
  @categories
end

#channelsObject

Returns the value of attribute channels.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def channels
  @channels
end

#chart_keyObject

Returns the value of attribute chart_key.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def chart_key
  @chart_key
end

#created_onObject

Returns the value of attribute created_on.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def created_on
  @created_on
end

#dateObject

Returns the value of attribute date.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def date
  @date
end

#for_sale_configObject

Returns the value of attribute for_sale_config.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def for_sale_config
  @for_sale_config
end

#idObject

Returns the value of attribute id.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def id
  @id
end

#is_event_in_seasonObject

Returns the value of attribute is_event_in_season.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def is_event_in_season
  @is_event_in_season
end

#is_in_the_pastObject

Returns the value of attribute is_in_the_past.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def is_in_the_past
  @is_in_the_past
end

#is_partial_seasonObject

Returns the value of attribute is_partial_season.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def is_partial_season
  @is_partial_season
end

#is_top_level_seasonObject

Returns the value of attribute is_top_level_season.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def is_top_level_season
  @is_top_level_season
end

#keyObject

Returns the value of attribute key.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def key
  @key
end

#nameObject

Returns the value of attribute name.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def name
  @name
end

#object_categoriesObject

Returns the value of attribute object_categories.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def object_categories
  @object_categories
end

#partial_season_keys_for_eventObject

Returns the value of attribute partial_season_keys_for_event.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def partial_season_keys_for_event
  @partial_season_keys_for_event
end

#supports_best_availableObject

Returns the value of attribute supports_best_available.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def supports_best_available
  @supports_best_available
end

#table_booking_configObject

Returns the value of attribute table_booking_config.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def table_booking_config
  @table_booking_config
end

#top_level_season_keyObject

Returns the value of attribute top_level_season_key.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def top_level_season_key
  @top_level_season_key
end

#updated_onObject

Returns the value of attribute updated_on.



194
195
196
# File 'lib/seatsio/domain.rb', line 194

def updated_on
  @updated_on
end

Class Method Details

.create_list(list = []) ⇒ Object



236
237
238
239
240
241
242
243
244
# File 'lib/seatsio/domain.rb', line 236

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

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

  result
end

.from_json(data) ⇒ Object



228
229
230
231
232
233
234
# File 'lib/seatsio/domain.rb', line 228

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

Instance Method Details

#is_seasonObject



224
225
226
# File 'lib/seatsio/domain.rb', line 224

def is_season
  false
end