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.



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/seatsio/domain.rb', line 170

def initialize(data)
  @id = data['id']
  @key = data['key']
  @chart_key = data['chartKey']
  @supports_best_available = data['supportsBestAvailable']
  @table_booking_config = TableBookingConfig::from_json(data['tableBookingConfig'])
  @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']
  @social_distancing_ruleset_key = data['socialDistancingRulesetKey']
  @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']
end

Instance Attribute Details

#categoriesObject

Returns the value of attribute categories.



164
165
166
# File 'lib/seatsio/domain.rb', line 164

def categories
  @categories
end

#channelsObject

Returns the value of attribute channels.



164
165
166
# File 'lib/seatsio/domain.rb', line 164

def channels
  @channels
end

#chart_keyObject

Returns the value of attribute chart_key.



164
165
166
# File 'lib/seatsio/domain.rb', line 164

def chart_key
  @chart_key
end

#created_onObject

Returns the value of attribute created_on.



164
165
166
# File 'lib/seatsio/domain.rb', line 164

def created_on
  @created_on
end

#for_sale_configObject

Returns the value of attribute for_sale_config.



164
165
166
# File 'lib/seatsio/domain.rb', line 164

def for_sale_config
  @for_sale_config
end

#idObject

Returns the value of attribute id.



164
165
166
# File 'lib/seatsio/domain.rb', line 164

def id
  @id
end

#is_event_in_seasonObject

Returns the value of attribute is_event_in_season.



164
165
166
# File 'lib/seatsio/domain.rb', line 164

def is_event_in_season
  @is_event_in_season
end

#is_partial_seasonObject

Returns the value of attribute is_partial_season.



164
165
166
# File 'lib/seatsio/domain.rb', line 164

def is_partial_season
  @is_partial_season
end

#is_top_level_seasonObject

Returns the value of attribute is_top_level_season.



164
165
166
# File 'lib/seatsio/domain.rb', line 164

def is_top_level_season
  @is_top_level_season
end

#keyObject

Returns the value of attribute key.



164
165
166
# File 'lib/seatsio/domain.rb', line 164

def key
  @key
end

#object_categoriesObject

Returns the value of attribute object_categories.



164
165
166
# File 'lib/seatsio/domain.rb', line 164

def object_categories
  @object_categories
end

#social_distancing_ruleset_keyObject

Returns the value of attribute social_distancing_ruleset_key.



164
165
166
# File 'lib/seatsio/domain.rb', line 164

def social_distancing_ruleset_key
  @social_distancing_ruleset_key
end

#supports_best_availableObject

Returns the value of attribute supports_best_available.



164
165
166
# File 'lib/seatsio/domain.rb', line 164

def supports_best_available
  @supports_best_available
end

#table_booking_configObject

Returns the value of attribute table_booking_config.



164
165
166
# File 'lib/seatsio/domain.rb', line 164

def table_booking_config
  @table_booking_config
end

#top_level_season_keyObject

Returns the value of attribute top_level_season_key.



164
165
166
# File 'lib/seatsio/domain.rb', line 164

def top_level_season_key
  @top_level_season_key
end

#updated_onObject

Returns the value of attribute updated_on.



164
165
166
# File 'lib/seatsio/domain.rb', line 164

def updated_on
  @updated_on
end

Class Method Details

.create_list(list = []) ⇒ Object



203
204
205
206
207
208
209
210
211
# File 'lib/seatsio/domain.rb', line 203

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

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

  result
end

.from_json(data) ⇒ Object



195
196
197
198
199
200
201
# File 'lib/seatsio/domain.rb', line 195

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

Instance Method Details

#is_seasonObject



191
192
193
# File 'lib/seatsio/domain.rb', line 191

def is_season
  false
end