Class: IngressCycles

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

Class Method Summary collapse

Class Method Details

.checkpointsForDate(start_time, ref_date) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ingress_info.rb', line 2

def self.checkpointsForDate(start_time, ref_date)
  hours_since_start = (Time.new(ref_date.year, ref_date.month, ref_date.day, 0, 0) - start_time)/3600
  checkpointTime = Time.new(ref_date.year, ref_date.month, ref_date.day, 5 - (hours_since_start % 5), 0)
  
  checkPoints = [checkpointTime.strftime("%H:%M")]
  
  while checkpointTime.hour < 19 do
    checkpointTime += 5*60*60
    checkPoints += [checkpointTime.strftime("%H:%M")]
  end

  checkPoints += ["24:00"] if checkpointTime.hour == 19
  checkPoints.unshift("00:00") if checkpointTime.hour == 20

  checkPoints
end

.cycleEndTime(start_time) ⇒ Object



19
20
21
# File 'lib/ingress_info.rb', line 19

def self.cycleEndTime(start_time)
  start_time + 35*5*60*60
end