Class: Seatsio::SeasonsClient

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

Instance Method Summary collapse

Constructor Details

#initialize(http_client, seatsio_client) ⇒ SeasonsClient

Returns a new instance of SeasonsClient.



11
12
13
14
# File 'lib/seatsio/seasons.rb', line 11

def initialize(http_client, seatsio_client)
  @http_client = http_client
  @seatsio_client = seatsio_client
end

Instance Method Details

#add_events_to_partial_season(top_level_season_key:, partial_season_key:, event_keys:) ⇒ Object



43
44
45
46
47
48
# File 'lib/seatsio/seasons.rb', line 43

def add_events_to_partial_season(top_level_season_key:, partial_season_key:, event_keys:)
  request = {}
  request['eventKeys'] = event_keys
  response = @http_client.post("seasons/#{top_level_season_key}/partial-seasons/#{partial_season_key}/actions/add-events", request)
  Season.new(response)
end

#create(chart_key:, key: nil, number_of_events: nil, event_keys: nil, table_booking_config: nil, channels: nil, for_sale_config: nil) ⇒ Object



16
17
18
19
20
21
# File 'lib/seatsio/seasons.rb', line 16

def create(chart_key:, key: nil, number_of_events: nil, event_keys: nil,
           table_booking_config: nil, channels: nil, for_sale_config: nil)
  request = build_create_season_request(chart_key, key, number_of_events, event_keys, table_booking_config, channels, for_sale_config)
  response = @http_client.post('seasons', request)
  Season.new(response)
end

#create_events(key:, number_of_events: nil, event_keys: nil) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/seatsio/seasons.rb', line 35

def create_events(key:, number_of_events: nil, event_keys: nil)
  request = {}
  request['eventKeys'] = event_keys if event_keys
  request['numberOfEvents'] = number_of_events if number_of_events
  response = @http_client.post("seasons/#{key}/actions/create-events", request)
  Events.new(response).events
end

#create_partial_season(top_level_season_key:, partial_season_key: nil, event_keys: nil) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/seatsio/seasons.rb', line 23

def create_partial_season(top_level_season_key:, partial_season_key: nil, event_keys: nil)
  request = {}
  request['key'] = partial_season_key if partial_season_key
  request['eventKeys'] = event_keys if event_keys
  response = @http_client.post("seasons/#{top_level_season_key}/partial-seasons", request)
  Season.new(response)
end

#remove_event_from_partial_season(top_level_season_key:, partial_season_key:, event_key:) ⇒ Object



50
51
52
53
# File 'lib/seatsio/seasons.rb', line 50

def remove_event_from_partial_season(top_level_season_key:, partial_season_key:, event_key:)
  response = @http_client.delete("seasons/#{top_level_season_key}/partial-seasons/#{partial_season_key}/events/#{event_key}")
  Season.new(response)
end

#retrieve(key:) ⇒ Object



31
32
33
# File 'lib/seatsio/seasons.rb', line 31

def retrieve(key:)
  @seatsio_client.events.retrieve(key: key)
end