lib/ika3/schedule.rb in ika3-0.10.0 vs lib/ika3/schedule.rb in ika3-1.0.0

- old
+ new

@@ -4,11 +4,11 @@ class Schedule def initialize(contact) @contact = contact end - modes = %w[regular bankara_challenge bankara_open x fest] + modes = %w[regular bankara_challenge bankara_open x fest fest_challenge] schedules = %w[now next] schedules.each do |schedule| modes.each do |mode| define_method(:"#{mode}_#{schedule}") do @@ -26,34 +26,36 @@ instance_variable_set( "@salmon_run_#{schedule}", Salmon.new(send_request(:get, "/api/coop-grouping/#{schedule}").body['results'][0]) ) end + end - def salmon_run_team_contest - return @salmon_run_team_contest unless @salmon_run_team_contest.nil? + def salmon_run_team_contest + return @salmon_run_team_contest unless @salmon_run_team_contest.nil? - @salmon_run_team_contest = Salmon.new( - send_request(:get, '/api/coop-grouping-team-contest/schedule').body['results'][0] - ) - end + @salmon_run_team_contest = Salmon.new( + send_request(:get, '/api/coop-grouping-team-contest/schedule').body['results'][0] + ) + end - def event - return @event_match unless @event_match.nil? + def event + return @event_match unless @event_match.nil? - @event_match = Battle.new(send_request(:get, '/api/event/schedule').body['results'][0]) - end + @event_match = Battle.new(send_request(:get, '/api/event/schedule').body['results'][0]) end class Battle - attr_reader :start_time, :end_time, :rule, :stages, :is_fest + attr_reader :start_time, :end_time, :rule, :stages, :is_fest, :is_tricolor, :tricolor_stage def initialize(data) @start_time = data&.[]('start_time') @end_time = data&.[]('end_time') @rule = Rule.new(data&.[]('rule')) @stages = data&.[]('stages')&.map { |stage| Stage.new(stage) } @is_fest = data&.[]('is_fest') + @is_tricolor = data&.[]('is_tricolor') + @tricolor_stage = Stage.new(data&.[]('tricolor_stage')) end class Stage attr_reader :id, :name, :image